Add mix task to migrate the production database

This commit is contained in:
Claudio Ortolina
2024-10-15 17:06:40 +01:00
parent d3b0057dea
commit 5ee98d5e07
@@ -0,0 +1,16 @@
defmodule Mix.Tasks.MusicLibrary.Prod.DbMigrate do
use Mix.Task
@shortdoc "Run migrations on the production database"
@moduledoc """
Run migrations on the production database.
Requires the `flyctl` CLI to be installed and authenticated.
"""
@impl Mix.Task
def run(_args) do
IO.puts("Running migrations on production database")
System.cmd("flyctl", ["ssh", "console", "--command", "bin/migrate"], into: IO.stream())
end
end