Skip to content

Commit

Permalink
Fix heal_script for MySQL specifics
Browse files Browse the repository at this point in the history
After running upgrade head->downgrade havana->upgrade head
on MySQL heal_script fails with several mistakes.

This change fix them. More details in related bug description.

Closes-bug: #1354218

Change-Id: I91cb21c4bc744f240bfb8bc6b2ed24b6e01f6095
  • Loading branch information
AKamyshnikova committed Aug 26, 2014
1 parent 921611c commit 661e3ec
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions neutron/db/migration/alembic_migrations/heal_script.py
Expand Up @@ -103,12 +103,12 @@ def parse_modify_command(command):
# autoincrement=None, existing_type=None,
# existing_server_default=False, existing_nullable=None,
# existing_autoincrement=None, schema=None, **kw)
bind = op.get_bind()
for modified, schema, table, column, existing, old, new in command:
if modified.endswith('type'):
modified = 'type_'
elif modified.endswith('nullable'):
modified = 'nullable'
bind = op.get_bind()
insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind)
if column in insp.get_primary_keys(table) and new:
return
Expand All @@ -122,8 +122,7 @@ def parse_modify_command(command):
if isinstance(default.arg, basestring):
existing['existing_server_default'] = default.arg
else:
existing['existing_server_default'] = default.arg.compile(
dialect=bind.engine.name)
existing['existing_server_default'] = default.arg.text
kwargs.update(existing)
op.alter_column(table, column, **kwargs)

Expand Down

0 comments on commit 661e3ec

Please sign in to comment.