• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python migration.schema_has_table函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中neutron.db.migration.schema_has_table函数的典型用法代码示例。如果您正苦于以下问题:Python schema_has_table函数的具体用法?Python schema_has_table怎么用?Python schema_has_table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: upgrade

def upgrade():

    if migration.schema_has_table('nsxv3_lbaas_l7rules'):
        op.drop_constraint('fk_nsxv3_lbaas_l7rules_id', 'nsxv3_lbaas_l7rules',
                           'foreignkey')
        op.drop_constraint('l7rule_id', 'nsxv3_lbaas_l7rules', 'primary')
        op.drop_column('nsxv3_lbaas_l7rules', 'loadbalancer_id')
        op.drop_column('nsxv3_lbaas_l7rules', 'l7rule_id')
        op.rename_table('nsxv3_lbaas_l7rules', 'nsxv3_lbaas_l7policies')

        if migration.schema_has_table('lbaas_l7policies'):
            op.create_foreign_key(
                'fk_nsxv3_lbaas_l7policies_id', 'nsxv3_lbaas_l7policies',
                'lbaas_l7policies', ['l7policy_id'], ['id'],
                ondelete='CASCADE')
    else:
        op.create_table(
            'nsxv3_lbaas_l7policies',
            sa.Column('l7policy_id', sa.String(36), nullable=False),
            sa.Column('lb_rule_id', sa.String(36), nullable=False),
            sa.Column('lb_vs_id', sa.String(36), nullable=False),
            sa.Column('created_at', sa.DateTime(), nullable=True),
            sa.Column('updated_at', sa.DateTime(), nullable=True),
            sa.PrimaryKeyConstraint('l7policy_id'))

        if migration.schema_has_table('lbaas_l7policies'):
            op.create_foreign_key(
                'fk_nsxv3_lbaas_l7policies_id', 'nsxv3_lbaas_l7policies',
                'lbaas_l7policies', ['l7policy_id'], ['id'],
                ondelete='CASCADE')
开发者ID:openstack,项目名称:vmware-nsx,代码行数:30,代码来源:717f7f63a219_nsxv3_lbaas_l7policy.py


示例2: upgrade

def upgrade():
    if (migration.schema_has_table('nsxv3_lbaas_loadbalancers') and
        migration.schema_has_table('lbaas_loadbalancers')):
        # Mark as ERROR loadbalancers without nsx mapping
        op.execute("UPDATE lbaas_loadbalancers "
                   "SET provisioning_status='ERROR' "
                   "WHERE id not in (SELECT loadbalancer_id FROM "
                   "nsxv3_lbaas_loadbalancers)")
开发者ID:openstack,项目名称:vmware-nsx,代码行数:8,代码来源:99bfcb6003c6_lbaas_error_no_member.py


示例3: upgrade

def upgrade():

    if not migration.schema_has_table('ml2_port_bindings'):
        # In the database we are migrating from, the configured plugin
        # did not create the ml2_port_bindings table.
        return

    op.add_column('ml2_port_bindings',
                  sa.Column('vif_details', sa.String(length=4095),
                            nullable=False, server_default=''))
    if op.get_bind().engine.name == 'ibm_db_sa':
        op.execute(
            "UPDATE ml2_port_bindings SET"
            " vif_details = '{\"port_filter\": true}'"
            " WHERE cap_port_filter = 1")
        op.execute(
            "UPDATE ml2_port_bindings SET"
            " vif_details = '{\"port_filter\": false}'"
            " WHERE cap_port_filter = 0")
    else:
        op.execute(
            "UPDATE ml2_port_bindings SET"
            " vif_details = '{\"port_filter\": true}'"
            " WHERE cap_port_filter = true")
        op.execute(
            "UPDATE ml2_port_bindings SET"
            " vif_details = '{\"port_filter\": false}'"
            " WHERE cap_port_filter = false")
    op.drop_column('ml2_port_bindings', 'cap_port_filter')
    if op.get_bind().engine.name == 'ibm_db_sa':
        op.execute("CALL SYSPROC.ADMIN_CMD('REORG TABLE ml2_port_bindings')")
