Skip to content

Commit

Permalink
FK lookup failures during migration
Browse files Browse the repository at this point in the history
There are a couple of cases where migrations have failed
upgrading from Grizzly to Havana, this seems to be isolated
to a couple of migrations so far and the error message is a
failure to lookup/associate the volume-id FK dependency.

It appears that this is caused by not setting the charset
in the migration, so the result is that the initial db setup
uses utf8 and the migrations are using the default latin1.

This patch goes through all of the migrations in Havana that
specify InnoDB and explicitly sets the charset to utf8 to match
the volumes table (and the other original tables).

Change-Id: I43b219ff5e4eea10a7391ad65ef68a80b7460370
Closes-Bug: #1233861
(cherry picked from commit 645a84f)
  • Loading branch information
j-griffith committed Oct 15, 2013
1 parent 2d8ad0d commit 5e489f4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
Expand Up @@ -40,7 +40,8 @@ def upgrade(migrate_engine):
Column('salt', String(length=255)),
Column('crypt_hash', String(length=255)),
Column('expires_at', DateTime(timezone=False)),
mysql_engine='InnoDB'
mysql_engine='InnoDB',
mysql_charset='utf8'
)

try:
Expand Down
Expand Up @@ -53,7 +53,8 @@ def downgrade(migrate_engine):
Column('new_instance_type_id', Integer),
Column('instance_uuid', String(length=255), nullable=True),
Column('status', String(length=255)),
mysql_engine='InnoDB'
mysql_engine='InnoDB',
mysql_charset='utf8'
)

try:
Expand Down
Expand Up @@ -59,7 +59,8 @@ def downgrade(migrate_engine):
Column('sr_uuid', String(length=255)),
Column('sr_type', String(length=255)),
Column('config_params', String(length=2047)),
mysql_engine='InnoDB'
mysql_engine='InnoDB',
mysql_charset='utf8'
)

sm_flavors = Table(
Expand All @@ -71,7 +72,8 @@ def downgrade(migrate_engine):
Column('id', Integer, primary_key=True, nullable=False),
Column('label', String(length=255)),
Column('description', String(length=255)),
mysql_engine='InnoDB'
mysql_engine='InnoDB',
mysql_charset='utf8'
)

sm_volume = Table(
Expand All @@ -87,7 +89,8 @@ def downgrade(migrate_engine):
Column('backend_id', Integer, ForeignKey('sm_backend_config.id'),
nullable=False),
Column('vdi_uuid', String(length=255)),
mysql_engine='InnoDB'
mysql_engine='InnoDB',
mysql_charset='utf8'
)

tables = [sm_flavors, sm_backend_config, sm_volume]
Expand Down
Expand Up @@ -74,7 +74,8 @@ def upgrade(migrate_engine):
Column('volume_type_id', String(length=36),
ForeignKey(volume_types.c.id),
primary_key=True, nullable=False),
mysql_engine='InnoDB'
mysql_engine='InnoDB',
mysql_charset='utf8'
)

try:
Expand Down
Expand Up @@ -40,7 +40,8 @@ def upgrade(migrate_engine):
ForeignKey('quality_of_service_specs.id')),
Column('key', String(255)),
Column('value', String(255)),
mysql_engine='InnoDB'
mysql_engine='InnoDB',
mysql_charset='utf8'
)

try:
Expand Down
Expand Up @@ -38,7 +38,8 @@ def upgrade(migrate_engine):
nullable=False),
Column('key', String(length=255)),
Column('value', String(length=255)),
mysql_engine='InnoDB'
mysql_engine='InnoDB',
mysql_charset='utf8'
)

try:
Expand Down

0 comments on commit 5e489f4

Please sign in to comment.