I'd like to solve the problem of running Safe.after_deploy afterwards where I’m waiting to confirm a problem didn’t occur first. In these cases, I tend to forget to migrate those commands so I’d like to automate it.
One idea is to have a new model that tracks when a migration is detected. Then create a new management command that would need to be called periodically that would use a timedelta on the Safe.after_deploy migrations to determine which migrations can be migrated in the background.
From Ryan:
I can imagine this including some configuration in the migration itself to determine what kind of mandatory delay is required before running it. That kinda sounds like it could be a workable idea. What if we
make a post_migrate signal receiver to notice when it's first seen and marked as "ready" (not blocked) by safemigrate .
have the pre_migrate signal compare the required delay and the (possible) record in the database to see if it's ready to go. If so, it would automatically convert to an always.
Maybe the new marking could something like
safe = timedelta(days=7)
That would avoid a new property. It would be an alternative to Safe.after_deploy. It doesn't generalize nicely, since there's no good meaning in that data type that would map to "before_deploy only" that I can see just yet.
Continuing on that thread, maybe we go with safe = Safe.after_deploy(delay=timedelta(days=7)) to maintain consistency and avoid a typecheck.
I'd like to solve the problem of running Safe.after_deploy afterwards where I’m waiting to confirm a problem didn’t occur first. In these cases, I tend to forget to migrate those commands so I’d like to automate it.
One idea is to have a new model that tracks when a migration is detected. Then create a new management command that would need to be called periodically that would use a
timedelta
on theSafe.after_deploy
migrations to determine which migrations can be migrated in the background.From Ryan:
Continuing on that thread, maybe we go with
safe = Safe.after_deploy(delay=timedelta(days=7))
to maintain consistency and avoid a typecheck.