Python sqlalchemy.BIGINT Examples

The following are 27 code examples of sqlalchemy.BIGINT(). 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: 0141_remove_unused.py    From notifications-api with MIT License 6 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('services_history', sa.Column('sms_sender', sa.VARCHAR(length=11), autoincrement=False, nullable=True))
    op.add_column('services', sa.Column('sms_sender', sa.VARCHAR(length=11), autoincrement=False, nullable=True))
    op.create_table('notification_statistics',
        sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
        sa.Column('service_id', postgresql.UUID(), autoincrement=False, nullable=False),
        sa.Column('emails_requested', 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_requested', 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('day', sa.DATE(), autoincrement=False, nullable=False),
        sa.ForeignKeyConstraint(['service_id'], ['services.id'], name='notification_statistics_service_id_fkey'),
        sa.PrimaryKeyConstraint('id', name='notification_statistics_pkey'),
        sa.UniqueConstraint('service_id', 'day', name='uix_service_to_day')
    ) 
Example #2
Source File: 52271b243ba2_remove_messages_table_for_good.py    From Titan with GNU Affero General Public License v3.0 6 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('messages',
    sa.Column('guild_id', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('channel_id', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('message_id', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('content', sa.TEXT(), autoincrement=False, nullable=False),
    sa.Column('author', sa.TEXT(), autoincrement=False, nullable=False),
    sa.Column('timestamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
    sa.Column('edited_timestamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('mentions', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('attachments', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('embeds', sa.TEXT(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('message_id', name='messages_pkey')
    )
    # ### end Alembic commands ### 
Example #3
Source File: 1d2c2dc41e86_removed_guild_members_table.py    From Titan with GNU Affero General Public License v3.0 6 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('guild_members',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('guild_id', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('user_id', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('username', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
    sa.Column('discriminator', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('nickname', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
    sa.Column('avatar', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
    sa.Column('active', sa.BOOLEAN(), server_default=sa.text('true'), autoincrement=False, nullable=False),
    sa.Column('banned', sa.BOOLEAN(), server_default=sa.text('false'), autoincrement=False, nullable=False),
    sa.Column('roles', sa.TEXT(), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('id', name='idx_25210_primary')
    )
    # ### end Alembic commands ### 
Example #4
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 #5
Source File: 0107_drop_template_stats.py    From notifications-api with MIT License 6 votes vote down vote up
def downgrade():
    op.add_column('service_permissions',
                  sa.Column('updated_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
    op.create_table('template_statistics',
                    sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
                    sa.Column('service_id', postgresql.UUID(), autoincrement=False, nullable=False),
                    sa.Column('template_id', postgresql.UUID(), autoincrement=False, nullable=False),
                    sa.Column('usage_count', sa.BIGINT(), autoincrement=False, nullable=False),
                    sa.Column('day', sa.DATE(), autoincrement=False, nullable=False),
                    sa.Column('updated_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
                    sa.ForeignKeyConstraint(['service_id'], ['services.id'],
                                            name='template_statistics_service_id_fkey'),
                    sa.ForeignKeyConstraint(['template_id'], ['templates.id'],
                                            name='template_statistics_template_id_fkey'),
                    sa.PrimaryKeyConstraint('id', name='template_statistics_pkey')
                    ) 
Example #6
Source File: 0175_drop_job_statistics_table.py    From notifications-api with MIT License 6 votes vote down vote up
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')
    ) 
Example #7
Source File: 00030_be0687950ece_actually_dropping_unused_columns_now.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('feed_pages', sa.Column('feedurl', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column('feed_pages', sa.Column('srcname', sa.TEXT(), autoincrement=False, nullable=True))
    op.create_table('nu_outbound_wrappers',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('actual_target', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('client_id', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('client_key', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('groupinfo', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('outbound_wrapper', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('referrer', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('releaseinfo', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('seriesname', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('validated', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('released_on', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='nu_outbound_wrappers_pkey'),
    sa.UniqueConstraint('client_id', 'client_key', 'seriesname', 'releaseinfo', 'groupinfo', 'actual_target', name='nu_outbound_wrappers_client_id_client_key_seriesname_releas_key')
    )
    ### end Alembic commands ### 
Example #8
Source File: e44e075decdf_.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.drop_column('user', 'primary_blockchain_address')
    op.drop_column('user', 'is_public')
    op.add_column('transfer_account', sa.Column('balance', sa.BIGINT(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'transfer_account', type_='foreignkey')
    op.drop_column('transfer_account', 'is_public')
    op.drop_column('transfer_account', 'exchange_contract_id')
    op.drop_column('transfer_account', '_balance_wei')
    op.drop_column('email_whitelist', 'is_public')
    op.add_column('credit_transfer', sa.Column('transfer_amount', sa.INTEGER(), autoincrement=False, nullable=True))
    op.drop_column('credit_transfer', 'is_public')
    op.drop_column('credit_transfer', '_transfer_amount_wei')
    op.drop_column('blockchain_address', 'is_public')
    op.drop_table('exchange_contract_token_association_table')
    op.drop_index(op.f('ix_exchange_contract_contract_registry_blockchain_address'), table_name='exchange_contract')
    op.drop_index(op.f('ix_exchange_contract_blockchain_address'), table_name='exchange_contract')
    op.drop_table('exchange_contract')
    op.drop_table('exchange')
    # ### end Alembic commands ### 
Example #9
Source File: 8d0c21474c48_drop_enricher_log.py    From open-raadsinformatie with MIT License 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('enricher_log',
    sa.Column('id', sa.BIGINT(), autoincrement=True, nullable=False),
    sa.Column('resource_id', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('enricher_class', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('task', sa.VARCHAR(), autoincrement=False, nullable=False),
    sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['resource_id'], [u'resource.ori_id'], name=u'enricher_log_resource_id_fkey'),
    sa.PrimaryKeyConstraint('id', name=u'enricher_log_pkey')
    )
    op.create_index('ix_enricher_log_resource_id', 'enricher_log', ['resource_id'], unique=False)
    op.create_index('ix_enricher_log_id', 'enricher_log', ['id'], unique=False)
    # ### end Alembic commands ### 
Example #10
Source File: 00046_4f22490b9071_experimenting_with_versioning_modes.py    From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###

    op.add_column('web_pages_version', sa.Column('end_transaction_id', sa.BIGINT(), autoincrement=False, nullable=True))
    op.add_column('rss_parser_funcs_version', sa.Column('end_transaction_id', sa.BIGINT(), autoincrement=False, nullable=True))
    op.create_index('ix_rss_parser_funcs_version_end_transaction_id', 'rss_parser_funcs_version', ['end_transaction_id'], unique=False)
    op.add_column('rss_parser_feed_name_lut_version', sa.Column('end_transaction_id', sa.BIGINT(), autoincrement=False, nullable=True))
    op.create_index('ix_rss_parser_feed_name_lut_version_end_transaction_id', 'rss_parser_feed_name_lut_version', ['end_transaction_id'], unique=False)
    op.add_column('raw_web_pages_version', sa.Column('end_transaction_id', sa.BIGINT(), autoincrement=False, nullable=True))

    # ### end Alembic commands ### 
Example #11
Source File: 00034_3389071120cb_rss_foreign_key_bits.py    From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def upgrade():
	### commands auto generated by Alembic - please adjust! ###

	bind = op.get_bind()
	sess = Session(bind=bind)


	# create the teams table and the players.team_id column
	# RssFeedPost.__table__.create(bind)
	# RssFeedEntry.__table__.create(bind)

	name_map = sess.query(RssFeedEntry).all()
	name_map = {row.feed_name : row.id for row in name_map}

	feednames = sess.query(RssFeedPost.srcname).group_by(RssFeedPost.srcname).all()
	for feedname, in feednames:
		if not feedname in name_map:
			print(feedname)
		else:
			sess.query(RssFeedPost).filter(RssFeedPost.srcname == feedname).update({"feed_id" : name_map[feedname]})
			print("Updating for {} -> {}".format(feedname, name_map[feedname]))

	sess.commit()

	null_rows = sess.query(RssFeedPost.srcname).filter(RssFeedPost.feed_id == None).all()
	print(null_rows)

	op.alter_column('feed_pages', 'feed_id',
			   existing_type=sa.BIGINT(),
			   nullable=False)
	### end Alembic commands ### 
Example #12
Source File: 87d043d7917e_removed_various_guild_columns_that_.py    From Titan with GNU Affero General Public License v3.0 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('guilds', sa.Column('webhooks', sa.TEXT(), autoincrement=False, nullable=False))
    op.add_column('guilds', sa.Column('name', sa.VARCHAR(length=255), autoincrement=False, nullable=False))
    op.add_column('guilds', sa.Column('owner_id', sa.BIGINT(), autoincrement=False, nullable=False))
    op.add_column('guilds', sa.Column('icon', sa.VARCHAR(length=255), server_default=sa.text("''::character varying"), autoincrement=False, nullable=True))
    op.add_column('guilds', sa.Column('roles', sa.TEXT(), autoincrement=False, nullable=False))
    op.add_column('guilds', sa.Column('channels', sa.TEXT(), autoincrement=False, nullable=False))
    op.add_column('guilds', sa.Column('emojis', sa.TEXT(), autoincrement=False, nullable=False))
    # ### end Alembic commands ### 
Example #13
Source File: test_sequence.py    From sqlalchemy with MIT License 5 votes vote down vote up
def define_tables(cls, metadata):
        Table(
            "int_seq_t",
            metadata,
            Column("id", Integer, default=Sequence("int_seq")),
            Column("txt", String(50)),
        )

        Table(
            "bigint_seq_t",
            metadata,
            Column(
                "id",
                BIGINT,
                default=Sequence(
                    "bigint_seq", data_type=BIGINT, start=3000000000
                ),
            ),
            Column("txt", String(50)),
        )

        Table(
            "decimal_seq_t",
            metadata,
            Column(
                "id",
                DECIMAL(10, 0),
                default=Sequence(
                    "decimal_seq", data_type=DECIMAL(10, 0), start=3000000000,
                ),
            ),
            Column("txt", String(50)),
        ) 
Example #14
Source File: 2019_11_15_58d240646830_add_vote_reference_refactor_references.py    From ultimate-poll-bot with MIT License 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column("reference", "admin_user_id", new_column_name="admin_chat_id")
    op.add_column(
        "reference",
        sa.Column("admin_chat_id", sa.BIGINT(), autoincrement=False, nullable=True),
    )
    op.drop_constraint("vote_user", "reference", type_="foreignkey")
    op.drop_constraint("admin_user", "reference", type_="foreignkey")
    op.drop_index(op.f("ix_reference_vote_user_id"), table_name="reference")
    op.drop_index(op.f("ix_reference_admin_user_id"), table_name="reference")
    op.drop_column("reference", "vote_user_id")
    op.drop_column("reference", "vote_message_id")
    # ### end Alembic commands ### 
Example #15
Source File: 2020_05_05_b167b3275d8e_remove_votes_user_id_not_null_constraint.py    From ultimate-poll-bot with MIT License 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column("vote", "user_id", existing_type=sa.BIGINT(), nullable=False)
    # ### end Alembic commands ### 
Example #16
Source File: 2020_05_05_b167b3275d8e_remove_votes_user_id_not_null_constraint.py    From ultimate-poll-bot with MIT License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column("vote", "user_id", existing_type=sa.BIGINT(), nullable=True)
    # ### end Alembic commands ### 
Example #17
Source File: 8acbad111ef6_queue_table_for_pq.py    From pygameweb with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('queue',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('enqueued_at', postgresql.TIMESTAMP(timezone=True), server_default=sa.text('now()'), autoincrement=False, nullable=False),
    sa.Column('dequeued_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
    sa.Column('expected_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
    sa.Column('schedule_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
    sa.Column('q_name', sa.TEXT(), autoincrement=False, nullable=False),
    sa.Column('data', postgresql.JSON(astext_type=sa.Text()), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('priority_idx', 'queue', ['schedule_at', 'expected_at'], unique=False)
    # ### end Alembic commands ### 
Example #18
Source File: 00034_3389071120cb_rss_foreign_key_bits.py    From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def downgrade():
	### commands auto generated by Alembic - please adjust! ###
	op.alter_column('feed_pages', 'feed_id',
			   existing_type=sa.BIGINT(),
			   nullable=True)
	### end Alembic commands ### 
Example #19
Source File: 0192_drop_provider_statistics.py    From notifications-api with MIT License 5 votes vote down vote up
def downgrade():
    op.create_table('provider_statistics',
    sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('day', sa.DATE(), autoincrement=False, nullable=False),
    sa.Column('service_id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.Column('unit_count', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('provider_id', postgresql.UUID(), autoincrement=False, nullable=False),
    sa.ForeignKeyConstraint(['provider_id'], ['provider_details.id'], name='provider_stats_to_provider_fk'),
    sa.ForeignKeyConstraint(['service_id'], ['services.id'], name='provider_statistics_service_id_fkey'),
    sa.PrimaryKeyConstraint('id', name='provider_statistics_pkey')
    )
    op.create_index('ix_provider_statistics_service_id', 'provider_statistics', ['service_id'], unique=False)
    op.create_index('ix_provider_statistics_provider_id', 'provider_statistics', ['provider_id'], unique=False) 
Example #20
Source File: 4545f5c948b3_add_io_scratch_size_stats.py    From backend.ai-manager with GNU Lesser General Public License v3.0 5 votes vote down vote up
def downgrade():
    op.add_column('kernels', sa.Column('mem_cur_bytes', sa.BIGINT(), autoincrement=False, nullable=True))
    op.drop_column('kernels', 'io_max_scratch_size') 
Example #21
Source File: ace761cd04c1_.py    From SempoBlockchain with GNU General Public License v3.0 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('transfer_account', sa.Column('balance', sa.BIGINT(), autoincrement=False, nullable=True))
    # ### end Alembic commands ### 
Example #22
Source File: 0152_kill_service_free_fragments.py    From notifications-api with MIT License 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('services_history', sa.Column('free_sms_fragment_limit', sa.BIGINT(), autoincrement=False, nullable=True))
    op.add_column('services', sa.Column('free_sms_fragment_limit', sa.BIGINT(), autoincrement=False, nullable=True)) 
Example #23
Source File: test_parquet.py    From spectrify with MIT License 5 votes vote down vote up
def setUp(self):
        self.sa_meta = sa.MetaData()
        self.data = [
            [17.124, 1.12, 3.14, 13.37],
            [1, 2, 3, 4],
            [1, 2, 3, 4],
            [1, 2, 3, 4],
            [True, None, False, True],
            ['string 1', 'string 2', None, 'string 3'],
            [datetime(2007, 7, 13, 1, 23, 34, 123456),
             None,
             datetime(2006, 1, 13, 12, 34, 56, 432539),
             datetime(2010, 8, 13, 5, 46, 57, 437699), ],
            ["Test Text", "Some#More#Test#  Text", "!@#$%%^&*&", None],
        ]
        self.table = sa.Table(
            'unit_test_table',
            self.sa_meta,
            sa.Column('real_col', sa.REAL),
            sa.Column('bigint_col', sa.BIGINT),
            sa.Column('int_col', sa.INTEGER),
            sa.Column('smallint_col', sa.SMALLINT),
            sa.Column('bool_col', sa.BOOLEAN),
            sa.Column('str_col', sa.VARCHAR),
            sa.Column('timestamp_col', sa.TIMESTAMP),
            sa.Column('plaintext_col', sa.TEXT),
        )

        self.expected_datatypes = [
            pa.float32(),
            pa.int64(),
            pa.int32(),
            pa.int16(),
            pa.bool_(),
            pa.string(),
            pa.timestamp('ns'),
            pa.string(),
        ] 
Example #24
Source File: e932b738ea4a_.py    From SempoBlockchain with GNU General Public License v3.0 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('blockchain_task', sa.Column('amount', sa.BIGINT(), autoincrement=False, nullable=True))
    op.drop_column('blockchain_task', '_amount')
    # ### end Alembic commands ### 
Example #25
Source File: 5d327a0b562f_.py    From SempoBlockchain with GNU General Public License v3.0 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('blockchain_task', sa.Column('gasLimit', sa.BIGINT(), autoincrement=False, nullable=True))
    op.drop_column('blockchain_task', 'gas_limit')
    # ### end Alembic commands ### 
Example #26
Source File: b1d4118a005b_.py    From SempoBlockchain with GNU General Public License v3.0 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('blockchain_wallet', sa.Column('wei_topup_amount', sa.BIGINT(), autoincrement=False, nullable=True))
    op.drop_column('blockchain_wallet', 'wei_topup_target')
    # ### end Alembic commands ### 
Example #27
Source File: 2020_04_10_5a8b94fb9dd9_refactor_reference.py    From ultimate-poll-bot with MIT License 4 votes vote down vote up
def downgrade():
    op.add_column(
        "reference",
        sa.Column("admin_user_id", sa.BIGINT(), autoincrement=False, nullable=True),
    )
    op.add_column(
        "reference",
        sa.Column("admin_message_id", sa.BIGINT(), autoincrement=False, nullable=True),
    )
    op.create_foreign_key(
        "admin_user", "reference", "user", ["admin_user_id"], ["id"], ondelete="CASCADE"
    )
    op.create_index(
        "ix_reference_admin_user_id", "reference", ["admin_user_id"], unique=False
    )

    op.add_column(
        "reference",
        sa.Column("vote_user_id", sa.BIGINT(), autoincrement=False, nullable=True),
    )
    op.add_column(
        "reference",
        sa.Column("vote_message_id", sa.BIGINT(), autoincrement=False, nullable=True),
    )
    op.create_foreign_key(
        "vote_user", "reference", "user", ["vote_user_id"], ["id"], ondelete="CASCADE"
    )
    op.create_index(
        "ix_reference_vote_user_id", "reference", ["vote_user_id"], unique=False
    )

    op.execute(
        "UPDATE reference \
               SET admin_message_id=message_id, admin_user_id=user_id \
                  WHERE type = 'admin';"
    )

    op.execute(
        "UPDATE reference \
               SET vote_message_id=message_id, vote_user_id=user_id \
                  WHERE type='private_vote';"
    )

    op.drop_constraint("user_fk", "reference", type_="foreignkey")
    op.drop_index(op.f("ix_reference_user_id"), table_name="reference")

    op.alter_column(
        "reference", "bot_inline_message_id", new_column_name="inline_message_id",
    )

    op.drop_column("reference", "message_id")
    op.drop_column("reference", "message_dc_id")
    op.drop_column("reference", "message_access_hash")

    op.drop_column("reference", "user_id")
    op.drop_column("reference", "type")