The SQLAlchemy MySQL dialect generates implicit indexes
in the less-common case of an integer column within a composite
primary key where autoincrement is not set to False.
Add a rule to ignore these indexes when performing
autogenerate against a target database.
Change-Id: I49abb3f7ad9731cde046fa2862cdb9ec16c3aeb3
Partially-Implements: blueprint online-schema-migrations
model_base.BASEV2.__table_args__['mysql_engine'])
-def include_object(object, name, type_, reflected, compare_to):
+def include_object(object_, name, type_, reflected, compare_to):
if type_ == 'table' and name in external.TABLES:
return False
+ elif type_ == 'index' and reflected and name.startswith("idx_autoinc_"):
+ # skip indexes created by SQLAlchemy autoincrement=True
+ # on composite PK integer columns
+ return False
else:
return True