开发者ID:Akanksha08,项目名称:neutron,代码行数:31,代码来源:50d5ba354c23_ml2_binding_vif_details.py


示例4: upgrade

def upgrade():

    if not migration.schema_has_table('cisco_n1kv_vlan_allocations'):
        # Assume that, in the database we are migrating from, the
        # configured plugin did not create any n1kv tables.
        return

    op.add_column(
        'cisco_n1kv_vlan_allocations',
        sa.Column('network_profile_id',
                  sa.String(length=36),
                  nullable=False)
    )
    op.create_foreign_key(
        'cisco_n1kv_vlan_allocations_ibfk_1',
        source='cisco_n1kv_vlan_allocations',
        referent='cisco_network_profiles',
        local_cols=['network_profile_id'], remote_cols=['id'],
        ondelete='CASCADE'
    )
    op.add_column(
        'cisco_n1kv_vxlan_allocations',
        sa.Column('network_profile_id',
                  sa.String(length=36),
                  nullable=False)
    )
    op.create_foreign_key(
        'cisco_n1kv_vxlan_allocations_ibfk_1',
        source='cisco_n1kv_vxlan_allocations',
        referent='cisco_network_profiles',
        local_cols=['network_profile_id'], remote_cols=['id'],
        ondelete='CASCADE'
    )
开发者ID:CiscoSystems,项目名称:neutron,代码行数:33,代码来源:5ac1c354a051_n1kv_segment_alloc.py


示例5: upgrade

def upgrade():
    if migration.schema_has_table(TABLE_NAME):
        op.create_unique_constraint(
            name=CONSTRAINT_NAME,
            source=TABLE_NAME,
            local_cols=['pool_id', 'address', 'protocol_port']
        )
开发者ID:Akanksha08,项目名称:neutron,代码行数:7,代码来源:e197124d4b9_add_unique_constrain.py


示例6: upgrade

def upgrade():

    if not migration.schema_has_table(TABLE_NAME):
        # Assume that, in the database we are migrating from, the
        # configured plugin did not create the agents table.
        return

    op.create_unique_constraint(name=UC_NAME, source=TABLE_NAME, local_cols=["agent_type", "host"])
开发者ID:armando-migliaccio,项目名称:neutron-1,代码行数:8,代码来源:1fcfc149aca4_agents_unique_by_type_and_host.py


示例7: upgrade

def upgrade():

    if not migration.schema_has_table('routers'):
        # In the database we are migrating from, the configured plugin
        # did not create the routers table.
        return

    op.create_table(
        'routerroutes_mapping',
        sa.Column('router_id', sa.String(length=36), nullable=False),
        sa.Column('nuage_route_id', sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
                                ondelete='CASCADE'),
    )
    # This table might already exist as it might have been created
    # if another plugin was configured before the nuage one
    if not migration.schema_has_table('routerroutes'):
        l3_init_ops.create_routerroutes()
开发者ID:Akanksha08,项目名称:neutron,代码行数:18,代码来源:10cd28e692e9_nuage_extraroute.py


示例8: upgrade

