Merge "Add queued for delete to instance_mappings table."

This commit is contained in:
Zuul
2018-07-11 21:32:30 +00:00
committed by Gerrit Code Review
3 changed files with 32 additions and 0 deletions
@@ -0,0 +1,27 @@
# 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
instance_mappings = Table('instance_mappings', meta, autoload=True)
if not hasattr(instance_mappings.c, 'queued_for_delete'):
instance_mappings.create_column(Column('queued_for_delete', Boolean,
default=False))
+1
View File
@@ -141,6 +141,7 @@ class InstanceMapping(API_BASE):
cell_id = Column(Integer, ForeignKey('cell_mappings.id'),
nullable=True)
project_id = Column(String(255), nullable=False)
queued_for_delete = Column(Boolean, default=False)
cell_mapping = orm.relationship('CellMapping',
backref=backref('instance_mapping', uselist=False),
foreign_keys=cell_id,
@@ -716,6 +716,10 @@ class NovaAPIMigrationsWalk(test_migrations.WalkVersionsMixin):
def _check_060(self, engine, data):
self.assertColumnExists(engine, 'instance_group_policy', 'rules')
def _check_061(self, engine, data):
self.assertColumnExists(engine, 'instance_mappings',
'queued_for_delete')
class TestNovaAPIMigrationsWalkSQLite(NovaAPIMigrationsWalk,
test_base.DbTestCase,