Python sqlalchemy.BOOLEAN Examples

The following are 30 code examples of sqlalchemy.BOOLEAN(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sqlalchemy , or try the search function .
Example #1
Source File: 2019-09-08_c225ea8fbf5e_add_hash_and_parent_hash_columns.py    From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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 ### 
Example #2
Source File: 2019_08_18_1197d4b7ce86_permanentyly_summarized_flag.py    From ultimate-poll-bot with MIT License 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "poll",
        sa.Column(
            "permanently_summarized",
            sa.Boolean(),
            server_default="false",
            nullable=False,
        ),
    )
    op.alter_column(
        "poll",
        "summarize",
        existing_type=sa.BOOLEAN(),
        server_default=None,
        existing_nullable=False,
    )
    # ### end Alembic commands ### 
Example #3
Source File: d4d2c5aa8a0_add_granularity_to_watching_repos.py    From pagure with GNU General Public License v2.0 6 votes vote down vote up
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') 
Example #4
Source File: 2020_06_28_ff4a8e283767_remove_unneeded_server_defaults.py    From ultimate-poll-bot with MIT License 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('daily_statistic', 'notifications',
               existing_type=sa.INTEGER(),
               server_default=None,
               existing_nullable=False)
    op.alter_column('poll', 'allow_sharing',
               existing_type=sa.BOOLEAN(),
               server_default=None,
               existing_nullable=False)
    op.alter_column('poll', 'show_option_votes',
               existing_type=sa.BOOLEAN(),
               server_default=None,
               existing_nullable=False)
    op.alter_column('user', 'banned',
               existing_type=sa.BOOLEAN(),
               server_default=None,
               existing_nullable=False)
    op.alter_column('user', 'deleted',
               existing_type=sa.BOOLEAN(),
               server_default=None,
               existing_nullable=False)
    # ### end Alembic commands ### 
Example #5
Source File: 2019_11_07_b314e45c659e_remove_server_defaults.py    From ultimate-poll-bot with MIT License 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "user",
        "admin",
        existing_type=sa.BOOLEAN(),
        server_default=None,
        existing_nullable=False,
    )
    op.alter_column(
        "user",
        "broadcast_sent",
        existing_type=sa.BOOLEAN(),
        server_default=None,
        existing_nullable=False,
    )
    op.alter_column(
        "user",
        "notifications_enabled",
        existing_type=sa.BOOLEAN(),
        server_default=None,
        existing_nullable=False,
    )
    # ### end Alembic commands ### 
Example #6
Source File: 2019_11_07_b314e45c659e_remove_server_defaults.py    From ultimate-poll-bot with MIT License 6 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(
        "user",
        "notifications_enabled",
        existing_type=sa.BOOLEAN(),
        server_default=sa.text("true"),
        existing_nullable=False,
    )
    op.alter_column(
        "user",
        "broadcast_sent",
        existing_type=sa.BOOLEAN(),
        server_default=sa.text("false"),
        existing_nullable=False,
    )
    op.alter_column(
        "user",
        "admin",
        existing_type=sa.BOOLEAN(),
        server_default=sa.text("false"),
        existing_nullable=False,
    )
    # ### end Alembic commands ### 
Example #7
Source File: 131ad2dc5bbd_table_for_no_new_branches_hook.py    From pagure with GNU General Public License v2.0 6 votes vote down vote up
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')
    ) 
Example #8
Source File: 2019_06_06_5b172edeaf8d_show_percentage_option.py    From ultimate-poll-bot with MIT License 6 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_unique_constraint(
        "vote_user_id_poll_id_poll_option_id_key",
        "vote",
        ["user_id", "poll_id", "poll_option_id"],
    )
    op.drop_constraint("one_vote_per_option_and_user", "vote", type_="unique")
    op.alter_column(
        "poll",
        "results_visible",
        existing_type=sa.BOOLEAN(),
        server_default=sa.text("true"),
        existing_nullable=False,
    )
    op.drop_column("poll", "show_percentage")
    # ### end Alembic commands ### 