def upgrade():
    op.create_table('cisco_router_types',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('id', sa.String(length=36), nullable=False),
        sa.Column('name', sa.String(length=255), nullable=False),
        sa.Column('description', sa.String(length=255), nullable=True),
        sa.Column('template_id', sa.String(length=36), nullable=True),
        sa.Column('ha_enabled_by_default', sa.Boolean(), nullable=False,
                  server_default=sa.sql.false()),
        sa.Column('shared', sa.Boolean(), nullable=False,
                  server_default=sa.sql.true()),
        sa.Column('slot_need', sa.Integer(), autoincrement=False,
                  nullable=True),
        sa.Column('scheduler', sa.String(length=255), nullable=False),
        sa.Column('driver', sa.String(length=255), nullable=False),
        sa.Column('cfg_agent_service_helper', sa.String(length=255),
                  nullable=False),
        sa.Column('cfg_agent_driver', sa.String(length=255), nullable=False),
        sa.ForeignKeyConstraint(['template_id'],
                                ['cisco_hosting_device_templates.id'],
                                ondelete='CASCADE'),
        sa.PrimaryKeyConstraint('id')
    )
    if migration.schema_has_table('cisco_router_mappings'):
        op.add_column('cisco_router_mappings',
                      sa.Column('role', sa.String(255), nullable=True))
        op.add_column('cisco_router_mappings',
                      sa.Column('router_type_id', sa.String(length=36),
                                nullable=False))
        op.create_foreign_key('cisco_router_mappings_ibfk_3',
                              source_table='cisco_router_mappings',
                              referent_table='cisco_router_types',
                              local_cols=['router_type_id'],
                              remote_cols=['id'])
        op.drop_constraint('cisco_router_mappings_ibfk_2',
                           'cisco_router_mappings', type_='foreignkey')
        op.drop_constraint('cisco_router_mappings_ibfk_2',
                           'cisco_router_mappings', type_='primary')
        op.create_foreign_key('cisco_router_mappings_ibfk_2',
                              source_table='cisco_router_mappings',
                              referent_table='routers',
                              local_cols=['router_id'],
                              remote_cols=['id'],
                              ondelete='CASCADE')
        op.create_primary_key(
            constraint_name='pk_cisco_router_mappings',
            table_name='cisco_router_mappings',
            columns=['router_id', 'router_type_id'])
        op.add_column('cisco_router_mappings',
                      sa.Column('inflated_slot_need', sa.Integer(),
                                autoincrement=False, nullable=True,
                                server_default='0'))
        op.add_column('cisco_router_mappings',
                      sa.Column('share_hosting_device', sa.Boolean(),
                                nullable=False, server_default=sa.sql.true()))
        op.create_index(op.f('ix_cisco_router_types_tenant_id'),
                        'cisco_router_types', ['tenant_id'], unique=False)
开发者ID:CiscoKorea,项目名称:networking-cisco,代码行数:57,代码来源:53f08de0523f_neutron_routers_in_cisco_devices.py


示例9: upgrade

def upgrade():
    if migration.schema_has_table('poolstatisticss'):
        op.alter_column('poolstatisticss', 'bytes_in',
                        type_=sa.BigInteger(), existing_type=sa.Integer())
        op.alter_column('poolstatisticss', 'bytes_out',
                        type_=sa.BigInteger(), existing_type=sa.Integer())
        op.alter_column('poolstatisticss', 'active_connections',
                        type_=sa.BigInteger(), existing_type=sa.Integer())
        op.alter_column('poolstatisticss', 'total_connections',
                        type_=sa.BigInteger(), existing_type=sa.Integer())
开发者ID:CiscoSystems,项目名称:neutron,代码行数:10,代码来源:abc88c33f74f_lb_stats_needs_bigint.py


示例10: upgrade

def upgrade():
    if not migration.schema_has_table('apic_ml2_ha_ipaddress_to_port_owner'):
        op.create_table(
            'apic_ml2_ha_ipaddress_to_port_owner',
            sa.Column('ha_ip_address', sa.String(length=64), nullable=False),
            sa.Column('port_id', sa.String(length=64), nullable=False),
            sa.ForeignKeyConstraint(
                ['port_id'], ['ports.id'], ondelete='CASCADE',
                name='apic_ml2_ha_ipaddress_to_port_owner_fk_port_id'),
            sa.PrimaryKeyConstraint('ha_ip_address', 'port_id'))
