Skip to content

Squash migrations for better performance #5015

Closed

Description

@matmair

We currently ship a lot of migrations that are run in order; even on new instances. I suggest shipping 1.0 with squashed migrations and removing the old migrations with the next version. There would need to be a check that versions below 0.x can not be upgraded to a version > 1.x

Activity

  1. added
    CI
    setup
    on Jun 14, 2023
  2. added this to the 1.0.0 milestone on Jun 14, 2023
  3. matmair commented on Jun 14, 2023

    @matmair
    MemberAuthor

    I made a POC of how that could look like. For this to happen we need at least a week or so of database change freeze to
    a) make the patch (will take a few hours probably)
    b) have the change running for a few days to be sure it does not destroy instance

  4. SchrodingersGat commented on Jun 15, 2023

    @SchrodingersGat
    Member

    @matmair that looks nice, I was expecting we'd have to have a breaking change here but, if I read it correctly, this is a "drop in" replacement for an existing setup?

    I'd like to ensure we have #4973 working before this point

  5. matmair commented on Jun 15, 2023

    @matmair
    MemberAuthor

    @SchrodingersGat yes, that is the idea. Will speed up startups as well in my experience.

  6. matmair commented on Dec 26, 2024

    @matmair
    MemberAuthor

    @SchrodingersGat I would start working on this if there are no objections. Is this clear to go?

  7. removed this from the 1.0.0 milestone on Dec 26, 2024
  8. SchrodingersGat commented on Dec 26, 2024

    @SchrodingersGat
    Member

    @matmair sounds good :) We will have to treat this one very carefully

  9. self-assigned this
    on Feb 14, 2025
  10. github-actions commented on Apr 15, 2025

    @github-actions
    Contributor

    This issue seems stale. Please react to show this is still important.

  11. added
    inactive
    on Apr 15, 2025
  12. removed
    inactive
    on Apr 15, 2025
  13. added this to the 1.0.0 milestone on Jun 12, 2025
  14. added a commit that references this issue on Jun 24, 2025
    59444b2
  15. modified the milestones: 1.0.0, 2.0.0 on Jul 2, 2025
  16. changed the title [-]Squash migrations for 1.0[/-] [+]Squash migrations for better performance[/+] on Jul 2, 2025
  17. matmair commented on Jul 2, 2025

    @matmair
    MemberAuthor

    Full transparency: I did not get this working in 4 or 5 attempts due to circular import issue and wired postgres warnings.
    Maybe we need to simplify a few dependencies between apps and start out fresh with something like https://django-remake-migrations.readthedocs.io

  18. SchrodingersGat commented on Jul 4, 2025

    @SchrodingersGat
    Member

    Yes it's a tough one for sure. Let's reconsider, it's still "workable" even if there are performance improvements to be had.

  19. SchrodingersGat commented on Sep 9, 2026

    @SchrodingersGat
    Member

    New attempt in #12830

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CIrefactorsetup

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions