diff --git a/Authors b/Authors index 8158c2a874..d9c9302486 100644 --- a/Authors +++ b/Authors @@ -52,6 +52,7 @@ Rick Clark Rick Harris Reynolds Chin Russell Bryant +Sam Morrison Soren Hansen Stuart McLaren Taku Fukushima diff --git a/glance/registry/db/migrate_repo/versions/012_id_to_uuid.py b/glance/registry/db/migrate_repo/versions/012_id_to_uuid.py index fe6bf867c9..8db18c14ba 100644 --- a/glance/registry/db/migrate_repo/versions/012_id_to_uuid.py +++ b/glance/registry/db/migrate_repo/versions/012_id_to_uuid.py @@ -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) + fk1 = migrate.ForeignKeyConstraint([t_image_members.c.image_id], + [t_images.c.id], + name=img_members_fk_name) + foreign_keys.append(fk1) - fk2 = migrate.ForeignKeyConstraint([t_image_properties.c.image_id], - [t_images.c.id], - name=image_properties_fk_name) + if t_image_properties.foreign_keys: + img_properties_fk_name = list(t_image_properties.foreign_keys)[0].name - return fk1, fk2 + fk2 = migrate.ForeignKeyConstraint([t_image_properties.c.image_id], + [t_images.c.id], + name=img_properties_fk_name) + foreign_keys.append(fk2) + + return foreign_keys def _update_all_ids_to_uuids(t_images, t_image_members, t_image_properties):