diff options
| author | Brian Waldon <bcwaldon@gmail.com> | 2012-02-16 16:26:49 -0800 |
|---|---|---|
| committer | Brian Waldon <bcwaldon@gmail.com> | 2012-02-16 16:34:50 -0800 |
| commit | e35cc0baed1024cdf7663e144a28e06c1f4e5d2e (patch) | |
| tree | 4473c5e56068bed8ef01cef659d16c7699237328 /nova/db | |
| parent | 844035b6c0f725c685cdff56a7bb77efe7825a5f (diff) | |
| download | nova-e35cc0baed1024cdf7663e144a28e06c1f4e5d2e.tar.gz nova-e35cc0baed1024cdf7663e144a28e06c1f4e5d2e.tar.xz nova-e35cc0baed1024cdf7663e144a28e06c1f4e5d2e.zip | |
Remove all uniqueness constraints in migration 76
Fixes bug 932867
Change-Id: I5b72af7c36cc07ee4f3e23566ed4e91c0c53b10b
Diffstat (limited to 'nova/db')
| -rw-r--r-- | nova/db/sqlalchemy/migrate_repo/versions/076_remove_unique_constraints.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/nova/db/sqlalchemy/migrate_repo/versions/076_remove_unique_constraints.py b/nova/db/sqlalchemy/migrate_repo/versions/076_remove_unique_constraints.py index ef8b5d8e8..9d3bebbdc 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/076_remove_unique_constraints.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/076_remove_unique_constraints.py @@ -29,13 +29,13 @@ def _get_constraint_names(engine_name): # mysql and postgres. if engine_name == "mysql": return { - "instance_types_name": "name", + "instance_types_name": ("name", "instance_types_name_key"), "instance_types_flavorid": "instance_types_flavorid_str_key", "volume_types_name": "name", } else: return { - "instance_types_name": "instance_types_name_key", + "instance_types_name": ("instance_types_name_key",), "instance_types_flavorid": "instance_types_flavorid_str_key", "volume_types_name": "volume_types_name_key", } @@ -46,10 +46,11 @@ def upgrade(migrate_engine): c_names = _get_constraint_names(migrate_engine.name) table = Table('instance_types', meta, autoload=True) - cons = UniqueConstraint('name', - name=c_names['instance_types_name'], - table=table) - cons.drop() + for constraint_name in c_names['instance_types_name']: + cons = UniqueConstraint('name', + name=constraint_name, + table=table) + cons.drop() cons = UniqueConstraint('flavorid', name=c_names['instance_types_flavorid'], table=table) @@ -66,10 +67,11 @@ def downgrade(migrate_engine): c_names = _get_constraint_names(migrate_engine.name) table = Table('instance_types', meta, autoload=True) - cons = UniqueConstraint('name', - name=c_names['instance_types_name'], - table=table) - cons.create() + for constraint_name in c_names['instance_types_name']: + cons = UniqueConstraint('name', + name=constraint_name, + table=table) + cons.create() table = Table('instance_types', meta, autoload=True) cons = UniqueConstraint('flavorid', name=c_names['instance_types_flavorid'], |
