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


Python op.f方法代码示例

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


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

示例1: downgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(op.f('fk_kernels_scaling_group_scaling_groups'), 'kernels', type_='foreignkey')
    op.drop_index(op.f('ix_kernels_scaling_group'), table_name='kernels')
    op.drop_column('kernels', 'scaling_group')
    op.drop_constraint(op.f('fk_agents_scaling_group_scaling_groups'), 'agents', type_='foreignkey')
    op.drop_index(op.f('ix_agents_scaling_group'), table_name='agents')
    op.drop_column('agents', 'scaling_group')
    op.drop_index(op.f('ix_sgroups_for_keypairs_scaling_group'), table_name='sgroups_for_keypairs')
    op.drop_index(op.f('ix_sgroups_for_keypairs_access_key'), table_name='sgroups_for_keypairs')
    op.drop_table('sgroups_for_keypairs')
    op.drop_index(op.f('ix_sgroups_for_groups_scaling_group'), table_name='sgroups_for_groups')
    op.drop_index(op.f('ix_sgroups_for_groups_group'), table_name='sgroups_for_groups')
    op.drop_table('sgroups_for_groups')
    op.drop_index(op.f('ix_sgroups_for_domains_scaling_group'), table_name='sgroups_for_domains')
    op.drop_index(op.f('ix_sgroups_for_domains_domain'), table_name='sgroups_for_domains')
    op.drop_table('sgroups_for_domains')
    op.drop_index(op.f('ix_scaling_groups_is_active'), table_name='scaling_groups')
    op.drop_table('scaling_groups')
    # ### end Alembic commands ### 
开发者ID:lablup,项目名称:backend.ai-manager,代码行数:22,代码来源:9a91532c8534_add_scaling_group.py

