Merge "LBaaSv2 foreign keys"
This commit is contained in:
commit
16283eb232
@ -1 +1 @@
|
||||
aede17d51d0f
|
||||
7e46906f8997
|
||||
|
@ -0,0 +1,53 @@
|
||||
# Copyright 2016 VMware, Inc.
|
||||
# All Rights Reserved
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""lbaas foreignkeys
|
||||
|
||||
Revision ID: 7e46906f8997
|
||||
Revises: aede17d51d0f
|
||||
Create Date: 2016-04-21 10:45:32.278433
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '7e46906f8997'
|
||||
down_revision = 'aede17d51d0f'
|
||||
|
||||
from alembic import op
|
||||
|
||||
from neutron.db import migration
|
||||
|
||||
|
||||
def upgrade():
|
||||
if migration.schema_has_table('lbaas_loadbalancers'):
|
||||
op.create_foreign_key(
|
||||
'fk_lbaas_loadbalancers_id', 'nsxv_lbaas_loadbalancer_bindings',
|
||||
'lbaas_loadbalancers', ['loadbalancer_id'], ['id'],
|
||||
ondelete='CASCADE')
|
||||
|
||||
if migration.schema_has_table('lbaas_listeners'):
|
||||
op.create_foreign_key(
|
||||
'fk_lbaas_listeners_id', 'nsxv_lbaas_listener_bindings',
|
||||
'lbaas_listeners', ['listener_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
if migration.schema_has_table('lbaas_pools'):
|
||||
op.create_foreign_key(
|
||||
'fk_lbaas_pools_id', 'nsxv_lbaas_pool_bindings',
|
||||
'lbaas_pools', ['pool_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
if migration.schema_has_table('lbaas_healthmonitors'):
|
||||
op.create_foreign_key(
|
||||
'fk_lbaas_healthmonitors_id', 'nsxv_lbaas_monitor_bindings',
|
||||
'lbaas_healthmonitors', ['hm_id'], ['id'], ondelete='CASCADE')
|
@ -267,7 +267,11 @@ class NsxvLbaasLoadbalancerBinding(model_base.BASEV2, models.TimestampMixin):
|
||||
|
||||
__tablename__ = 'nsxv_lbaas_loadbalancer_bindings'
|
||||
|
||||
loadbalancer_id = sa.Column(sa.String(36), primary_key=True)
|
||||
loadbalancer_id = sa.Column(sa.String(36),
|
||||
sa.ForeignKey('lbaas_loadbalancers.id',
|
||||
name='fk_lbaas_loadbalancers_id',
|
||||
ondelete="CASCADE"),
|
||||
primary_key=True)
|
||||
edge_id = sa.Column(sa.String(36), nullable=False)
|
||||
edge_fw_rule_id = sa.Column(sa.String(36), nullable=False)
|
||||
vip_address = sa.Column(sa.String(36), nullable=False)
|
||||
@ -279,7 +283,11 @@ class NsxvLbaasListenerBinding(model_base.BASEV2, models.TimestampMixin):
|
||||
__tablename__ = 'nsxv_lbaas_listener_bindings'
|
||||
|
||||
loadbalancer_id = sa.Column(sa.String(36), primary_key=True)
|
||||
listener_id = sa.Column(sa.String(36), primary_key=True)
|
||||
listener_id = sa.Column(sa.String(36),
|
||||
sa.ForeignKey('lbaas_listeners.id',
|
||||
name='fk_lbaas_listeners_id',
|
||||
ondelete="CASCADE"),
|
||||
primary_key=True)
|
||||
app_profile_id = sa.Column(sa.String(36), nullable=False)
|
||||
vse_id = sa.Column(sa.String(36), nullable=False)
|
||||
|
||||
@ -291,7 +299,11 @@ class NsxvLbaasPoolBinding(model_base.BASEV2, models.TimestampMixin):
|
||||
|
||||
loadbalancer_id = sa.Column(sa.String(36), primary_key=True)
|
||||
listener_id = sa.Column(sa.String(36), primary_key=True)
|
||||
pool_id = sa.Column(sa.String(36), primary_key=True)
|
||||
pool_id = sa.Column(sa.String(36),
|
||||
sa.ForeignKey('lbaas_pools.id',
|
||||
name='fk_lbaas_pools_id',
|
||||
ondelete="CASCADE"),
|
||||
primary_key=True)
|
||||
edge_pool_id = sa.Column(sa.String(36), nullable=False)
|
||||
|
||||
|
||||
@ -303,7 +315,11 @@ class NsxvLbaasMonitorBinding(model_base.BASEV2, models.TimestampMixin):
|
||||
loadbalancer_id = sa.Column(sa.String(36), primary_key=True)
|
||||
listener_id = sa.Column(sa.String(36), primary_key=True)
|
||||
pool_id = sa.Column(sa.String(36), primary_key=True)
|
||||
hm_id = sa.Column(sa.String(36), primary_key=True)
|
||||
hm_id = sa.Column(sa.String(36),
|
||||
sa.ForeignKey('lbaas_healthmonitors.id',
|
||||
name='fk_lbaas_healthmonitors_id',
|
||||
ondelete="CASCADE"),
|
||||
primary_key=True)
|
||||
edge_id = sa.Column(sa.String(36), primary_key=True)
|
||||
edge_mon_id = sa.Column(sa.String(36), nullable=False)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user