当前位置: 首页>>代码示例>>Python>>正文


Python op.create_index方法代码示例

本文整理汇总了Python中alembic.op.create_index方法的典型用法代码示例。如果您正苦于以下问题:Python op.create_index方法的具体用法?Python op.create_index怎么用?Python op.create_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在alembic.op的用法示例。


在下文中一共展示了op.create_index方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('fingerprint',
    sa.Column('updated', sa.DateTime(), nullable=True),
    sa.Column('created', sa.DateTime(), nullable=True),
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('hostname', sa.String(length=255), nullable=True),
    sa.Column('sha256_fingerprint', sa.String(length=255), nullable=True),
    sa.Column('hashed_hostname', sa.String(length=255), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('user_id', 'hashed_hostname', name='_user_id_hashed_hostname_uc')
    )
    op.create_index(op.f('ix_fingerprint_hashed_hostname'), 'fingerprint', ['hashed_hostname'], unique=False)
    op.create_index(op.f('ix_fingerprint_user_id'), 'fingerprint', ['user_id'], unique=False)
    # ### end Alembic commands ### 
开发者ID:Salamek,项目名称:gitlab-tools,代码行数:19,代码来源:56189bfb2c5f_.py

示例2: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
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 ### 
开发者ID:Salamek,项目名称:gitlab-tools,代码行数:25,代码来源:20bcb4b2673c_.py

示例3: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
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 ### 
开发者ID:simple-login,项目名称:app,代码行数:19,代码来源:3ebfbaeb76c0_.py

示例4: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
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 ### 
开发者ID:simple-login,项目名称:app,代码行数:24,代码来源:2020_052419_f680032cc361_.py

示例5: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
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') 
开发者ID:lablup,项目名称:backend.ai-manager,代码行数:26,代码来源:854bd902b1bc_change_kernel_identification.py

示例6: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
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') 
开发者ID:lablup,项目名称:backend.ai-manager,代码行数:21,代码来源:0f3bc98edaa0_more_status.py

示例7: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
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'"
        )) 
开发者ID:lablup,项目名称:backend.ai-manager,代码行数:19,代码来源:513164749de4_add_cancelled_to_kernelstatus.py

示例8: downgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
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'"
        )) 
开发者ID:lablup,项目名称:backend.ai-manager,代码行数:24,代码来源:513164749de4_add_cancelled_to_kernelstatus.py

示例9: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
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 ### 
开发者ID:fake-name,项目名称:ReadableWebProxy,代码行数:22,代码来源:00007_cb674b790e4a_more_nu_stuff.py

示例10: downgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
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 ### 
开发者ID:fake-name,项目名称:ReadableWebProxy,代码行数:22,代码来源:00007_cb674b790e4a_more_nu_stuff.py

示例11: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
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 ### 
开发者ID:fake-name,项目名称:ReadableWebProxy,代码行数:20,代码来源:00027_c92e0c8632d7_more_rss_stuff.py

示例12: downgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
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 ### 
开发者ID:fake-name,项目名称:ReadableWebProxy,代码行数:20,代码来源:00027_c92e0c8632d7_more_rss_stuff.py

示例13: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
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) 
开发者ID:teamsempo,项目名称:SempoBlockchain,代码行数:24,代码来源:d7b89a614ae9_.py

示例14: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
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") 
开发者ID:jazzband-roadies,项目名称:website,代码行数:21,代码来源:1083bb6545c9_.py

示例15: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import create_index [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_index('idx_token', 'calendar_tokens', ['token'], unique=True)
    # ### end Alembic commands ### 
开发者ID:everyclass,项目名称:everyclass-server,代码行数:6,代码来源:0883574300ef_add_calendar_token_index.py


注:本文中的alembic.op.create_index方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。