❓ How can I run a migration task once if I have multiple app containers?
owen-marit
PROOP

6 months ago

I have multiple apps and have a pre-deploy, but don't want both services to run the pre-deploy task (otherwise could have migrations colliding with one another)

Even if I have a separate container, how would I orchestrate it so the container with the migration run first?

Solved$20 Bounty

7 Replies

owen-marit
PROOP

6 months ago

Use Cursor.sh and it came up with a clever way to use Database Advisory Locks.


owen-marit
PROOP

6 months ago

Here's the script

1410873970936512512


6 months ago

To clarify @Mint Avenger , did that script solve your issue or are you still looking for a solution?


6 months ago

If you’re using GitHub Actions, you can handle migrations there and configure each service to toggle Wait for CI.


owen-marit
PROOP

6 months ago

That script solved my issue. It handles multiple containers trying to migrate.


6 months ago

Wonderful.


6 months ago

!s


Status changed to Solved noahd 6 months ago


Loading...