本文整理汇总了Python中sqlalchemy.dialects.postgresql.TIMESTAMP属性的典型用法代码示例。如果您正苦于以下问题:Python postgresql.TIMESTAMP属性的具体用法?Python postgresql.TIMESTAMP怎么用?Python postgresql.TIMESTAMP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sqlalchemy.dialects.postgresql
的用法示例。
在下文中一共展示了postgresql.TIMESTAMP属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('client_scope',
sa.Column('client_id', sa.INTEGER(), autoincrement=False, nullable=False),
sa.Column('scope_id', sa.INTEGER(), autoincrement=False, nullable=False),
sa.ForeignKeyConstraint(['client_id'], ['client.id'], name='client_scope_client_id_fkey', ondelete='CASCADE'),
sa.ForeignKeyConstraint(['scope_id'], ['scope.id'], name='client_scope_scope_id_fkey', ondelete='CASCADE'),
sa.PrimaryKeyConstraint('client_id', 'scope_id', name='client_scope_pkey')
)
op.create_table('scope',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
sa.Column('updated_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('name', sa.VARCHAR(length=128), autoincrement=False, nullable=False),
sa.PrimaryKeyConstraint('id', name='scope_pkey'),
sa.UniqueConstraint('name', name='scope_name_key')
)
# ### end Alembic commands ###
示例2: upgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('key_value_store',
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('key', sa.Text(), nullable=False),
sa.Column('value', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.PrimaryKeyConstraint('id')
)
print("Creating index")
op.create_index(op.f('ix_key_value_store_key'), 'key_value_store', ['key'], unique=True)
print("Applying not-null constraing")
op.alter_column('nu_release_item', 'release_date',
existing_type=postgresql.TIMESTAMP(),
nullable=False)
# ### end Alembic commands ###
示例3: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('organisation', 'system_blockchain_address')
op.create_table('spend_approvals',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('authorising_user_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('created', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('updated', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('eth_send_task_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('approval_task_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('token_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('giving_transfer_account_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('receiving_transfer_account_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['giving_transfer_account_id'], ['transfer_account.id'], name='spend_approvals_giving_transfer_account_id_fkey'),
sa.ForeignKeyConstraint(['receiving_transfer_account_id'], ['transfer_account.id'], name='spend_approvals_receiving_transfer_account_id_fkey'),
sa.ForeignKeyConstraint(['token_id'], ['token.id'], name='spend_approvals_token_id_fkey'),
sa.PrimaryKeyConstraint('id', name='spend_approvals_pkey')
)
op.drop_table('spend_approval')
# ### end Alembic commands ###
示例4: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('user', sa.Column('chatbot_state_id', sa.INTEGER(), autoincrement=False, nullable=True))
op.create_foreign_key('user_chatbot_state_id_fkey', 'user', 'chatbot_state', ['chatbot_state_id'], ['id'])
op.create_table('chatbot_state',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('created', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('transfer_initialised', sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.Column('transfer_amount', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('prev_pin_failures', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('last_accessed', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('authorising_user_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('updated', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('provider_message_id', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('target_user_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name='chatbot_state_pkey')
)
# ### end Alembic commands ###
示例5: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('user', sa.Column('targeting_survey_id', sa.INTEGER(), autoincrement=False, nullable=True))
op.create_foreign_key('user_targeting_survey_id_fkey', 'user', 'targeting_survey', ['targeting_survey_id'], ['id'])
op.create_table('targeting_survey',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('created', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('number_people_household', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('number_below_adult_age_household', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('number_people_women_household', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('number_people_men_household', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('number_people_work_household', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('disabilities_household', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('long_term_illnesses_household', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('authorising_user_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('updated', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name='targeting_survey_pkey')
)
# ### end Alembic commands ###
示例6: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('blockchain_transaction',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('created', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('submitted_date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('added_date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('hash', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('credit_transfer_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('authorising_user_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('updated', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('block', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('status', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('transaction_type', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('message', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('signing_blockchain_address_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('nonce', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('has_output_txn', sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.Column('is_bitcoin', sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['credit_transfer_id'], ['credit_transfer.id'], name='blockchain_transaction_credit_transfer_id_fkey'),
sa.ForeignKeyConstraint(['signing_blockchain_address_id'], ['blockchain_address.id'], name='blockchain_transaction_signing_blockchain_address_id_fkey'),
sa.PrimaryKeyConstraint('id', name='blockchain_transaction_pkey')
)
# ### end Alembic commands ###
示例7: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('user', 'last_name')
op.drop_column('user', 'first_name')
op.add_column('transfer_account', sa.Column('vendor_id', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('transfer_account', sa.Column('first_name', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('transfer_account', sa.Column('last_name', sa.VARCHAR(), autoincrement=False, nullable=True))
op.create_foreign_key('transfer_account_vendor_id_fkey', 'transfer_account', 'transfer_account', ['vendor_id'], ['id'])
op.drop_column('transfer_account', 'payable_period_type')
op.drop_column('transfer_account', 'payable_period_length')
op.drop_column('transfer_account', 'payable_epoch')
op.drop_column('transfer_account', 'name')
op.drop_column('transfer_account', 'is_vendor')
op.create_table('vendor',
sa.Column('id', sa.INTEGER(), nullable=False),
sa.Column('created', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('name', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('payable_period_type', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('payable_period_length', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name='vendor_pkey')
)
# ### end Alembic commands ###
示例8: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('transfer_account', sa.Column('chat_transfer_amount', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('transfer_account', sa.Column('chat_prev_pin_failures', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('transfer_account', sa.Column('secret', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('transfer_account', sa.Column('chat_last_accessed', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
op.add_column('transfer_account', sa.Column('pin', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('transfer_account', sa.Column('chat_target_account_id', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('transfer_account', sa.Column('nfc_card_id', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('transfer_account', sa.Column('facebook_psid', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('transfer_account', sa.Column('chat_source_preference', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('transfer_account', sa.Column('qr_code', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('transfer_account', sa.Column('_phone', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('transfer_account', sa.Column('chat_transfer_initialised', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.drop_constraint(None, 'transfer_account', type_='foreignkey')
op.drop_column('transfer_account', 'vendor_id')
op.drop_table('vendor')
# ### end Alembic commands ###
示例9: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('referral',
sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column('authorising_user_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column('created', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('updated', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('first_name', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('last_name', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('reason', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('_phone', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('referring_user_id', sa.INTEGER(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['referring_user_id'], ['user.id'], name='referral_referring_user_id_fkey'),
sa.PrimaryKeyConstraint('id', name='referral_pkey')
)
# ### end Alembic commands ###
示例10: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def downgrade():
op.create_table(
"project_members",
sa.Column("user_id", sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column("project_id", sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column(
"date_joined", postgresql.TIMESTAMP(), autoincrement=False, nullable=True
),
sa.Column("is_lead", sa.BOOLEAN(), autoincrement=False, nullable=False),
sa.ForeignKeyConstraint(
["project_id"], ["projects.id"], name="project_members_project_id_fkey"
),
sa.ForeignKeyConstraint(
["user_id"], ["users.id"], name="project_members_user_id_fkey"
),
)
op.drop_index(
op.f("ix_project_memberships_is_lead"), table_name="project_memberships"
)
op.drop_table("project_memberships")
示例11: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('monthly_billing',
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('service_id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('notification_type', postgresql.ENUM('email', 'sms', 'letter', name='notification_type'), autoincrement=False, nullable=False),
sa.Column('monthly_totals', postgresql.JSON(astext_type=sa.Text()), autoincrement=False, nullable=False),
sa.Column('updated_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
sa.Column('start_date', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
sa.Column('end_date', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
sa.ForeignKeyConstraint(['service_id'], ['services.id'], name='monthly_billing_service_id_fkey'),
sa.PrimaryKeyConstraint('id', name='monthly_billing_pkey'),
sa.UniqueConstraint('service_id', 'start_date', 'notification_type', name='uix_monthly_billing')
)
op.create_index('ix_monthly_billing_service_id', 'monthly_billing', ['service_id'], unique=False)
# ### end Alembic commands ###
示例12: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def downgrade():
op.create_table('job_statistics',
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('job_id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('emails_sent', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('emails_delivered', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('emails_failed', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('sms_sent', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('sms_delivered', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('sms_failed', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('letters_sent', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('letters_failed', sa.BIGINT(), autoincrement=False, nullable=False),
sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('updated_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('sent', sa.BIGINT(), autoincrement=False, nullable=True),
sa.Column('delivered', sa.BIGINT(), autoincrement=False, nullable=True),
sa.Column('failed', sa.BIGINT(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], name='job_statistics_job_id_fkey'),
sa.PrimaryKeyConstraint('id', name='job_statistics_pkey')
)
示例13: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint("fk_templates_created_by_id", 'templates', type_='foreignkey')
op.drop_index(op.f('ix_templates_created_by_id'), table_name='templates')
op.drop_column('templates', 'version')
op.drop_column('templates', 'created_by_id')
op.alter_column('api_keys_history', 'created_by_id',
existing_type=postgresql.UUID(),
nullable=True)
op.alter_column('api_keys_history', 'created_at',
existing_type=postgresql.TIMESTAMP(),
nullable=True)
op.drop_index(op.f('ix_templates_history_service_id'), table_name='templates_history')
op.drop_index(op.f('ix_templates_history_created_by_id'), table_name='templates_history')
op.drop_table('templates_history')
### end Alembic commands ###
示例14: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def downgrade():
op.drop_table('letter_rates')
op.create_table('letter_rates',
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('valid_from', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
sa.PrimaryKeyConstraint('id', name='letter_rates_pkey'),
postgresql_ignore_search_path=False
)
op.create_table('letter_rate_details',
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('letter_rate_id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('page_total', sa.INTEGER(), autoincrement=False, nullable=False),
sa.Column('rate', sa.NUMERIC(), autoincrement=False, nullable=False),
sa.ForeignKeyConstraint(['letter_rate_id'], ['letter_rates.id'],
name='letter_rate_details_letter_rate_id_fkey'),
sa.PrimaryKeyConstraint('id', name='letter_rate_details_pkey')
)
示例15: upgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import TIMESTAMP [as 别名]
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.get_bind()
query = 'update templates_history set created_by_id = ' \
'(select created_by_id from templates where templates.id = templates_history.id) ' \
'where created_by_id is null'
op.execute(query)
op.execute('update templates_history set archived = False')
op.alter_column('api_keys_history', 'created_at',
existing_type=postgresql.TIMESTAMP(),
nullable=False)
op.alter_column('api_keys_history', 'created_by_id',
existing_type=postgresql.UUID(),
nullable=False)
op.alter_column('templates_history', 'archived',
existing_type=sa.BOOLEAN(),
nullable=False)
op.alter_column('templates_history', 'created_by_id',
existing_type=postgresql.UUID(),
nullable=False)
### end Alembic commands ###