本文整理汇总了Python中neutron.db.migration.schema_has_table函数的典型用法代码示例。如果您正苦于以下问题:Python schema_has_table函数的具体用法?Python schema_has_table怎么用?Python schema_has_table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了schema_has_table函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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')
示例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)")
示例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')")
示例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'
)
示例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']
)
示例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"])
示例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()
示例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())
示例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"),
)
示例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')
示例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"),
)
示例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'))
示例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'))