Example #9
Source File: 2019_08_21_0a1d3e362730_doodle_compact_button_flag.py    From ultimate-poll-bot with MIT License 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "poll",
        sa.Column(
            "compact_doodle_buttons",
            sa.Boolean(),
            server_default="true",
            nullable=False,
        ),
    )
    op.alter_column(
        "poll",
        "permanently_summarized",
        existing_type=sa.BOOLEAN(),
        server_default=None,
        existing_nullable=False,
    )
    # ### end Alembic commands ### 
Example #10
Source File: 2019_06_06_5b172edeaf8d_show_percentage_option.py    From ultimate-poll-bot with MIT License 6 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "poll",
        sa.Column(
            "show_percentage", sa.Boolean(), server_default="true", nullable=False
        ),
    )
    op.alter_column(
        "poll",
        "results_visible",
        existing_type=sa.BOOLEAN(),
        server_default=None,
        existing_nullable=False,
    )
    op.create_unique_constraint(
        "one_vote_per_option_and_user", "vote", ["user_id", "poll_id", "poll_option_id"]
    )
    op.drop_constraint(
        "vote_user_id_poll_id_poll_option_id_key", "vote", type_="unique"
    )
    # ### end Alembic commands ### 
Example #11
Source File: 24f943b464ae_.py    From SempoBlockchain with GNU General Public License v3.0 6 votes vote down vote up
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 ### 
Example #12
Source File: 778e1348250b_.py    From SempoBlockchain with GNU General Public License v3.0 6 votes vote down vote up
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 ### 
Example #13
Source File: 6a4457517a3_rename_acl_creator_only_to_project_.py    From sgx-kms with Apache License 2.0 6 votes vote down vote up
def upgrade():

    ctx = op.get_context()
    con = op.get_bind()

    op.alter_column('secret_acls', 'creator_only', existing_type=sa.BOOLEAN(),
                    new_column_name='project_access')

    # reverse existing flag value as project_access is negation of creator_only
    op.execute('UPDATE secret_acls SET project_access = NOT project_access',
               execution_options={'autocommit': True})

    op.alter_column('container_acls', 'creator_only',
                    existing_type=sa.BOOLEAN(),
                    new_column_name='project_access')

    # reverse existing flag value as project_access is negation of creator_only
    op.execute('UPDATE container_acls SET project_access = NOT project_access',
               execution_options={'autocommit': True}) 
Example #14
Source File: 7583891c4ae5_.py    From SempoBlockchain with GNU General Public License v3.0 6 votes vote down vote up
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 ### 
Example #15
Source File: 20190401_19-03-55__revert_task_table_creation.py    From busy-beaver with MIT License 6 votes vote down vote up
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 ### 
Example #16
Source File: f8eb70b3aa2b_create_application_manifests.py    From commandment with MIT License 6 votes vote down vote up
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) 
Example #17
Source File: 026e6bde589e_.py    From SempoBlockchain with GNU General Public License v3.0 6 votes vote down vote up
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 ### 
Example #18
Source File: 3adfdd6598df_.py    From lemur with Apache License 2.0 6 votes vote down vote up
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") 
Example #19
Source File: 3c523b7fe87d_.py    From SempoBlockchain with GNU General Public License v3.0 6 votes vote down vote up
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 ### 
Example #20
Source File: 1083bb6545c9_.py    From website with MIT License 6 votes vote down vote up
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") 
Example #21
Source File: 2019_04_01_4c9a81798173_remove_expecting_sticker_set.py    From sticker-finder with MIT License 6 votes vote down vote up
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 ### 
Example #22
Source File: 2019_04_15_35223866defb_fix_tag_schema.py    From sticker-finder with MIT License 6 votes vote down vote up
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) 
Example #23
Source File: 0015_fix_template_data.py    From notifications-api with MIT License 6 votes vote down vote up
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 ### 
Example #24
Source File: 0277_consent_to_research_null.py    From notifications-api with MIT License 5 votes vote down vote up
def upgrade():
    op.alter_column(
        'services',
        'consent_to_research',
        existing_type=sa.BOOLEAN(),
        nullable=True,
        server_default=sa.null(),
    )
    op.alter_column(
        'services_history',
        'consent_to_research',
        existing_type=sa.BOOLEAN(),
        nullable=True,
        server_default=sa.null(),
    )
    op.execute("""
        UPDATE
            services
        SET
            consent_to_research = null
    """)
    op.execute("""
        UPDATE
            services_history
        SET
            consent_to_research = null
    """) 
