Merge "Overload correctly BASEV2.__table_args__"

This commit is contained in:
Jenkins 2015-01-30 05:09:04 +00:00 committed by Gerrit Code Review
commit 61cf287407
6 changed files with 10 additions and 3 deletions

View File

@ -46,6 +46,7 @@ class Agent(model_base.BASEV2, models_v2.HasId):
__table_args__ = (
sa.UniqueConstraint('agent_type', 'host',
name='uniq_agents0agent_type0host'),
model_base.BASEV2.__table_args__
)
# L3 agent, DHCP agent, OVS agent, LinuxBridge

View File

@ -69,7 +69,9 @@ class IPAvailabilityRange(model_base.BASEV2):
name='uniq_ipavailabilityranges0first_ip0allocation_pool_id'),
sa.UniqueConstraint(
last_ip, allocation_pool_id,
name='uniq_ipavailabilityranges0last_ip0allocation_pool_id'))
name='uniq_ipavailabilityranges0last_ip0allocation_pool_id'),
model_base.BASEV2.__table_args__
)
def __repr__(self):
return "%s - %s" % (self.first_ip, self.last_ip)

View File

@ -57,6 +57,7 @@ class GreEndpoints(model_base.BASEV2):
__table_args__ = (
sa.UniqueConstraint('host',
name='unique_ml2_gre_endpoints0host'),
model_base.BASEV2.__table_args__
)
ip_address = sa.Column(sa.String(64), primary_key=True)
host = sa.Column(sa.String(255), nullable=True)

View File

@ -63,6 +63,7 @@ class VxlanEndpoints(model_base.BASEV2):
__table_args__ = (
sa.UniqueConstraint('host',
name='unique_ml2_vxlan_endpoints0host'),
model_base.BASEV2.__table_args__
)
ip_address = sa.Column(sa.String(64), primary_key=True)
udp_port = sa.Column(sa.Integer, nullable=False)

View File

@ -106,7 +106,8 @@ class NetworkConnection(model_base.BASEV2, models_v2.HasTenant):
segmentation_id = sa.Column(sa.Integer)
__table_args__ = (sa.UniqueConstraint(network_gateway_id,
segmentation_type,
segmentation_id),)
segmentation_id),
model_base.BASEV2.__table_args__)
# Also, storing port id comes back useful when disconnecting a network
# from a gateway
port_id = sa.Column(sa.String(36),

View File

@ -203,7 +203,8 @@ class NsxvPortIndexMapping(model_base.BASEV2):
primary_key=True)
device_id = sa.Column(sa.String(255), nullable=False)
index = sa.Column(sa.Integer, nullable=False)
__table_args__ = (sa.UniqueConstraint(device_id, index),)
__table_args__ = (sa.UniqueConstraint(device_id, index),
model_base.BASEV2.__table_args__)
# Add a relationship to the Port model in order to instruct SQLAlchemy to
# eagerly read port vnic-index