Custom migration operations are rewritten incorrectly
|Reported by:||Matthew Schinckel||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I've written a custom migration operation, and was in the process of writing a management command to write a migration file, using the MigrationWriter class.
It's almost all perfect, except that the MigrationWriter class assumes that the migration operation will be in django.db.migrations:
I suspect that the MigrationWriter will also be used for things like squashing migrations, so this problem may appear with custom migration operations then.
I suggest that it should inspect the migration operation, and if it's not in the
django.db.migrations module, add the relevant module to the imports, and use the correct path for the operation.