Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squash Django migrations (step 1) #8701

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

chosak
Copy link
Member

@chosak chosak commented Dec 26, 2024

This change squashes Django migrations for all Django apps with more than 3 migrations. See our internal squashing documentation here and Django's general docs on squashing here.

Migration squashing requires multiple steps:

  1. Commit squashed migrations, and deploy them.
  2. Delete migration files that were squashed, and remove "replaces" in
    the squashed migration files. Deploy this change.

This squashing removes some RunPython code that is only compatible with PostgreSQL; after this squash it will once again be possible to migrate a SQLite database.

This PR also updates our Postgres test database file to have the latest and squashed migrations.

This change squashes Django migrations for all Django apps with more
than 3 migrations. See our internal squashing documentation here [0]
and Django's general docs on squashing here [1].

Migration squashing requires multiple steps:

1. Commit squashed migrations, and deploy them.
2. Delete migration files that were squashed, and remove "replaces" in
the squashed migration files. Deploy this change.

This squashing removes some RunPython code that is only compatible with
PostgreSQL; after this squash it will once again be possible to migrate
a SQLite database.

[0] https://cfpb.github.io/consumerfinance.gov/migrations/#squashing-migrations
[1] https://docs.djangoproject.com/en/5.1/topics/migrations/#squashing-migrations
chosak added a commit to chosak/consumerfinance.gov that referenced this pull request Dec 30, 2024
These migrations include PostgreSQL-specific syntax and will not run
properly against SQLite. This commit temporarily comments them out.

A preferred solution is to squash these migrations away, which is
proposed in consumerfinance.gov cfpb#8701.
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