Opened 11 years ago
Closed 4 years ago
#23953 closed Cleanup/optimization (fixed)
makemigrations generates "wrong" numbered migration file if squashed migrations are in place
| Reported by: | Markus Holtermann | Owned by: | Jacob Walls |
|---|---|---|---|
| Component: | Migrations | Version: | 1.7 |
| Severity: | Normal | Keywords: | |
| Cc: | Markus Holtermann | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
When an app has migrations 0001_initial and 0002_auto_20141202_1234 that are squashed to 0001_squashed_0002_auto_20141202_1234, a new call to makemigrations will generate a migration file called 0002_auto_20141202_2345 instead of 0003_auto_20141202_2345 which is quite irritating as long as 0002_auto_20141202_1234 is still around. It does make sense though when only 0001_squashed_0002_auto_20141202_1234 is left.
Although the latter case eventually hits every project, I'd prefer the former.
Change History (9)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
I don't think so. The squashed migration replaces 0001 to 0002, so sticking to 0001 seems fine to me.
Rethinking the initial thought about 0002_auto_20141202_2345 making sense if 0002_auto_20141202_1234 is gone an only the squashed migration is around: no, it doesn't make sense. The squashed migration says "0001 to 0002 is squashed". Thus continuing with 0003 seems to be the right choice.
comment:3 by , 11 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
I guess it makes sense. If there is no way to reset the sequence of migrations, I wonder what happens when app has 10K migrations.
comment:4 by , 4 years ago
| Easy pickings: | set |
|---|---|
| Has patch: | set |
| Owner: | changed from to |
| Status: | new → assigned |
comment:5 by , 4 years ago
| Patch needs improvement: | set |
|---|
comment:6 by , 4 years ago
| Patch needs improvement: | unset |
|---|
Thanks for speedy review. Of course let me know if this is moving in the wrong direction. Thanks.
comment:7 by , 4 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Based on your logic, is it irritating to have
0001_initialand0001_squashed_0002_auto_20141202_1234? Should the first squashed migration be0003_...?