from oslo_db.sqlalchemy import test_migrations
import sqlalchemy
from sqlalchemy import event
+import sqlalchemy.types as types
from neutron.api.v2 import attributes as attr
import neutron.db.migration as migration_help
def filter_metadata_diff(self, diff):
return list(filter(self.remove_unrelated_errors, diff))
+ # TODO(akamyshikova): remove this method as soon as comparison with Variant
+ # will be implemented in oslo.db or alembic
+ def compare_type(self, ctxt, insp_col, meta_col, insp_type, meta_type):
+ if isinstance(meta_type, types.Variant):
+ orig_type = meta_col.type
+ meta_col.type = meta_type.impl
+ try:
+ return self.compare_type(ctxt, insp_col, meta_col, insp_type,
+ meta_type.impl)
+ finally:
+ meta_col.type = orig_type
+ else:
+ ret = super(_TestModelsMigrations, self).compare_type(
+ ctxt, insp_col, meta_col, insp_type, meta_type)
+ if ret is not None:
+ return ret
+ return ctxt.impl.compare_type(insp_col, meta_col)
+
# Remove some difference that are not mistakes just specific of
# dialects, etc
def remove_unrelated_errors(self, element):