Add release script
All checks were successful
build / build (push) Successful in 28s

This commit is contained in:
James Greenwood 2025-11-17 09:27:28 +00:00
parent e19286d0e6
commit 0f56a13bd8

View File

@ -0,0 +1,28 @@
defmodule ActionRequestsDemo.Release do
@moduledoc """
Helpers for running tasks in a release environment.
This module is intended for commands invoked via:
bin/action_requests_demo eval "ActionRequestsDemo.Release.seed()"
"""
@app :action_requests_demo
@doc """
Run the database seeds script inside a release.
Ensures the main application and Faker are started, then evaluates
the standard `priv/repo/seeds.exs` file.
"""
def seed do
# Make sure the application (and its supervision tree) is running
{:ok, _} = Application.ensure_all_started(@app)
{:ok, _} = Application.ensure_all_started(:faker)
seeds_path = Application.app_dir(@app, "priv/repo/seeds.exs")
Code.require_file(seeds_path)
end
end