Merge "[placement] add a placement_aggregates table to api_db"
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
# 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.
|
||||||
|
"""API Database migrations for placement_aggregates"""
|
||||||
|
|
||||||
|
from migrate import UniqueConstraint
|
||||||
|
from sqlalchemy import Column
|
||||||
|
from sqlalchemy import DateTime
|
||||||
|
from sqlalchemy import Integer
|
||||||
|
from sqlalchemy import MetaData
|
||||||
|
from sqlalchemy import String
|
||||||
|
from sqlalchemy import Table
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade(migrate_engine):
|
||||||
|
meta = MetaData()
|
||||||
|
meta.bind = migrate_engine
|
||||||
|
|
||||||
|
placement_aggregates = Table('placement_aggregates', meta,
|
||||||
|
Column('created_at', DateTime),
|
||||||
|
Column('updated_at', DateTime),
|
||||||
|
Column('id', Integer, primary_key=True, nullable=False),
|
||||||
|
Column('uuid', String(length=36), index=True),
|
||||||
|
UniqueConstraint('uuid', name='uniq_placement_aggregates0uuid'),
|
||||||
|
mysql_engine='InnoDB',
|
||||||
|
mysql_charset='latin1'
|
||||||
|
)
|
||||||
|
|
||||||
|
placement_aggregates.create(checkfirst=True)
|
@@ -371,6 +371,17 @@ class ResourceProviderAggregate(API_BASE):
|
|||||||
aggregate_id = Column(Integer, primary_key=True, nullable=False)
|
aggregate_id = Column(Integer, primary_key=True, nullable=False)
|
||||||
|
|
||||||
|
|
||||||
|
class PlacementAggregate(API_BASE):
|
||||||
|
"""A grouping of resource providers."""
|
||||||
|
__tablename__ = 'placement_aggregates'
|
||||||
|
__table_args__ = (
|
||||||
|
schema.UniqueConstraint("uuid", name="uniq_placement_aggregates0uuid"),
|
||||||
|
)
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
|
uuid = Column(String(36), index=True)
|
||||||
|
|
||||||
|
|
||||||
class InstanceGroupMember(API_BASE):
|
class InstanceGroupMember(API_BASE):
|
||||||
"""Represents the members for an instance group."""
|
"""Represents the members for an instance group."""
|
||||||
__tablename__ = 'instance_group_member'
|
__tablename__ = 'instance_group_member'
|
||||||
|
Reference in New Issue
Block a user