Merge "Fix db migration 12"

This commit is contained in:
Jenkins 2012-04-09 14:54:04 +00:00 committed by Gerrit Code Review
commit 6999c60d77
2 changed files with 16 additions and 9 deletions

View File

@ -52,6 +52,7 @@ Rick Clark <rick@openstack.org>
Rick Harris <rconradharris@gmail.com>
Reynolds Chin <benzwt@gmail.com>
Russell Bryant <rbryant@redhat.com>
Sam Morrison <sorrison@gmail.com>
Soren Hansen <soren.hansen@rackspace.com>
Stuart McLaren <stuart.mclaren@hp.com>
Taku Fukushima <tfukushima@dcl.info.waseda.ac.jp>

View File

@ -225,18 +225,24 @@ def _get_table(table_name, metadata):
def _get_foreign_keys(t_images, t_image_members, t_image_properties):
"""Retrieve and return foreign keys for members/properties tables."""
image_members_fk_name = list(t_image_members.foreign_keys)[0].name
image_properties_fk_name = list(t_image_properties.foreign_keys)[0].name
foreign_keys = []
if t_image_members.foreign_keys:
img_members_fk_name = list(t_image_members.foreign_keys)[0].name
fk1 = migrate.ForeignKeyConstraint([t_image_members.c.image_id],
[t_images.c.id],
name=image_members_fk_name)
name=img_members_fk_name)
foreign_keys.append(fk1)
if t_image_properties.foreign_keys:
img_properties_fk_name = list(t_image_properties.foreign_keys)[0].name
fk2 = migrate.ForeignKeyConstraint([t_image_properties.c.image_id],
[t_images.c.id],
name=image_properties_fk_name)
name=img_properties_fk_name)
foreign_keys.append(fk2)
return fk1, fk2
return foreign_keys
def _update_all_ids_to_uuids(t_images, t_image_members, t_image_properties):