From 3f2f118fa4c03d9e120918afdc59472dedf9a02e Mon Sep 17 00:00:00 2001 From: Boris Pavlovic Date: Mon, 13 May 2013 14:57:04 +0400 Subject: Sync shadow table for 179 migration To be able to use db archiving our table and shadow table should have the same columns. fixes bug 1179497 Change-Id: I001f31a5efa07c80acd1ad513369456fb8c3cb44 --- .../181_fix_179_migration_sync_shadow_table.py | 28 ++++++++++++++++++++++ nova/tests/test_migrations.py | 3 +++ 2 files changed, 31 insertions(+) create mode 100644 nova/db/sqlalchemy/migrate_repo/versions/181_fix_179_migration_sync_shadow_table.py diff --git a/nova/db/sqlalchemy/migrate_repo/versions/181_fix_179_migration_sync_shadow_table.py b/nova/db/sqlalchemy/migrate_repo/versions/181_fix_179_migration_sync_shadow_table.py new file mode 100644 index 000000000..2e8af266d --- /dev/null +++ b/nova/db/sqlalchemy/migrate_repo/versions/181_fix_179_migration_sync_shadow_table.py @@ -0,0 +1,28 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2013 Mirantis, Inc. +# Copyright 2013 OpenStack Foundation +# +# 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. +# +# @author: Boris Pavlovic, Mirantis Inc + +from nova.db.sqlalchemy import utils + + +def upgrade(migrate_engine): + utils.change_deleted_column_type_to_id_type(migrate_engine, 'shadow_cells') + + +def downgrade(migrate_engine): + utils.change_deleted_column_type_to_boolean(migrate_engine, 'shadow_cells') diff --git a/nova/tests/test_migrations.py b/nova/tests/test_migrations.py index d78928790..da9e293a4 100644 --- a/nova/tests/test_migrations.py +++ b/nova/tests/test_migrations.py @@ -1332,6 +1332,9 @@ class TestNovaMigrations(BaseMigrationTestCase, CommonTestsMixIn): self.assertTrue(db_utils.check_shadow_table(engine, "volume_usage_cache")) + def _check_181(self, engine, data): + self.assertTrue(db_utils.check_shadow_table(engine, 'cells')) + class TestBaremetalMigrations(BaseMigrationTestCase, CommonTestsMixIn): """Test sqlalchemy-migrate migrations.""" -- cgit