Skip to content

Commit

Permalink
Prefer the compatible API where equivalent
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhiebert committed Jul 26, 2024
1 parent 79a4860 commit 70350f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Pending
* Add support for Django 5.1.
* Drop support for Django 3.2, 4.0, 4.1.
* Convert ``Safe`` to be a custom class rather than an ``Enum``.
* The preferred values for ``safe`` are now methods:
* The standard values for ``safe`` are now methods that may be called:

* ``Safe.before_deploy()``
* ``Safe.after_deploy()``
Expand Down
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ such as a migration to add a column.
from django_safemigrate import Safe
class Migration(migrations.Migration):
safe = Safe.before_deploy()
safe = Safe.before_deploy
At this point you can run the ``safemigrate`` Django command
to run the migrations, and only these migrations will run.
Expand All @@ -66,7 +66,7 @@ Safety Options
There are three options for the value of the
``safe`` property of the migration.

* ``Safe.before_deploy()``
* ``Safe.before_deploy``

This migration is only safe to run before the code change is deployed.
For example, a migration that adds a new field to a model.
Expand All @@ -77,20 +77,20 @@ There are three options for the value of the
For example, a migration that removes a field from a model.

By specifying a ``delay`` parameter, you can specify when a
``Safe.after_deploy()`` migration can be run with the ``safemigrate``
``Safe.after_deploy`` migration can be run with the ``safemigrate``
command. For example, if it's desired to wait a week before applying
a migration, you can specify ``Safe.after_deploy(delay=timedelta(days=7))``.

The ``delay`` is used with the datetime when the migration is first detected.
The detection datetime is when the ``safemigrate`` command detects the
migration in a plan that successfully runs. If the migration plan is blocked,
such when a ``Safe.after_deploy(delay=None)`` is in front of a
``Safe.before_deploy()``, no migrations are marked as detected.
``Safe.before_deploy``, no migrations are marked as detected.

Note that a ``Safe.after_deploy()`` migration will not run the first
Note that a ``Safe.after_deploy`` migration will not run the first
time it's encountered.

* ``Safe.always()``
* ``Safe.always``

This migration is safe to run before *and* after
the code change is deployed.
Expand Down

0 comments on commit 70350f0

Please sign in to comment.