Python alembic.op.create_index() Examples
The following are 30
code examples of alembic.op.create_index().
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
alembic.op
, or try the search function
.
Example #1
Source File: 0f3bc98edaa0_more_status.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 7 votes |
def upgrade(): agentstatus.create(op.get_bind()) kernelstatus.create(op.get_bind()) op.add_column('agents', sa.Column('lost_at', sa.DateTime(timezone=True), nullable=True)) op.add_column('agents', sa.Column('status', sa.Enum('ALIVE', 'LOST', 'RESTARTING', 'TERMINATED', name='agentstatus'), nullable=False)) op.create_index(op.f('ix_agents_status'), 'agents', ['status'], unique=False) op.add_column('kernels', sa.Column('agent_addr', sa.String(length=128), nullable=False)) op.add_column('kernels', sa.Column('cpu_slot', sa.Integer(), nullable=False)) op.add_column('kernels', sa.Column('gpu_slot', sa.Integer(), nullable=False)) op.add_column('kernels', sa.Column('mem_slot', sa.Integer(), nullable=False)) op.add_column('kernels', sa.Column('repl_in_port', sa.Integer(), nullable=False)) op.add_column('kernels', sa.Column('repl_out_port', sa.Integer(), nullable=False)) op.add_column('kernels', sa.Column('stdin_port', sa.Integer(), nullable=False)) op.add_column('kernels', sa.Column('stdout_port', sa.Integer(), nullable=False)) op.drop_column('kernels', 'allocated_cores') op.add_column('kernels', sa.Column('cpu_set', sa.ARRAY(sa.Integer), nullable=True)) op.add_column('kernels', sa.Column('gpu_set', sa.ARRAY(sa.Integer), nullable=True)) op.alter_column('kernels', column_name='status', type_=sa.Enum(*kernelstatus_choices, name='kernelstatus'), postgresql_using='status::kernelstatus')
Example #2
Source File: 3ebfbaeb76c0_.py From app with MIT License | 6 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('email_change', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False), sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True), sa.Column('user_id', sa.Integer(), nullable=False), sa.Column('new_email', sa.String(length=128), nullable=False), sa.Column('code', sa.String(length=128), nullable=False), sa.Column('expired', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False), sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='cascade'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('code'), sa.UniqueConstraint('new_email') ) op.create_index(op.f('ix_email_change_user_id'), 'email_change', ['user_id'], unique=True) # ### end Alembic commands ###
Example #3
Source File: 00007_cb674b790e4a_more_nu_stuff.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 6 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('nu_outbound_wrappers', sa.Column('actual_target', sa.Text(), nullable=True)) op.add_column('nu_outbound_wrappers', sa.Column('client_id', sa.Text(), nullable=True)) op.add_column('nu_outbound_wrappers', sa.Column('client_key', sa.Text(), nullable=True)) op.add_column('nu_outbound_wrappers', sa.Column('groupinfo', sa.Text(), nullable=True)) op.add_column('nu_outbound_wrappers', sa.Column('outbound_wrapper', sa.Text(), nullable=True)) op.add_column('nu_outbound_wrappers', sa.Column('referrer', sa.Text(), nullable=True)) op.add_column('nu_outbound_wrappers', sa.Column('releaseinfo', sa.Text(), nullable=True)) op.add_column('nu_outbound_wrappers', sa.Column('seriesname', sa.Text(), nullable=True)) op.create_index(op.f('ix_nu_outbound_wrappers_client_id'), 'nu_outbound_wrappers', ['client_id'], unique=False) op.create_index(op.f('ix_nu_outbound_wrappers_client_key'), 'nu_outbound_wrappers', ['client_key'], unique=False) op.create_index(op.f('ix_nu_outbound_wrappers_groupinfo'), 'nu_outbound_wrappers', ['groupinfo'], unique=False) op.create_index(op.f('ix_nu_outbound_wrappers_seriesname'), 'nu_outbound_wrappers', ['seriesname'], unique=False) op.drop_index('ix_nu_outbound_wrappers_container_page', table_name='nu_outbound_wrappers') op.drop_index('ix_nu_outbound_wrappers_link_url', table_name='nu_outbound_wrappers') op.drop_column('nu_outbound_wrappers', 'container_page') op.drop_column('nu_outbound_wrappers', 'link_url') op.drop_column('nu_outbound_wrappers', 'target_url') ### end Alembic commands ###
Example #4
Source File: 00007_cb674b790e4a_more_nu_stuff.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 6 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('nu_outbound_wrappers', sa.Column('target_url', sa.TEXT(), autoincrement=False, nullable=True)) op.add_column('nu_outbound_wrappers', sa.Column('link_url', sa.TEXT(), autoincrement=False, nullable=True)) op.add_column('nu_outbound_wrappers', sa.Column('container_page', sa.TEXT(), autoincrement=False, nullable=True)) op.create_index('ix_nu_outbound_wrappers_link_url', 'nu_outbound_wrappers', ['link_url'], unique=False) op.create_index('ix_nu_outbound_wrappers_container_page', 'nu_outbound_wrappers', ['container_page'], unique=False) op.drop_index(op.f('ix_nu_outbound_wrappers_seriesname'), table_name='nu_outbound_wrappers') op.drop_index(op.f('ix_nu_outbound_wrappers_groupinfo'), table_name='nu_outbound_wrappers') op.drop_index(op.f('ix_nu_outbound_wrappers_client_key'), table_name='nu_outbound_wrappers') op.drop_index(op.f('ix_nu_outbound_wrappers_client_id'), table_name='nu_outbound_wrappers') op.drop_column('nu_outbound_wrappers', 'seriesname') op.drop_column('nu_outbound_wrappers', 'releaseinfo') op.drop_column('nu_outbound_wrappers', 'referrer') op.drop_column('nu_outbound_wrappers', 'outbound_wrapper') op.drop_column('nu_outbound_wrappers', 'groupinfo') op.drop_column('nu_outbound_wrappers', 'client_key') op.drop_column('nu_outbound_wrappers', 'client_id') op.drop_column('nu_outbound_wrappers', 'actual_target') ### end Alembic commands ###
Example #5
Source File: 20bcb4b2673c_.py From gitlab-tools with GNU General Public License v3.0 | 6 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('task_result', sa.Column('updated', sa.DateTime(), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('id', sa.Integer(), nullable=False), sa.Column('pull_mirror_id', sa.Integer(), nullable=True), sa.Column('push_mirror_id', sa.Integer(), nullable=True), sa.Column('task_id', sa.String(length=155), nullable=True), sa.Column('status', sa.String(length=50), nullable=True), sa.Column('task_name', sa.String(length=255), nullable=True), sa.Column('invoked_by', sa.Integer(), nullable=True), sa.Column('result', sa.PickleType(), nullable=True), sa.Column('date_done', sa.DateTime(), nullable=True), sa.Column('traceback', sa.Text(), nullable=True), sa.ForeignKeyConstraint(['pull_mirror_id'], ['pull_mirror.id'], ), sa.ForeignKeyConstraint(['push_mirror_id'], ['push_mirror.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('task_id') ) op.create_index(op.f('ix_task_result_pull_mirror_id'), 'task_result', ['pull_mirror_id'], unique=False) op.create_index(op.f('ix_task_result_push_mirror_id'), 'task_result', ['push_mirror_id'], unique=False) # ### end Alembic commands ###
Example #6
Source File: 1083bb6545c9_.py From website with MIT License | 6 votes |
def upgrade(): op.create_table( "project_memberships", sa.Column("id", sa.Integer(), nullable=False), sa.Column("user_id", sa.Integer(), nullable=True), sa.Column("project_id", sa.Integer(), nullable=True), sa.Column("date_joined", sa.DateTime(), nullable=True), sa.Column("is_lead", sa.Boolean(), nullable=False), sa.ForeignKeyConstraint(["project_id"], ["projects.id"]), sa.ForeignKeyConstraint(["user_id"], ["users.id"]), sa.PrimaryKeyConstraint("id"), ) op.create_index( op.f("ix_project_memberships_is_lead"), "project_memberships", ["is_lead"], unique=False, ) op.drop_table("project_members")
Example #7
Source File: 00027_c92e0c8632d7_more_rss_stuff.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 6 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('rss_parser_feed_name_lut', sa.Column('feed_id', sa.BigInteger(), nullable=False)) op.create_index(op.f('ix_rss_parser_feed_name_lut_feed_id'), 'rss_parser_feed_name_lut', ['feed_id'], unique=False) op.drop_index('ix_rss_parser_feed_name_lut_feed_name', table_name='rss_parser_feed_name_lut') op.drop_constraint('rss_parser_feed_name_lut_feed_netloc_feed_name_key', 'rss_parser_feed_name_lut', type_='unique') op.create_unique_constraint(None, 'rss_parser_feed_name_lut', ['feed_netloc', 'feed_id']) op.drop_constraint('rss_parser_feed_name_lut_feed_name_fkey', 'rss_parser_feed_name_lut', type_='foreignkey') op.create_foreign_key(None, 'rss_parser_feed_name_lut', 'rss_parser_funcs', ['feed_id'], ['id']) op.drop_column('rss_parser_feed_name_lut', 'feed_name') op.add_column('rss_parser_feed_name_lut_version', sa.Column('feed_id', sa.BigInteger(), autoincrement=False, nullable=True)) op.create_index(op.f('ix_rss_parser_feed_name_lut_version_feed_id'), 'rss_parser_feed_name_lut_version', ['feed_id'], unique=False) op.drop_index('ix_rss_parser_feed_name_lut_version_feed_name', table_name='rss_parser_feed_name_lut_version') op.drop_column('rss_parser_feed_name_lut_version', 'feed_name') op.alter_column('rss_parser_funcs', 'func', existing_type=sa.TEXT(), nullable=True) ### end Alembic commands ###
Example #8
Source File: 00027_c92e0c8632d7_more_rss_stuff.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 6 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.alter_column('rss_parser_funcs', 'func', existing_type=sa.TEXT(), nullable=False) op.add_column('rss_parser_feed_name_lut_version', sa.Column('feed_name', sa.TEXT(), autoincrement=False, nullable=True)) op.create_index('ix_rss_parser_feed_name_lut_version_feed_name', 'rss_parser_feed_name_lut_version', ['feed_name'], unique=False) op.drop_index(op.f('ix_rss_parser_feed_name_lut_version_feed_id'), table_name='rss_parser_feed_name_lut_version') op.drop_column('rss_parser_feed_name_lut_version', 'feed_id') op.add_column('rss_parser_feed_name_lut', sa.Column('feed_name', sa.TEXT(), autoincrement=False, nullable=False)) op.drop_constraint(None, 'rss_parser_feed_name_lut', type_='foreignkey') op.create_foreign_key('rss_parser_feed_name_lut_feed_name_fkey', 'rss_parser_feed_name_lut', 'rss_parser_funcs', ['feed_name'], ['feed_name']) op.drop_constraint(None, 'rss_parser_feed_name_lut', type_='unique') op.create_unique_constraint('rss_parser_feed_name_lut_feed_netloc_feed_name_key', 'rss_parser_feed_name_lut', ['feed_netloc', 'feed_name']) op.create_index('ix_rss_parser_feed_name_lut_feed_name', 'rss_parser_feed_name_lut', ['feed_name'], unique=False) op.drop_index(op.f('ix_rss_parser_feed_name_lut_feed_id'), table_name='rss_parser_feed_name_lut') op.drop_column('rss_parser_feed_name_lut', 'feed_id') ### end Alembic commands ###
Example #9
Source File: 513164749de4_add_cancelled_to_kernelstatus.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 6 votes |
def upgrade(): conn = op.get_bind() conn.execute('DROP INDEX IF EXISTS ix_kernels_unique_sess_token;') conn.execute('ALTER TYPE kernelstatus RENAME TO kernelstatus_old;') kernelstatus_new.create(conn) conn.execute(textwrap.dedent('''\ ALTER TABLE kernels ALTER COLUMN "status" DROP DEFAULT, ALTER COLUMN "status" TYPE kernelstatus USING "status"::text::kernelstatus, ALTER COLUMN "status" SET DEFAULT 'PENDING'::kernelstatus; DROP TYPE kernelstatus_old; ''')) op.create_index( 'ix_kernels_unique_sess_token', 'kernels', ['access_key', 'sess_id'], unique=True, postgresql_where=sa.text( "status NOT IN ('TERMINATED', 'CANCELLED') and role = 'master'" ))
Example #10
Source File: 513164749de4_add_cancelled_to_kernelstatus.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 6 votes |
def downgrade(): op.drop_index('ix_kernels_unique_sess_token', table_name='kernels') conn = op.get_bind() conn.execute('ALTER TYPE kernelstatus RENAME TO kernelstatus_new;') kernelstatus_old.create(conn) conn.execute(textwrap.dedent('''\ ALTER TABLE kernels ALTER COLUMN "status" DROP DEFAULT, ALTER COLUMN "status" TYPE kernelstatus USING ( CASE "status"::text WHEN 'CANCELLED' THEN 'TERMINATED' ELSE "status"::text END )::kernelstatus, ALTER COLUMN "status" SET DEFAULT 'PREPARING'::kernelstatus; DROP TYPE kernelstatus_new; ''')) op.create_index( 'ix_kernels_unique_sess_token', 'kernels', ['access_key', 'sess_id'], unique=True, postgresql_where=sa.text( "status != 'TERMINATED' and role = 'master'" ))
Example #11
Source File: 2020_052419_f680032cc361_.py From app with MIT License | 6 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('fido', sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), sa.Column('created_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=False), sa.Column('updated_at', sqlalchemy_utils.types.arrow.ArrowType(), nullable=True), sa.Column('credential_id', sa.String(), nullable=False), sa.Column('uuid', sa.String(), nullable=False), sa.Column('public_key', sa.String(), nullable=False), sa.Column('sign_count', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=128), nullable=False), sa.ForeignKeyConstraint(['uuid'], ['users.fido_uuid'], ondelete='cascade'), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('public_key') ) op.create_index(op.f('ix_fido_credential_id'), 'fido', ['credential_id'], unique=True) op.drop_constraint('users_fido_credential_id_key', 'users', type_='unique') op.drop_constraint('users_fido_pk_key', 'users', type_='unique') op.drop_column('users', 'fido_sign_count') op.drop_column('users', 'fido_pk') op.drop_column('users', 'fido_credential_id') # ### end Alembic commands ###
Example #12
Source File: 854bd902b1bc_change_kernel_identification.py From backend.ai-manager with GNU Lesser General Public License v3.0 | 6 votes |
def upgrade(): op.drop_constraint('fk_vfolder_attachment_vfolder_vfolders', 'vfolder_attachment', type_='foreignkey') op.drop_constraint('fk_vfolder_attachment_kernel_kernels', 'vfolder_attachment', type_='foreignkey') op.drop_constraint('pk_kernels', 'kernels', type_='primary') op.add_column('kernels', sa.Column('id', GUID(), server_default=sa.text('uuid_generate_v4()'), nullable=False)) op.add_column('kernels', sa.Column('role', sa.String(length=16), nullable=False, default='master')) op.create_primary_key('pk_kernels', 'kernels', ['id']) op.alter_column( 'kernels', 'sess_id', existing_type=postgresql.UUID(), type_=sa.String(length=64), nullable=True, existing_server_default=sa.text('uuid_generate_v4()')) op.create_index(op.f('ix_kernels_sess_id'), 'kernels', ['sess_id'], unique=False) op.create_index(op.f('ix_kernels_sess_id_role'), 'kernels', ['sess_id', 'role'], unique=False) op.create_foreign_key('fk_vfolder_attachment_vfolder_vfolders', 'vfolder_attachment', 'vfolders', ['vfolder'], ['id'], onupdate='CASCADE', ondelete='CASCADE') op.create_foreign_key('fk_vfolder_attachment_kernel_kernels', 'vfolder_attachment', 'kernels', ['kernel'], ['id'], onupdate='CASCADE', ondelete='CASCADE')
Example #13
Source File: d7b89a614ae9_.py From SempoBlockchain with GNU General Public License v3.0 | 6 votes |
def upgrade(): blockchain_status = postgresql.ENUM('PENDING', 'SUCCESS', 'FAILED', name='blockchainstatus') blockchain_status.create(op.get_bind()) op.create_table('worker_messages', sa.Column('id', sa.Integer(), nullable=False), sa.Column('authorising_user_id', sa.Integer(), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('updated', sa.DateTime(), nullable=True), sa.Column('message', sa.String(), nullable=True), sa.Column('error', sa.String(), nullable=True), sa.Column('worker_timestamp', sa.DateTime(), nullable=True), sa.Column('blockchain_task_uuid', sa.String(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.add_column('credit_transfer', sa.Column('blockchain_hash', sa.String(), nullable=True)) op.add_column('credit_transfer', sa.Column('blockchain_status', sa.Enum('PENDING', 'SUCCESS', 'FAILED', name='blockchainstatus'), nullable=True)) op.add_column('credit_transfer', sa.Column('last_worker_update', sa.DateTime(), nullable=True)) op.add_column('exchange', sa.Column('blockchain_hash', sa.String(), nullable=True)) op.add_column('exchange', sa.Column('blockchain_status', sa.Enum('PENDING', 'SUCCESS', 'FAILED', name='blockchainstatus'), nullable=True)) op.add_column('exchange', sa.Column('last_worker_update', sa.DateTime(), nullable=True)) op.create_index(op.f('ix_worker_messages_table_blockchain_task_uuid'), 'worker_messages', ['blockchain_task_uuid'], unique=False)
Example #14
Source File: 334ff08dacf9_.py From SempoBlockchain with GNU General Public License v3.0 | 5 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_index('ix_blockchain_address_address', 'blockchain_wallet', ['address'], unique=True) op.drop_index(op.f('ix_blockchain_wallet_address'), table_name='blockchain_wallet') op.drop_column('blockchain_wallet', 'last_topup_task_id') # ### end Alembic commands ###
Example #15
Source File: 00013_d37cc90c5586_cookie_database_system_stuff.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('web_cookie_db', sa.Column('id', sa.Integer(), nullable=False), sa.Column('age', sa.DateTime(), nullable=True), sa.Column('ua_user_agent', sa.Text(), nullable=True), sa.Column('ua_accept_language', sa.Text(), nullable=True), sa.Column('ua_accept', sa.Text(), nullable=True), sa.Column('ua_accept_encoding', sa.Text(), nullable=True), sa.Column('c_version', sa.Integer(), nullable=True), sa.Column('c_name', sa.Text(), nullable=True), sa.Column('c_value', sa.Text(), nullable=True), sa.Column('c_port', sa.Integer(), nullable=True), sa.Column('c_port_specified', sa.Boolean(), nullable=True), sa.Column('c_domain', sa.Text(), nullable=True), sa.Column('c_domain_specified', sa.Boolean(), nullable=True), sa.Column('c_domain_initial_dot', sa.Boolean(), nullable=True), sa.Column('c_path', sa.Text(), nullable=True), sa.Column('c_path_specified', sa.Boolean(), nullable=True), sa.Column('c_secure', sa.Boolean(), nullable=True), sa.Column('c_expires', sa.Integer(), nullable=True), sa.Column('c_discard', sa.Boolean(), nullable=True), sa.Column('c_comment', sa.Text(), nullable=True), sa.Column('c_comment_url', sa.Text(), nullable=True), sa.Column('c_rest', sa.Text(), nullable=True), sa.Column('c_rfc2109', sa.Boolean(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('ua_user_agent', 'ua_accept_language', 'ua_accept', 'ua_accept_encoding', 'c_version', 'c_name', 'c_value', 'c_port', 'c_port_specified', 'c_domain', 'c_domain_specified', 'c_domain_initial_dot', 'c_path', 'c_path_specified', 'c_secure', 'c_expires', 'c_discard', 'c_comment', 'c_comment_url', 'c_rest', 'c_rfc2109') ) op.create_index(op.f('ix_web_cookie_db_id'), 'web_cookie_db', ['id'], unique=False) op.create_index('ua_user_agent', 'web_cookie_db', ['ua_accept_language', 'ua_accept', 'ua_accept_encoding'], unique=False) ### end Alembic commands ###
Example #16
Source File: 00018_8ae5aae58f62_.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('nu_release_item', sa.Column('id', sa.BigInteger(), nullable=False), sa.Column('validated', sa.Boolean(), nullable=False), sa.Column('actual_target', sa.Text(), nullable=True), sa.Column('seriesname', sa.Text(), nullable=False), sa.Column('releaseinfo', sa.Text(), nullable=True), sa.Column('groupinfo', sa.Text(), nullable=False), sa.Column('referrer', sa.Text(), nullable=False), sa.Column('outbound_wrapper', sa.Text(), nullable=False), sa.Column('first_seen', sa.DateTime(), nullable=False), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('seriesname', 'releaseinfo', 'groupinfo', 'outbound_wrapper', 'actual_target') ) op.create_index(op.f('ix_nu_release_item_groupinfo'), 'nu_release_item', ['groupinfo'], unique=False) op.create_index(op.f('ix_nu_release_item_seriesname'), 'nu_release_item', ['seriesname'], unique=False) op.create_table('nu_resolved_outbound', sa.Column('id', sa.BigInteger(), nullable=False), sa.Column('parent', sa.BigInteger(), nullable=False), sa.Column('client_id', sa.Text(), nullable=False), sa.Column('client_key', sa.Text(), nullable=False), sa.Column('actual_target', sa.Text(), nullable=False), sa.Column('fetched_on', sa.DateTime(), nullable=False), sa.ForeignKeyConstraint(['parent'], ['nu_release_item.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('client_id', 'client_key', 'actual_target') ) op.create_index(op.f('ix_nu_resolved_outbound_client_id'), 'nu_resolved_outbound', ['client_id'], unique=False) op.create_index(op.f('ix_nu_resolved_outbound_client_key'), 'nu_resolved_outbound', ['client_key'], unique=False) op.create_index(op.f('ix_nu_resolved_outbound_parent'), 'nu_resolved_outbound', ['parent'], unique=False) ### end Alembic commands ###
Example #17
Source File: b72321d58252_.py From website with MIT License | 5 votes |
def upgrade(): op.add_column( "project_uploads", sa.Column("notified_at", sa.DateTime(), nullable=True) ) op.add_column("project_uploads", sa.Column("ordering", sa.Integer(), nullable=True)) op.create_index( op.f("ix_project_uploads_notified_at"), "project_uploads", ["notified_at"], unique=False, )
Example #18
Source File: cfb0ed4cced9_new_accounts_table.py From cloud-inquisitor with Apache License 2.0 | 5 votes |
def create_new_tables(): op.create_table('account_types', sa.Column('account_type_id', mysql.INTEGER(unsigned=True), nullable=False, autoincrement=True), sa.Column('account_type', sa.String(length=100), nullable=False), sa.PrimaryKeyConstraint('account_type_id') ) op.create_index(op.f('ix_account_types_account_type'), 'account_types', ['account_type'], unique=True) op.create_table('accounts_new', sa.Column('account_id', mysql.INTEGER(unsigned=True), nullable=False), sa.Column('account_name', sa.String(length=256), nullable=False), sa.Column('account_type_id', mysql.INTEGER(unsigned=True), nullable=False), sa.Column('contacts', mysql.JSON(), nullable=False), sa.Column('enabled', mysql.SMALLINT(unsigned=True), nullable=False), sa.Column('required_roles', mysql.JSON(), nullable=True), sa.ForeignKeyConstraint( ('account_type_id',), ['account_types.account_type_id'], name='fk_account_account_type_id', ondelete='CASCADE' ), sa.PrimaryKeyConstraint('account_id') ) op.create_index(op.f('ix_accounts_new_account_name'), 'accounts_new', ['account_name'], unique=True) op.create_index(op.f('ix_accounts_new_account_type_id'), 'accounts_new', ['account_type_id'], unique=False) op.create_table('account_properties', sa.Column('property_id', mysql.INTEGER(unsigned=True), nullable=False, autoincrement=True), sa.Column('account_id', mysql.INTEGER(unsigned=True), nullable=False), sa.Column('name', sa.String(length=50), nullable=False), sa.Column('value', mysql.JSON(), nullable=False), sa.ForeignKeyConstraint( ('account_id',), ['accounts_new.account_id'], name='fk_account_properties_account_id', ondelete='CASCADE' ), sa.PrimaryKeyConstraint('property_id', 'account_id') ) op.create_index(op.f('ix_account_properties_account_id'), 'account_properties', ['account_id'], unique=False) op.create_index(op.f('ix_account_properties_name'), 'account_properties', ['name'], unique=False)
Example #19
Source File: d3b2cffb2b9c_.py From website with MIT License | 5 votes |
def upgrade(): op.drop_index( "release_username_password_is_active_idx", table_name="project_credentials" ) op.alter_column("project_credentials", "password", new_column_name="key") op.create_index( "release_key_is_active_idx", "project_credentials", ["key", "is_active"], unique=False, ) op.drop_column("project_credentials", "username")
Example #20
Source File: 334ff08dacf9_.py From SempoBlockchain with GNU General Public License v3.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('blockchain_wallet', sa.Column('last_topup_task_id', sa.Integer(), nullable=True)) op.create_index(op.f('ix_blockchain_wallet_address'), 'blockchain_wallet', ['address'], unique=True) op.drop_index('ix_blockchain_address_address', table_name='blockchain_wallet') # ### end Alembic commands ###
Example #21
Source File: 5f4b4c9f586d_.py From SempoBlockchain with GNU General Public License v3.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('ussd_menu', sa.Column('id', sa.Integer(), nullable=False), sa.Column('authorising_user_id', sa.Integer(), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('updated', sa.DateTime(), nullable=True), sa.Column('name', sa.String(), nullable=False), sa.Column('description', sa.String(), nullable=True), sa.Column('parent_id', sa.Integer(), nullable=True), sa.Column('display_key', sa.String(), nullable=False), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_ussd_menu_name'), 'ussd_menu', ['name'], unique=True) op.create_table('ussd_session', sa.Column('id', sa.Integer(), nullable=False), sa.Column('authorising_user_id', sa.Integer(), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('updated', sa.DateTime(), nullable=True), sa.Column('session_id', sa.String(), nullable=False), sa.Column('service_code', sa.String(), nullable=False), sa.Column('msisdn', sa.String(), nullable=False), sa.Column('user_input', sa.String(), nullable=True), sa.Column('state', sa.String(), nullable=False), sa.Column('session_data', postgresql.JSON(astext_type=sa.Text()), nullable=True), sa.Column('ussd_menu_id', sa.Integer(), nullable=False), sa.Column('user_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ), sa.ForeignKeyConstraint(['ussd_menu_id'], ['ussd_menu.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_ussd_session_session_id'), 'ussd_session', ['session_id'], unique=True) op.drop_index('ix_ussd_sessions_session_id', table_name='ussd_sessions') op.drop_table('ussd_sessions') op.drop_index('ix_ussd_menus_name', table_name='ussd_menus') op.drop_table('ussd_menus') # ### end Alembic commands ###
Example #22
Source File: 00006_52ecc22110c4_.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_index('web_pages_state_netloc_idx', 'web_pages', ['state', 'netloc'], unique=False) op.drop_index(op.f('ix_nu_outbound_wrappers_link_url'), table_name='nu_outbound_wrappers') op.drop_index(op.f('ix_nu_outbound_wrappers_container_page'), table_name='nu_outbound_wrappers') op.drop_table('nu_outbound_wrappers') ### end Alembic commands ###
Example #23
Source File: 00043_b21ea54b22a2_adding_table_for_tracking_when_.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('version_checked_table', sa.Column('url', sa.Text(), nullable=False), sa.Column('checked', sa.DateTime(), nullable=True), sa.PrimaryKeyConstraint('url') ) op.create_index(op.f('ix_version_checked_table_checked'), 'version_checked_table', ['checked'], unique=False) op.create_index(op.f('ix_version_checked_table_url'), 'version_checked_table', ['url'], unique=True) # ### end Alembic commands ###
Example #24
Source File: 00023_1b4006c4f120_more_validation.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('nu_release_item', sa.Column('reviewed', sa.Boolean(), nullable=False, server_default=literal(False))) op.create_index(op.f('ix_nu_release_item_reviewed'), 'nu_release_item', ['reviewed'], unique=False) op.create_index(op.f('ix_nu_release_item_validated'), 'nu_release_item', ['validated'], unique=False) op.create_index(op.f('ix_nu_release_item_validated_on'), 'nu_release_item', ['validated_on'], unique=False) ### end Alembic commands ###
Example #25
Source File: 00017_26a8e4006aea_.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_index('web_pages_file', 'web_pages', ['file'], unique=False) op.create_index('nu_outbound_wrappers_released_on_idx', 'nu_outbound_wrappers', ['released_on'], unique=False) op.drop_index(op.f('ix_nu_outbound_wrappers_released_on'), table_name='nu_outbound_wrappers') op.drop_index(op.f('ix_feed_pages_type'), table_name='feed_pages') op.drop_index(op.f('ix_feed_pages_feedurl'), table_name='feed_pages') op.drop_index(op.f('ix_feed_pages_contenturl'), table_name='feed_pages') ### end Alembic commands ###
Example #26
Source File: 00017_26a8e4006aea_.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_index(op.f('ix_feed_pages_contenturl'), 'feed_pages', ['contenturl'], unique=False) op.create_index(op.f('ix_feed_pages_feedurl'), 'feed_pages', ['feedurl'], unique=False) op.create_index(op.f('ix_feed_pages_type'), 'feed_pages', ['type'], unique=False) op.create_index(op.f('ix_nu_outbound_wrappers_released_on'), 'nu_outbound_wrappers', ['released_on'], unique=False) op.drop_index('nu_outbound_wrappers_released_on_idx', table_name='nu_outbound_wrappers') op.drop_index('web_pages_file', table_name='web_pages') ### end Alembic commands ###
Example #27
Source File: 00033_53fab90468f4_.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('feed_post_meta', sa.Column('id', sa.BigInteger(), nullable=False), sa.Column('contentid', sa.Text(), nullable=False), sa.Column('meta', JSON(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_feed_post_meta_contentid'), 'feed_post_meta', ['contentid'], unique=True) ### end Alembic commands ###
Example #28
Source File: 2020-01-20_669e9df34ea7_add_new_netloc_tracking_table.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('seen_netloc_tracker', sa.Column('id', sa.BigInteger(), nullable=False), sa.Column('netloc', citext.CIText(), nullable=False), sa.Column('ignore', sa.Boolean(), nullable=True), sa.Column('have', sa.Boolean(), nullable=True), sa.Column('extra', postgresql.JSONB(astext_type=sa.Text()), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_seen_netloc_tracker_netloc'), 'seen_netloc_tracker', ['netloc'], unique=True) # ### end Alembic commands ###
Example #29
Source File: 00028_9d03d8bba40e_moarrrrrrrrrrr_rss_stuff.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('feed_pages', sa.Column('feed_id', sa.BigInteger())) op.create_index(op.f('ix_feed_pages_feed_id'), 'feed_pages', ['feed_id'], unique=False) op.create_foreign_key(None, 'feed_pages', 'rss_parser_funcs', ['feed_id'], ['id']) ### end Alembic commands ###
Example #30
Source File: 00046_4f22490b9071_experimenting_with_versioning_modes.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 5 votes |
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 ###