-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
a41cebe
commit f789884
Showing
8 changed files
with
339 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ db.sqlite3 | |
htmlcov/ | ||
dist/ | ||
.tox/ | ||
/venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.