Add disabled column to cell_mappings table.
This column has been added to the cell_mappings table since it is required to represent if a cell is enabled or disabled as a part of the cell-disable spec. Related to blueprint cell-disable Change-Id: Ibeddcb9a93c180f74727431b0579308c400436db
This commit is contained in:
parent
9e745f401e
commit
f9743f0c2a
|
@ -0,0 +1,26 @@
|
|||
# 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.
|
||||
|
||||
from sqlalchemy import Boolean
|
||||
from sqlalchemy import Column
|
||||
from sqlalchemy import MetaData
|
||||
from sqlalchemy import Table
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
meta = MetaData()
|
||||
meta.bind = migrate_engine
|
||||
|
||||
cell_mappings = Table('cell_mappings', meta, autoload=True)
|
||||
|
||||
if not hasattr(cell_mappings.c, 'disabled'):
|
||||
cell_mappings.create_column(Column('disabled', Boolean, default=False))
|
|
@ -117,6 +117,7 @@ class CellMapping(API_BASE):
|
|||
name = Column(String(255))
|
||||
transport_url = Column(Text())
|
||||
database_connection = Column(Text())
|
||||
disabled = Column(Boolean, default=False)
|
||||
host_mapping = orm.relationship('HostMapping',
|
||||
backref=backref('cell_mapping', uselist=False),
|
||||
foreign_keys=id,
|
||||
|
|
|
@ -686,6 +686,9 @@ class NovaAPIMigrationsWalk(test_migrations.WalkVersionsMixin):
|
|||
db_spec = jsonutils.loads(from_db_request_spec['spec'])
|
||||
self.assertDictEqual(expected_spec, db_spec)
|
||||
|
||||
def _check_058(self, engine, data):
|
||||
self.assertColumnExists(engine, 'cell_mappings', 'disabled')
|
||||
|
||||
|
||||
class TestNovaAPIMigrationsWalkSQLite(NovaAPIMigrationsWalk,
|
||||
test_base.DbTestCase,
|
||||
|
|
Loading…
Reference in New Issue