Example #25
Source File: 0258_service_postage_nullable.py    From notifications-api with MIT License 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('services_history', 'postage', existing_type=sa.BOOLEAN(), nullable=False)
    op.alter_column('services', 'postage', existing_type=sa.BOOLEAN(), nullable=False)
    # ### end Alembic commands ### 
Example #26
Source File: 0258_service_postage_nullable.py    From notifications-api with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('services_history', 'postage', existing_type=sa.BOOLEAN(), nullable=True)
    op.alter_column('services', 'postage', existing_type=sa.BOOLEAN(), nullable=True)
    # ### end Alembic commands ### 
Example #27
Source File: 2019_09_21_10aa7e1f95ec_is_animated_flag.py    From sticker-finder with MIT License 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('sticker', 'banned',
               existing_type=sa.BOOLEAN(),
               server_default=sa.text('false'),
               existing_nullable=False)
    op.drop_column('sticker', 'animated')
    op.alter_column('inline_query_request', 'fuzzy',
               existing_type=sa.BOOLEAN(),
               server_default=sa.text('false'),
               existing_nullable=True)
    # ### end Alembic commands ### 
Example #28
Source File: 2019_09_30_b5e309bfc338_user_notification_flag.py    From sticker-finder with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user', sa.Column('notifications', sa.Boolean(), server_default='True', nullable=False))
    op.alter_column('user', 'furry',
               existing_type=sa.BOOLEAN(),
               server_default=None,
               existing_nullable=False)
    op.alter_column('user', 'nsfw',
               existing_type=sa.BOOLEAN(),
               server_default=None,
               existing_nullable=False)
    # ### end Alembic commands ### 
Example #29
Source File: 2019_06_28_381ef6581a03_dateformat.py    From ultimate-poll-bot with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "poll",
        sa.Column(
            "european_date_format", sa.Boolean(), server_default="false", nullable=False
        ),
    )
    op.alter_column(
        "poll",
        "allow_new_options",
        existing_type=sa.BOOLEAN(),
        server_default=None,
        existing_nullable=False,
    )
    op.alter_column(
        "poll",
        "deleted",
        existing_type=sa.BOOLEAN(),
        server_default=None,
        existing_nullable=False,
    )
    op.alter_column(
        "poll",
        "show_percentage",
        existing_type=sa.BOOLEAN(),
        server_default=None,
        existing_nullable=False,
    )
    op.add_column(
        "poll_option",
        sa.Column("is_date", sa.Boolean(), server_default="False", nullable=False),
    )
    # ### end Alembic commands ### 
Example #30
Source File: 2019_09_30_7b11c2291b8f_fix_cascade.py    From sticker-finder with MIT License 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('user', 'notifications',
               existing_type=sa.BOOLEAN(),
               server_default=sa.text('true'),
               existing_nullable=False)
    op.drop_constraint('chat_current_task_id_fkey', 'chat', type_='foreignkey')
    op.create_foreign_key('chat_current_task_id_fkey', 'chat', 'task', ['current_task_id'], ['id'], ondelete='CASCADE')
    # ### end Alembic commands ###