Custom migration operations are rewritten incorrectly
|Reported by:||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.
Change History (13)
comment:1 Changed 2 years ago by schinckel
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:3 Changed 2 years ago by bmispelon
- Needs tests set
- Triage Stage changed from Unreviewed to Accepted
Changed 2 years ago by schinckel
comment:11 Changed 2 years ago by Tim Graham <timograham@…>
- Resolution set to fixed
- Status changed from new to closed