From bb5bc6a186fdcdf25db4869732b24d003760a75d Mon Sep 17 00:00:00 2001 From: David Ripton Date: Wed, 8 May 2013 11:36:05 -0400 Subject: [PATCH] Change type of cells.deleted from boolean to integer. Fixes bug #1168490 Migration 152 changed other tables' deleted column from boolean to integer, but cells got missed. SQLite and MySQL are weakly- typed enough that mixing integers and booleans is allowed, but PostgreSQL is not, and this causes an error. Migration 179 is a copy of migration 152, except applied only to the cells table. Change-Id: I85c39765edc206d38d21827ab54e1371155b9557 --- nova/tests/test_migrations.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/nova/tests/test_migrations.py b/nova/tests/test_migrations.py index a0f71b25..d03e1816 100644 --- a/nova/tests/test_migrations.py +++ b/nova/tests/test_migrations.py @@ -1315,6 +1315,25 @@ class TestNovaMigrations(BaseMigrationTestCase, CommonTestsMixIn): floating_ips.insert().execute, dict(address='128.128.128.129', deleted=0)) + # migration 179 - convert cells.deleted from boolean to int + def _pre_upgrade_179(self, engine): + cells_data = [ + {'id': 4, 'deleted': True}, + {'id': 5, 'deleted': False}, + ] + + cells = get_table(engine, 'cells') + engine.execute(cells.insert(), cells_data) + + return dict(cells=cells_data) + + def _check_179(self, engine, data): + cells = get_table(engine, 'cells') + cell = cells.select(cells.c.id == 4).execute().first() + self.assertEqual(4, cell.deleted) + cell = cells.select(cells.c.id == 5).execute().first() + self.assertEqual(0, cell.deleted) + class TestBaremetalMigrations(BaseMigrationTestCase, CommonTestsMixIn): """Test sqlalchemy-migrate migrations."""