本文整理汇总了Python中sqlalchemy.BOOLEAN属性的典型用法代码示例。如果您正苦于以下问题:Python sqlalchemy.BOOLEAN属性的具体用法?Python sqlalchemy.BOOLEAN怎么用?Python sqlalchemy.BOOLEAN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sqlalchemy
的用法示例。
在下文中一共展示了sqlalchemy.BOOLEAN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: downgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [as 别名]
def downgrade():
op.add_column('watchers', sa.Column('watch', sa.BOOLEAN(), nullable=True))
# This section is to update the `watch` column with the value of
# `watch_issues`
connection = op.get_bind()
for watcher in connection.execute(watcher_helper.select()):
connection.execute(
watcher_helper.update().where(
watcher_helper.c.id == watcher.id
).values(
watch=watcher.watch_issues
)
)
with op.batch_alter_table('watchers') as b:
# Set nullable to False now that we've set values
b.alter_column('watch', nullable=False)
# Drop the added columns
b.drop_column('watch_issues')
b.drop_column('watch_commits')
示例2: upgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [as 别名]
def upgrade():
""" Create table for PagureNoNewBranchesHook. """
op.create_table(
'hook_pagure_no_new_branches',
sa.Column('id', sa.INTEGER(), nullable=False),
sa.Column('project_id', sa.INTEGER(), nullable=False),
sa.Column('active', sa.BOOLEAN(), nullable=False),
sa.ForeignKeyConstraint(
['project_id'],
[u'projects.id'],
name=u'hook_pagure_no_new_branches_project_id_fkey',
onupdate=u'CASCADE',
ondelete=u'CASCADE'
),
sa.PrimaryKeyConstraint('id', name=u'hook_pagure_no_new_branches_pkey')
)
示例3: downgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('web_pages_version', sa.Column('is_delta', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.drop_constraint(None, 'web_pages_version', type_='foreignkey')
op.drop_column('web_pages_version', 'parent_hash')
op.drop_column('web_pages_version', 'data_hash')
op.add_column('rss_parser_funcs_version', sa.Column('is_delta', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.drop_constraint(None, 'rss_parser_funcs_version', type_='foreignkey')
op.drop_column('rss_parser_funcs_version', 'parent_hash')
op.drop_column('rss_parser_funcs_version', 'data_hash')
op.add_column('rss_parser_feed_name_lut_version', sa.Column('is_delta', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.drop_constraint(None, 'rss_parser_feed_name_lut_version', type_='foreignkey')
op.drop_column('rss_parser_feed_name_lut_version', 'parent_hash')
op.drop_column('rss_parser_feed_name_lut_version', 'data_hash')
op.add_column('raw_web_pages_version', sa.Column('is_delta', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.drop_constraint(None, 'raw_web_pages_version', type_='foreignkey')
op.drop_column('raw_web_pages_version', 'parent_hash')
op.drop_column('raw_web_pages_version', 'data_hash')
# ### end Alembic commands ###
开发者ID:fake-name,项目名称:ReadableWebProxy,代码行数:21,代码来源:2019-09-08_c225ea8fbf5e_add_hash_and_parent_hash_columns.py
示例4: downgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [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
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('user', sa.Column('_public_serial_number', sa.VARCHAR(), autoincrement=False, nullable=True))
op.drop_column('user', 'public_serial_number')
op.add_column('uploaded_document', sa.Column('business_verification_id', sa.INTEGER(), autoincrement=False, nullable=True))
op.drop_constraint(None, 'uploaded_document', type_='foreignkey')
op.create_foreign_key('uploaded_document_business_verification_id_fkey', 'uploaded_document', 'kyc_application', ['business_verification_id'], ['id'])
op.drop_column('uploaded_document', 'kyc_application_id')
op.add_column('transfer_card', sa.Column('amount_loaded_signature', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('transfer_card', sa.Column('user_id', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('transfer_card', sa.Column('_amount_loaded', sa.INTEGER(), autoincrement=False, nullable=True))
op.create_foreign_key('transfer_card_user_id_fkey', 'transfer_card', 'user', ['user_id'], ['id'])
op.drop_column('kyc_application', 'type')
op.add_column('credit_transfer', sa.Column('uuid', sa.VARCHAR(), autoincrement=False, nullable=True))
op.add_column('blockchain_transaction', sa.Column('is_bitcoin', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.add_column('blockchain_transaction', sa.Column('has_output_txn', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.add_column('bank_account', sa.Column('business_verification_id', sa.INTEGER(), autoincrement=False, nullable=True))
op.drop_constraint(None, 'bank_account', type_='foreignkey')
op.create_foreign_key('bank_account_business_verification_id_fkey', 'bank_account', 'kyc_application', ['business_verification_id'], ['id'])
op.drop_column('bank_account', 'wyre_id')
op.drop_column('bank_account', 'kyc_application_id')
# ### end Alembic commands ###
示例6: downgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('user', sa.Column('is_superadmin', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.add_column('user', sa.Column('is_admin', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.drop_constraint(None, 'user', type_='foreignkey')
op.drop_column('user', 'secret')
op.drop_column('user', 'public_serial_number')
op.drop_column('user', 'nfc_serial_number')
op.drop_column('user', 'chatbot_state_id')
op.drop_column('user', '_is_superadmin')
op.drop_column('user', '_is_subadmin')
op.drop_column('user', '_is_admin')
op.create_table('pin_to_public_id',
sa.Column('id', sa.INTEGER(), nullable=False),
sa.Column('public_id', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('PIN', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name='pin_to_public_id_pkey')
)
op.drop_table('public_serial_number')
op.drop_table('chatbot_state')
# ### end Alembic commands ###
示例7: downgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [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 ###
示例8: downgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [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
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [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")
示例10: upgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [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 ###
示例11: downgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [as 别名]
def downgrade():
"""Restore previous version."""
op.add_column('sticker_tag', sa.Column('tag_is_default_language', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.drop_constraint('sticker_tag_tag_name_fkey', 'sticker_tag', type_='foreignkey')
op.create_foreign_key(
'sticker_tag_tag_name_fkey', 'sticker_tag', 'tag',
['tag_name', 'tag_is_default_language'],
['name', 'is_default_language'],
onupdate='CASCADE', ondelete='CASCADE', deferrable=True)
op.drop_constraint('change_removed_tags_tag_name_fkey', 'change_removed_tags', type_='foreignkey')
op.create_foreign_key(
'change_removed_tags_tag_name_fkey', 'change_removed_tags', 'tag',
['tag_name', 'tag_is_default_language'],
['name', 'is_default_language'], onupdate='CASCADE',
ondelete='CASCADE', deferrable=True)
op.drop_constraint('change_added_tags_tag_name_fkey', 'change_added_tags', type_='foreignkey')
op.create_foreign_key('change_added_tags_tag_name_fkey', 'change_added_tags', 'tag',
['tag_name', 'tag_is_default_language'],
['name', 'is_default_language'],
onupdate='CASCADE', ondelete='CASCADE', deferrable=True)
示例12: downgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('sticker_usage', 'usage_count',
existing_type=sa.INTEGER(),
nullable=False)
op.add_column('chat', sa.Column('expecting_sticker_set', sa.BOOLEAN(), autoincrement=False, nullable=False))
op.drop_constraint("only_one_action_check", "chat")
op.create_check_constraint("only_one_action_check", "chat", """
(expecting_sticker_set IS TRUE AND tagging_random_sticker IS FALSE AND fix_single_sticker IS FALSE AND full_sticker_set IS FALSE) OR \
(tagging_random_sticker IS TRUE AND expecting_sticker_set IS FALSE AND fix_single_sticker IS FALSE AND full_sticker_set IS FALSE) OR \
(fix_single_sticker IS TRUE AND tagging_random_sticker IS FALSE AND expecting_sticker_set IS FALSE AND full_sticker_set IS FALSE) OR \
(full_sticker_set IS TRUE AND tagging_random_sticker IS FALSE AND fix_single_sticker IS FALSE AND expecting_sticker_set IS FALSE) OR \
(full_sticker_set IS FALSE AND tagging_random_sticker IS FALSE AND fix_single_sticker IS FALSE AND expecting_sticker_set IS FALSE)
""")
# ### end Alembic commands ###
开发者ID:Nukesor,项目名称:sticker-finder,代码行数:18,代码来源:2019_04_01_4c9a81798173_remove_expecting_sticker_set.py
示例13: downgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [as 别名]
def downgrade():
print("Removing dns_providers_id foreign key on pending_certs table")
op.drop_constraint(None, "pending_certs", type_="foreignkey")
print("Reverting column types in the api_keys table")
op.alter_column("api_keys", "user_id", existing_type=sa.INTEGER(), nullable=False)
op.alter_column("api_keys", "ttl", existing_type=sa.BIGINT(), nullable=False)
op.alter_column("api_keys", "revoked", existing_type=sa.BOOLEAN(), nullable=False)
op.alter_column("api_keys", "issued_at", existing_type=sa.BIGINT(), nullable=False)
print("Reverting certificates_dns_providers_fk foreign key")
op.drop_constraint(
"certificates_dns_providers_fk", "certificates", type_="foreignkey"
)
print("Dropping pending_dns_authorizations table")
op.drop_table("pending_dns_authorizations")
print("Undoing modifications to pending_certs table")
op.drop_column("pending_certs", "options")
op.drop_column("pending_certs", "dns_provider_id")
print("Undoing modifications to certificates table")
op.drop_column("certificates", "dns_provider_id")
print("Deleting dns_providers table")
op.drop_table("dns_providers")
示例14: schema_downgrades
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [as 别名]
def schema_downgrades():
"""schema downgrade migrations go here."""
#op.add_column('application_manifests', sa.Column('full_image_needs_shine', sa.BOOLEAN(), nullable=True))
#op.add_column('application_manifests', sa.Column('full_image_url', sa.VARCHAR(), nullable=True))
# op.create_unique_constraint('uq_application_bundle_version', 'application_manifests', ['bundle_id', 'bundle_version'])
op.drop_index(op.f('ix_application_manifests_bundle_version'), table_name='application_manifests')
op.drop_index(op.f('ix_application_manifests_bundle_id'), table_name='application_manifests')
# op.alter_column('application_manifests', 'bundle_id',
# existing_type=sa.VARCHAR(),
# nullable=True)
# op.drop_column('application_manifests', 'full_size_image_url')
# op.drop_column('application_manifests', 'full_size_image_needs_shine')
#op.drop_constraint(None, 'application_manifest_checksums', type_='foreignkey')
#op.create_foreign_key(None, 'application_manifest_checksums', 'application_manifests', ['application_manifest_id'], ['id'], ondelete='CASCADE')
#op.create_unique_constraint('uq_application_checksum_index', 'application_manifest_checksums', ['application_manifest_id', 'checksum_index'])
# op.alter_column('application_manifest_checksums', 'application_manifest_id',
# existing_type=sa.INTEGER(),
# nullable=False)
示例15: downgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import BOOLEAN [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"task",
sa.Column(
"date_created", postgresql.TIMESTAMP(), autoincrement=False, nullable=True
),
sa.Column(
"date_modified", postgresql.TIMESTAMP(), autoincrement=False, nullable=True
),
sa.Column("id", sa.VARCHAR(length=36), autoincrement=False, nullable=False),
sa.Column("name", sa.VARCHAR(length=128), autoincrement=False, nullable=True),
sa.Column(
"description", sa.VARCHAR(length=128), autoincrement=False, nullable=True
),
sa.Column("failed", sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.Column("complete", sa.BOOLEAN(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint("id", name="task_pkey"),
)
op.create_index("ix_task_name", "task", ["name"], unique=False)
# ### end Alembic commands ###
开发者ID:busy-beaver-dev,项目名称:busy-beaver,代码行数:23,代码来源:20190401_19-03-55__revert_task_table_creation.py