localspot/lib/localspot/release.ex
Kevin Sivic 8d9194b398
Some checks failed
CI - Test, Build, and Push / test (push) Failing after 1s
CI - Test, Build, and Push / build-and-push (push) Has been skipped
Add Forgejo CI workflow and Docker build
- Add Dockerfile for Phoenix release builds
- Add .dockerignore to optimize build context
- Add Forgejo workflow that runs tests then builds/pushes Docker image
- Update test config to support DATABASE_URL for CI
- Add release.ex and rel/ overlay scripts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 08:15:20 -05:00

30 lines
711 B
Elixir

defmodule Localspot.Release do
@moduledoc """
Used for executing DB release tasks when run in production without Mix
installed.
"""
@app :localspot
def migrate do
load_app()
for repo <- repos() do
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true))
end
end
def rollback(repo, version) do
load_app()
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version))
end
defp repos do
Application.fetch_env!(@app, :ecto_repos)
end
defp load_app do
# Many platforms require SSL when connecting to the database
Application.ensure_all_started(:ssl)
Application.ensure_loaded(@app)
end
end