Skip to content

[proof of concept:] Squash v8 migrations together#12361

Draft
jacobtylerwalls wants to merge 4 commits intodev/8.0.xfrom
jtw/poc-squash
Draft

[proof of concept:] Squash v8 migrations together#12361
jacobtylerwalls wants to merge 4 commits intodev/8.0.xfrom
jtw/poc-squash

Conversation

@jacobtylerwalls
Copy link
Member

@jacobtylerwalls jacobtylerwalls commented Aug 6, 2025

Discussed yesterday w/ @bferguso, @chiatt, and @robgaston. We could consider squashing migrations for a release, e.g. a single migration to get to v8. Since v8 is already out, we'd want to only remove the replaced migrations in v9.

Runs slightly faster on my mac (1.8s vs. 2.2s).

Steps I took

  1. python3 manage.py squashmigrations models 9053_add_future_graphs 12009_language_single_default_language
  2. Observe listed RunPython operations at top with manual porting required.
  3. Evaluate whether any can be marked elidable=True to mark them for skipping
  4. Marked the RunPython(create_draft_graphs, remove_draft_graphs) as elidable=True since we later made draft graphs optional, but if this assumption is wrong please say
  5. Re-ran step 1
  6. Copy/pasted the remaining RunPython operations and their imports
  7. Tested forward, reverse, and forward again migrations
  8. Removed some reverse RunPython operations that failed with "pending trigger events" messages, see f103b45
  9. Reordered an AddConstraint operations before a RunPython that created grouping nodes, see 046a4b1
  10. Remamed the migration v8
  11. ran black on it

This was about an hour of effort.

@jacobtylerwalls jacobtylerwalls requested a review from chiatt August 20, 2025 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant