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
This commit is contained in:
David Ripton
2013-05-08 11:36:05 -04:00
parent 0b4acfcfd8
commit bb5bc6a186

View File

@@ -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."""