summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Pavlovic <boris@pavlovic.me>2013-05-13 14:57:04 +0400
committerBoris Pavlovic <boris@pavlovic.me>2013-05-24 14:57:45 +0400
commit3f2f118fa4c03d9e120918afdc59472dedf9a02e (patch)
tree612fd6b33b65069e771e20ef0c127f72dddf70dc
parent356782e040ad3a7b328258fa24398a4590c657ed (diff)
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
-rw-r--r--nova/db/sqlalchemy/migrate_repo/versions/181_fix_179_migration_sync_shadow_table.py28
-rw-r--r--nova/tests/test_migrations.py3
2 files changed, 31 insertions, 0 deletions
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."""