Fix Tuskar Migration on MySQL

The order of the table creation is incorrect as it attempts to
create a foriegn key to a table that doesn't exist yet. This will fail
when MySQL is running in stricter operational modes. This will never
work in other, good databases.

Change-Id: Ibedee71c9a8d02518b6c812124d4a4c0ed382fa5
This commit is contained in:
Dougal Matthews 2014-09-09 10:40:53 +01:00
parent 785582b8f0
commit ea838d2980

View File

@ -44,6 +44,19 @@ def upgrade(migrate_engine):
mysql_charset=CHARSET,
)
overcloud = Table(
'overclouds',
meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('name', String(length=models.LENGTH_NAME), unique=True),
Column('description', String(length=models.LENGTH_DESCRIPTION)),
Column('stack_id', String(length=36)),
Column('created_at', DateTime),
Column('updated_at', DateTime),
mysql_engine=ENGINE,
mysql_charset=CHARSET,
)
overcloud_role_counts = Table(
'overcloud_role_counts',
meta,
@ -63,19 +76,6 @@ def upgrade(migrate_engine):
mysql_charset=CHARSET,
)
overcloud = Table(
'overclouds',
meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('name', String(length=models.LENGTH_NAME), unique=True),
Column('description', String(length=models.LENGTH_DESCRIPTION)),
Column('stack_id', String(length=36)),
Column('created_at', DateTime),
Column('updated_at', DateTime),
mysql_engine=ENGINE,
mysql_charset=CHARSET,
)
overcloud_attributes = Table(
'overcloud_attributes',
meta,
@ -92,8 +92,8 @@ def upgrade(migrate_engine):
mysql_charset=CHARSET,
)
tables = [overcloud_roles, overcloud_role_counts,
overcloud, overcloud_attributes]
tables = [overcloud_roles, overcloud, overcloud_role_counts,
overcloud_attributes]
for table in tables:
try: