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

Merged
merged 2 commits into from
Jan 6, 2025
Merged

Squash Django migrations (step 1) #8701

merged 2 commits into from
Jan 6, 2025

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.

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.
chosak added 2 commits January 6, 2025 08:18
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 chosak force-pushed the feature/squash-migrations branch from d03d5b1 to df6b9a0 Compare January 6, 2025 13:21
@chosak chosak added this pull request to the merge queue Jan 6, 2025
Merged via the queue into main with commit ed51559 Jan 6, 2025
17 checks passed
@chosak chosak deleted the feature/squash-migrations branch January 6, 2025 14:59
chosak added a commit to chosak/consumerfinance.gov that referenced this pull request Jan 6, 2025
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.
chosak added a commit that referenced this pull request Jan 6, 2025
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 #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.

2 participants