示例2: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [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

示例3: downgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def downgrade():
    op.create_table(
        "project_members",
        sa.Column("user_id", sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column("project_id", sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column(
            "date_joined", postgresql.TIMESTAMP(), autoincrement=False, nullable=True
        ),
        sa.Column("is_lead", sa.BOOLEAN(), autoincrement=False, nullable=False),
        sa.ForeignKeyConstraint(
            ["project_id"], ["projects.id"], name="project_members_project_id_fkey"
        ),
        sa.ForeignKeyConstraint(
            ["user_id"], ["users.id"], name="project_members_user_id_fkey"
        ),
    )
    op.drop_index(
        op.f("ix_project_memberships_is_lead"), table_name="project_memberships"
    )
    op.drop_table("project_memberships") 
开发者ID:jazzband-roadies,项目名称:website,代码行数:22,代码来源:1083bb6545c9_.py

示例4: downgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('achievements', 'evaluation_shift')
    op.drop_index(op.f('ix_taskexecutions_task_id'), table_name='taskexecutions')
    op.drop_index(op.f('ix_taskexecutions_success'), table_name='taskexecutions')
    op.drop_index(op.f('ix_taskexecutions_planned_at'), table_name='taskexecutions')
    op.drop_index(op.f('ix_taskexecutions_locked_at'), table_name='taskexecutions')
    op.drop_index(op.f('ix_taskexecutions_finished_at'), table_name='taskexecutions')
    op.drop_index(op.f('ix_taskexecutions_canceled_at'), table_name='taskexecutions')
    op.drop_table('taskexecutions')
    op.drop_index(op.f('ix_tasks_task_name'), table_name='tasks')
    op.drop_index(op.f('ix_tasks_is_manually_modified'), table_name='tasks')
    op.drop_index(op.f('ix_tasks_is_removed'), table_name='tasks')
    op.drop_index(op.f('ix_tasks_is_auto_created'), table_name='tasks')
    op.drop_index(op.f('ix_tasks_entry_name'), table_name='tasks')
    op.drop_table('tasks')
    ### end Alembic commands ### 
开发者ID:ActiDoo,项目名称:gamification-engine,代码行数:19,代码来源:a90076b18837_tasks_and_shift.py

示例5: test_add_check_constraint_inline_on_column_w_f

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def test_add_check_constraint_inline_on_column_w_f(self):
        context = op_fixture(
            naming_convention={"ck": "ck_%(table_name)s_%(constraint_name)s"}
        )
        op.create_table(
            "some_table",
            Column(
                "x",
                Integer,
                CheckConstraint("im a constraint", name=op.f("ck_q_cc1")),
            ),
        )
        context.assert_(
            "CREATE TABLE some_table "
            "(x INTEGER CONSTRAINT ck_q_cc1 CHECK (im a constraint))"
        ) 
开发者ID:sqlalchemy,项目名称:alembic,代码行数:18,代码来源:test_op_naming_convention.py

示例6: test_add_column_schema_type_w_f

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def test_add_column_schema_type_w_f(self):
        context = op_fixture(
            naming_convention={"ck": "ck_%(table_name)s_%(constraint_name)s"}
        )
        op.add_column(
            "t1",
            Column(
                "c1",
                Boolean(name=op.f("foo"), create_constraint=True),
                nullable=False,
            ),
        )
        context.assert_(
            "ALTER TABLE t1 ADD COLUMN c1 BOOLEAN NOT NULL",
            "ALTER TABLE t1 ADD CONSTRAINT foo CHECK (c1 IN (0, 1))",
        ) 
开发者ID:sqlalchemy,项目名称:alembic,代码行数:18,代码来源:test_op_naming_convention.py

示例7: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "whitelist",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("account_name", sa.String(), nullable=True),
        sa.Column(
            "status",
            sa.Enum(
                "approved_automatically",
                "waiting",
                "approved_manually",
                name="whiteliststatus",
            ),
            nullable=True,
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_index(
        op.f("ix_whitelist_account_name"), "whitelist", ["account_name"], unique=False
    )
    # ### end Alembic commands ### 
开发者ID:packit-service,项目名称:packit-service,代码行数:24,代码来源:4292b00185bf_whitelist.py

示例8: downgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "copr_builds",
        sa.Column("pr_id", sa.INTEGER(), autoincrement=False, nullable=True),
    )
    op.drop_constraint(None, "copr_builds", type_="foreignkey")
    op.create_foreign_key(
        "copr_builds_pr_id_fkey1", "copr_builds", "pull_requests", ["pr_id"], ["id"]
    )
    op.drop_column("copr_builds", "job_trigger_id")
    op.drop_index(op.f("ix_tft_test_runs_pipeline_id"), table_name="tft_test_runs")
    op.drop_table("tft_test_runs")
    op.drop_table("project_releases")
    op.drop_index(op.f("ix_project_issues_issue_id"), table_name="project_issues")
    op.drop_table("project_issues")
    op.drop_index(op.f("ix_koji_builds_build_id"), table_name="koji_builds")
    op.drop_table("koji_builds")
    op.drop_table("git_branches")
    op.drop_table("build_triggers")
    # ### end Alembic commands ### 
开发者ID:packit-service,项目名称:packit-service,代码行数:23,代码来源:d90948124e46_add_tables_for_triggers_koji_and_tests.py

示例9: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('provider_details', sa.Column('created_by_id', postgresql.UUID(as_uuid=True), nullable=True))
    op.create_index(op.f('ix_provider_details_created_by_id'), 'provider_details', ['created_by_id'], unique=False)
    op.create_foreign_key('provider_details_created_by_id_fkey', 'provider_details', 'users', ['created_by_id'], ['id'])
    op.add_column('provider_details_history', sa.Column('created_by_id', postgresql.UUID(as_uuid=True), nullable=True))
    op.create_index(
        op.f('ix_provider_details_history_created_by_id'),
        'provider_details_history',
        ['created_by_id'],
        unique=False
    )
    op.create_foreign_key(
        'provider_details_history_created_by_id_fkey',
        'provider_details_history',
        'users',
        ['created_by_id'],
        ['id']
    )
    # ### end Alembic commands ### 
开发者ID:alphagov,项目名称:notifications-api,代码行数:22,代码来源:0068_add_created_by_to_provider.py

示例10: _update_managers_table

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def _update_managers_table():
    op.add_column('managers', sa.Column('node_id', sa.Text(), nullable=True))
    op.add_column('managers',
                  sa.Column('last_seen', UTCDateTime(), nullable=False,
                            server_default=sa.func.current_timestamp()))
    op.add_column('managers',
                  sa.Column('status_report_frequency', sa.Integer(),
                            nullable=True))
    op.execute("""
      UPDATE managers
      SET node_id = hostname;
    """)
    op.alter_column('managers', 'node_id', nullable=False)
    op.create_unique_constraint(op.f('managers_node_id_key'), 'managers',
                                ['node_id'])
    op.create_index(op.f('managers_last_seen_idx'), 'managers', ['last_seen'],
                    unique=False) 
开发者ID:cloudify-cosmo,项目名称:cloudify-manager,代码行数:19,代码来源:62a8d746d13b_5_0_to_5_0_5.py

示例11: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "slack_user",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("date_created", sa.DateTime(), nullable=True),
        sa.Column("date_modified", sa.DateTime(), nullable=True),
        sa.Column("installation_id", sa.Integer(), nullable=False),
        sa.Column("slack_id", sa.String(length=30), nullable=False),
        sa.Column("slack_oauth_state", sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(
            ["installation_id"], ["slack_installation.id"], name="fk_installation_id"
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_index(
        op.f("ix_slack_user_installation_id"),
        "slack_user",
        ["installation_id"],
        unique=False,
    )
    op.create_index(
        op.f("ix_slack_user_slack_id"), "slack_user", ["slack_id"], unique=False
    )
    # ### end Alembic commands ### 
开发者ID:busy-beaver-dev,项目名称:busy-beaver,代码行数:27,代码来源:20200705_16-09-04__add_slack_user_table.py

示例12: upgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def upgrade():
    # we dont retain historical data as we simply dont care yet
    op.execute("truncate table filecoverage")
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "filecoverage", sa.Column("build_id", zeus.db.types.guid.GUID(), nullable=False)
    )
    op.create_index(
        op.f("ix_filecoverage_build_id"), "filecoverage", ["build_id"], unique=False
    )
    op.create_unique_constraint(
        "unq_coverage_filname", "filecoverage", ["build_id", "filename"]
    )
    op.drop_constraint("unq_job_filname", "filecoverage", type_="unique")
    op.drop_constraint("filecoverage_job_id_fkey", "filecoverage", type_="foreignkey")
    op.create_foreign_key(
        None, "filecoverage", "build", ["build_id"], ["id"], ondelete="CASCADE"
    )
    op.drop_column("filecoverage", "job_id")


# ### end Alembic commands ### 
开发者ID:getsentry,项目名称:zeus,代码行数:24,代码来源:71a34df585ed_migrate_coverage.py

示例13: downgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def downgrade():
    op.drop_constraint(op.f('fk_users_domain_name_domains'), 'users', type_='foreignkey')
    op.drop_index(op.f('ix_users_domain_name'), table_name='users')
    op.drop_column('users', 'domain_name')
    op.drop_table('domains') 
开发者ID:lablup,项目名称:backend.ai-manager,代码行数:7,代码来源:bae1a7326e8a_add_domain_model.py

示例14: downgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('kernels', sa.Column('agent_id', sa.VARCHAR(), autoincrement=False, nullable=True))
    op.drop_constraint(op.f('fk_kernels_agent_agents'), 'kernels', type_='foreignkey')
    op.drop_index(op.f('ix_kernels_terminated_at'), table_name='kernels')
    op.drop_index(op.f('ix_kernels_status'), table_name='kernels')
    op.drop_index(op.f('ix_kernels_created_at'), table_name='kernels')
    op.drop_column('kernels', 'status_info')
    op.drop_column('kernels', 'num_queries')
    op.drop_column('kernels', 'net_tx_bytes')
    op.drop_column('kernels', 'net_rx_bytes')
    op.drop_column('kernels', 'max_mem_bytes')
    op.drop_column('kernels', 'io_write_bytes')
    op.drop_column('kernels', 'io_read_bytes')
    op.drop_column('kernels', 'cur_mem_bytes')
    op.drop_column('kernels', 'cpu_used')
    op.drop_column('kernels', 'allocated_cores')
    op.drop_column('kernels', 'agent')
    op.create_table(
        'usage',
        sa.Column('id', postgresql.UUID(), server_default=sa.text('uuid_generate_v4()'), autoincrement=False, nullable=False),
        sa.Column('access_key_id', sa.VARCHAR(length=20), autoincrement=False, nullable=True),
        sa.Column('kernel_type', sa.VARCHAR(), autoincrement=False, nullable=True),
        sa.Column('kernel_id', sa.VARCHAR(), autoincrement=False, nullable=True),
        sa.Column('started_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
        sa.Column('terminated_at', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
        sa.Column('cpu_used', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True),
        sa.Column('mem_used', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True),
        sa.Column('io_used', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True),
        sa.Column('net_used', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True),
        sa.ForeignKeyConstraint(['access_key_id'], ['keypairs.access_key'], name='fk_usage_access_key_id_keypairs'),
        sa.PrimaryKeyConstraint('id', name='pk_usage')
    )
    op.drop_table('vfolder_attachment')
    op.drop_table('vfolders')
    op.drop_table('agents')
    # ### end Alembic commands ### 
开发者ID:lablup,项目名称:backend.ai-manager,代码行数:39,代码来源:7ea324d0535b_vfolder_and_kernel.py

示例15: downgrade

# 需要导入模块: from alembic import op [as 别名]
# 或者: from alembic.op import f [as 别名]
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(op.f('fk_keypairs_resource_policy_keypair_resource_policies'),
                       'keypairs', type_='foreignkey')
    op.add_column(
        'keypairs',
        sa.Column('concurrency_limit', sa.INTEGER(),
                  autoincrement=False, nullable=True))
    op.alter_column('keypairs', 'resource_policy',
                    existing_type=sa.String(length=256),
                    type_=sa.VARCHAR(),
                    nullable=True)
    op.drop_table('keypair_resource_policies')
    default_for_unspecified.drop(op.get_bind())
    # ### end Alembic commands ### 
开发者ID:lablup,项目名称:backend.ai-manager,代码行数:17,代码来源:dbc1e053b880_add_keypair_resource_policy.py


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