Opened 10 years ago
Closed 10 years ago
#23471 closed Bug (invalid)
makemigrations fails if you take out a function used in a previous migration
Reported by: | Daniel Samuels | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 1.7 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In a previous migration I was using a method to determine the default value for a model field, that code was then changed and the method removed, but I am no longer able to use makemigrations
because it tries to call that method. The same thing happens if you were using a custom model field and then change to a different one and remove the old code. To get around this, you either have to modify the migration files manually, or keep the old code in until you have at least run a makemigrations, not sure if you have to keep it indefinitely.
Yes, this is documented. https://docs.djangoproject.com/en/dev/topics/migrations/#historical-models