glance/glance/db
Wayne Okuma 5369e86e8d Glance metadef tables need unique constraints.
Sometime during Kilo, the unique constraints on
metadef_namespaces (namespace)
metadef_objects(namespace_id, name)
metadef_properties(namespace_id, name)
metadef_tags(namespace_id, name)
metadef_resource_types(name)
were replaced with non-unique indices.

I believe this was done erroneously to make the migrate_repo/versions/scripts
match the db/sqlalchemy/models_metadef.py definitions. Unfortunately, the
schema scripts were correct with the unique constraints and what should have
changed was models_metadef.py.

This bug, puts one more migrate script in place which will rename any
duplicate records it finds to make them unique and then re-establishes
the unique constraints while dropping the non-unique indices. It also,
fixes models_metadef.py and adds in tests to attempt to create duplicates
which should result in an HTTPConflict.

Change-Id: Idf3569a27d64abea3ed6ec92fb77b36a4d6d5fd5
Closes-Bug: 1468946
2015-09-02 22:32:29 -07:00
..
registry Change generic NotFound to ImageNotFound exception 2015-05-30 08:18:33 -07:00
simple Don't use slashes for long lines - use parentheses instead 2015-08-16 07:21:13 +00:00
sqlalchemy Glance metadef tables need unique constraints. 2015-09-02 22:32:29 -07:00
__init__.py Merge "Change generic NotFound to ImageNotFound exception" 2015-06-25 05:20:12 +00:00
metadata.py Provide a way to upgrade metadata definitions 2015-03-12 00:26:16 -04:00
migration.py Fix existing migrations to create utf-8 tables for MySQL DB 2015-07-29 22:20:28 -07:00