diff --git a/lib/mix/tasks/music_library/prod/db_migrate.ex b/lib/mix/tasks/music_library/prod/db_migrate.ex new file mode 100644 index 00000000..0edbe293 --- /dev/null +++ b/lib/mix/tasks/music_library/prod/db_migrate.ex @@ -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