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

Refactor and add backward compatibility #59

Closed
wants to merge 1 commit into from
Closed

Commits on Jul 22, 2024

  1. Refactor and add backward compatibility

    The refactor is significant. It needed to reorder operations to
    allow for calculating safety configuration and delays, but along
    the way cleaned up naming, the default configuration, and the
    categories calculated and output to the user.
    
    Rename the internal enums and enum items. Call the enum that
    represents the run mode of "strict", "nonstrict", or "disabled"
    Mode, with PEP8 compliant names of STRICT, NONSTRICT, and DISABLED.
    Call the enum that represents the when each migration is allowed
    to run When, with names of BEFORE_DEPLOY, AFTER_DEPLOY, and ALWAYS.
    
    Factor out the loops that walk the dependency tree to categorize
    the migrations into ready, delayed, and blocked. Remove the
    category of "protected" migrations and combine it with delayed.
    
    Refactor the model manager into a model queryset, and separate
    filtering the queryset from resolving the final data type.
    
    Only write and read SafeMigration records for migrations that are
    after_deploy and have a delay set.
    
    Only write SafeMigration records for migrations that are delayed,
    not blocked or ready, to preserve appropriate semantics for
    nonstrict mode.
    
    Special-case Safe.before_deploy, Safe.after_deploy, and Safe.always
    to be allowed as callables for backward compatiblity.
    
    Categorize ``Safe.after_deploy`` and ``Safe.always`` migrations as
    blocked if they depend on other blocked migrations. The earliest
    blocked migrations must still be a ``Safe.before_deploy`` migration
    that depends on a ``Safe.after_deploy`` migration.
    
    Change the default safe marking from ``Safe.after_deploy`` to
    ``Safe.always``, to be more reasonable for working with third-party
    apps that do not use django-safemigrate.
    ryanhiebert committed Jul 22, 2024
    Configuration menu
    Copy the full SHA
    0d72346 View commit details
    Browse the repository at this point in the history