开发者ID:openstack,项目名称:group-based-policy,代码行数:10,代码来源:4c0c1e2c0160_ha_ip_address_to_port_id_association.py


示例11: upgrade

def upgrade():

    if not migration.schema_has_table("routers"):
        # In the database we are migrating from, the configured plugin
        # did not create the routers table.
        return

    op.create_table(
        "net_partitions",
        sa.Column("id", sa.String(length=36), nullable=False),
        sa.Column("name", sa.String(length=64), nullable=True),
        sa.Column("l3dom_tmplt_id", sa.String(length=36), nullable=True),
        sa.Column("l2dom_tmplt_id", sa.String(length=36), nullable=True),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "port_mapping",
        sa.Column("port_id", sa.String(length=36), nullable=False),
        sa.Column("nuage_vport_id", sa.String(length=36), nullable=True),
        sa.Column("nuage_vif_id", sa.String(length=36), nullable=True),
        sa.Column("static_ip", sa.Boolean(), nullable=True),
        sa.ForeignKeyConstraint(["port_id"], ["ports.id"], ondelete="CASCADE"),
        sa.PrimaryKeyConstraint("port_id"),
    )
    op.create_table(
        "subnet_l2dom_mapping",
        sa.Column("subnet_id", sa.String(length=36), nullable=False),
        sa.Column("net_partition_id", sa.String(length=36), nullable=True),
        sa.Column("nuage_subnet_id", sa.String(length=36), nullable=True),
        sa.Column("nuage_l2dom_tmplt_id", sa.String(length=36), nullable=True),
        sa.Column("nuage_user_id", sa.String(length=36), nullable=True),
        sa.Column("nuage_group_id", sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(["subnet_id"], ["subnets.id"], ondelete="CASCADE"),
        sa.ForeignKeyConstraint(["net_partition_id"], ["net_partitions.id"], ondelete="CASCADE"),
        sa.PrimaryKeyConstraint("subnet_id"),
    )
    op.create_table(
        "net_partition_router_mapping",
        sa.Column("net_partition_id", sa.String(length=36), nullable=False),
        sa.Column("router_id", sa.String(length=36), nullable=False),
        sa.Column("nuage_router_id", sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(["net_partition_id"], ["net_partitions.id"], ondelete="CASCADE"),
        sa.ForeignKeyConstraint(["router_id"], ["routers.id"], ondelete="CASCADE"),
        sa.PrimaryKeyConstraint("net_partition_id", "router_id"),
    )
    op.create_table(
        "router_zone_mapping",
        sa.Column("router_id", sa.String(length=36), nullable=False),
        sa.Column("nuage_zone_id", sa.String(length=36), nullable=True),
        sa.Column("nuage_user_id", sa.String(length=36), nullable=True),
        sa.Column("nuage_group_id", sa.String(length=36), nullable=True),
        sa.ForeignKeyConstraint(["router_id"], ["routers.id"], ondelete="CASCADE"),
        sa.PrimaryKeyConstraint("router_id"),
    )
开发者ID:armando-migliaccio,项目名称:neutron-1,代码行数:54,代码来源:e766b19a3bb_nuage_initial.py


示例12: upgrade

def upgrade():
    # These tables will be created even if the nuage plugin is not enabled.
    # This is fine as they would be created anyway by the healing migration.
    if migration.schema_has_table('routers'):
        # In the database we are migrating from, the configured plugin
        # did not create the routers table.
        op.create_table(
            'nuage_floatingip_pool_mapping',
            sa.Column('fip_pool_id', sa.String(length=36), nullable=False),
            sa.Column('net_id', sa.String(length=36), nullable=True),
            sa.Column('router_id', sa.String(length=36), nullable=True),
            sa.ForeignKeyConstraint(['net_id'], ['networks.id'],
                                    ondelete='CASCADE'),
            sa.ForeignKeyConstraint(['router_id'], ['routers.id'],
                                    ondelete='CASCADE'),
            sa.PrimaryKeyConstraint('fip_pool_id'),
        )
    if migration.schema_has_table('floatingips'):
        # In the database we are migrating from, the configured plugin
        # did not create the floatingips table.
        op.create_table(
            'nuage_floatingip_mapping',
            sa.Column('fip_id', sa.String(length=36), nullable=False),
            sa.Column('router_id', sa.String(length=36), nullable=True),
            sa.Column('nuage_fip_id', sa.String(length=36), nullable=True),
            sa.ForeignKeyConstraint(['fip_id'], ['floatingips.id'],
                                    ondelete='CASCADE'),
            sa.PrimaryKeyConstraint('fip_id'),
        )
    migration.rename_table_if_exists('net_partitions',
                                     'nuage_net_partitions')
    migration.rename_table_if_exists('net_partition_router_mapping',
                                     'nuage_net_partition_router_mapping')
    migration.rename_table_if_exists('router_zone_mapping',
                                     'nuage_router_zone_mapping')
    migration.rename_table_if_exists('subnet_l2dom_mapping',
                                     'nuage_subnet_l2dom_mapping')
    migration.rename_table_if_exists('port_mapping',
                                     'nuage_port_mapping')
    migration.rename_table_if_exists('routerroutes_mapping',
                                     'nuage_routerroutes_mapping')
开发者ID:CiscoSystems,项目名称:neutron,代码行数:41,代码来源:2db5203cb7a9_nuage_floatingip.py


示例13: upgrade

def upgrade():
    if not migration.schema_has_table("pools"):
        # The lbaas service plugin was not configured.
        return
    op.create_table(
        u"embrane_pool_port",
        sa.Column(u"pool_id", sa.String(length=36), nullable=False),
        sa.Column(u"port_id", sa.String(length=36), nullable=False),
        sa.ForeignKeyConstraint(["pool_id"], [u"pools.id"], name=u"embrane_pool_port_ibfk_1"),
        sa.ForeignKeyConstraint(["port_id"], [u"ports.id"], name=u"embrane_pool_port_ibfk_2"),
        sa.PrimaryKeyConstraint(u"pool_id"),
    )
开发者ID:balagopalraj,项目名称:clearlinux,代码行数:12,代码来源:33dd0a9fa487_embrane_lbaas_driver.py


示例14: upgrade

def upgrade():
    if not migration.schema_has_table('pools'):
        # The lbaas service plugin was not configured.
        return
    op.create_table(
        u'embrane_pool_port',
        sa.Column(u'pool_id', sa.String(length=36), nullable=False),
        sa.Column(u'port_id', sa.String(length=36), nullable=False),
        sa.ForeignKeyConstraint(['pool_id'], [u'pools.id'],
                                name=u'embrane_pool_port_ibfk_1'),
        sa.ForeignKeyConstraint(['port_id'], [u'ports.id'],
                                name=u'embrane_pool_port_ibfk_2'),
        sa.PrimaryKeyConstraint(u'pool_id'))
开发者ID:CiscoSystems,项目名称:neutron,代码行数:13,代码来源:33dd0a9fa487_embrane_lbaas_driver.py


示例15: upgrade

def upgrade():
    if migration.schema_has_table('lbaas_l7policies'):
        op.create_table(
            'nsxv_lbaas_l7policy_bindings',
            sa.Column('policy_id', sa.String(length=36), nullable=False),
            sa.Column('edge_id', sa.String(length=36), nullable=False),
            sa.Column('edge_app_rule_id',
                      sa.String(length=36), nullable=False),
            sa.Column('created_at', sa.DateTime(), nullable=True),
            sa.Column('updated_at', sa.DateTime(), nullable=True),
            sa.PrimaryKeyConstraint('policy_id'),
            sa.ForeignKeyConstraint(['policy_id'],
                                    ['lbaas_l7policies.id'],
                                    ondelete='CASCADE'))
开发者ID:openstack,项目名称:vmware-nsx,代码行数:14,代码来源:01a33f93f5fd_nsxv_lbv2_l7pol.py


示例16: upgrade

def upgrade():

    if not migration.schema_has_table('nvp_network_bindings'):
        # Assume that, in the database we are migrating from, the
        # configured plugin did not create any nvp tables.
        return

    op.rename_table('nvp_network_bindings', 'tz_network_bindings')
    op.rename_table('nvp_multi_provider_networks', 'multi_provider_networks')

    engine = op.get_bind().engine
    if engine.name == 'postgresql':
        op.execute("ALTER TYPE nvp_network_bindings_binding_type "
                   "RENAME TO tz_network_bindings_binding_type;")
开发者ID:Akanksha08,项目名称:neutron,代码行数:14,代码来源:3d2585038b95_vmware_nsx.py


示例17: upgrade

def upgrade():

    if not migration.schema_has_table('floatingips'):
        # In the database we are migrating from, the configured plugin
        # did not create the floatingips table.
        return

    op.add_column('floatingips',
                  sa.Column('last_known_router_id',
                            sa.String(length=36),
                            nullable=True))
    op.add_column('floatingips',
                  sa.Column('status',
                            sa.String(length=16),
                            nullable=True))
开发者ID:Akanksha08,项目名称:neutron,代码行数:15,代码来源:2eeaf963a447_floatingip_status.py


示例18: upgrade

def upgrade():

    if not migration.schema_has_table('ofctenantmappings'):
        # Assume that, in the database we are migrating from, the
        # configured plugin did not create any ofc tables.
        return

    for table in ['ofctenantmappings', 'ofcnetworkmappings',
                  'ofcportmappings', 'ofcfiltermappings',
                  'ofcroutermappings',
                  ]:
        op.alter_column(table, 'quantum_id',
                        new_column_name='neutron_id',
                        existing_type=sa.String(length=36),
                        existing_nullable=False)
开发者ID:CiscoSystems,项目名称:neutron,代码行数:15,代码来源:538732fa21e1_nec_rename_quantum_id_to_neutron_id.py


示例19: upgrade

def upgrade():
    if not migration.schema_has_table('ipsec_site_connections'):
        # The vpnaas service plugin was not configured.
        return
    op.create_table(
        'cisco_csr_identifier_map',
        sa.Column('tenant_id', sa.String(length=255), nullable=True),
        sa.Column('ipsec_site_conn_id', sa.String(length=64),
                  primary_key=True),
        sa.Column('csr_tunnel_id', sa.Integer(), nullable=False),
        sa.Column('csr_ike_policy_id', sa.Integer(), nullable=False),
        sa.Column('csr_ipsec_policy_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(['ipsec_site_conn_id'],
                                ['ipsec_site_connections.id'],
                                ondelete='CASCADE')
    )
开发者ID:Akanksha08,项目名称:neutron,代码行数:16,代码来源:24c7ea5160d7_cisco_csr_vpnaas.py


示例20: upgrade

def upgrade():
    if not schema_has_table('snabb_mechanism_props'):
        op.create_table(
            'snabb_mechanism_props',
            sa.Column('tenant_id', sa.String(length=255), nullable=True),
            sa.Column('subnet', sa.String(length=64), nullable=False),
            sa.Column('ip_address', sa.String(length=64), nullable=False),
            sa.PrimaryKeyConstraint('ip_address'),
            mysql_engine='InnoDB',
        )
        op.create_index(
          op.f('ix_snabb_mechanism_props_tenant_id'),
          'snabb_mechanism_props',
          ['tenant_id'],
          unique=False,
        )
开发者ID:gvsurenderreddy,项目名称:snabb-neutron,代码行数:16,代码来源:ff1d905b4db_initial.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python migration.should_run函数代码示例发布时间:2022-05-27
下一篇:
Python migration.schema_has_column函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap