refactor: harden seed only once implementation
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/promote/production Build is passing

This commit is contained in:
Simon 2026-03-16 19:20:30 +01:00
parent c40f3135a1
commit 77012f10ca
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
6 changed files with 20 additions and 13 deletions

View file

@ -4,7 +4,8 @@
#
# Bootstrap runs in all environments. Dev seeds (members, groups, sample data)
# run only in dev and test. Skips entirely if bootstrap was already applied
# (Admin role exists), so safe to run on every start.
# (admin user exists), so safe to run on every start. Set FORCE_SEEDS=true to
# re-run seeds even when already applied.
#
# In production (release): seeds are run via Mv.Release.run_seeds/0 from the
# container entrypoint. Set RUN_DEV_SEEDS=true to also run dev seeds there.
@ -15,8 +16,8 @@
_ = Application.ensure_all_started(:mv)
if Mv.Release.bootstrap_seeds_applied?() do
IO.puts("Seeds already applied (admin user exists). Skipping.")
if Mv.Release.bootstrap_seeds_applied?() and System.get_env("FORCE_SEEDS") != "true" do
IO.puts("Seeds already applied. Skipping. (Set FORCE_SEEDS=true to override)")
else
prev = Code.compiler_options()
Code.compiler_options(ignore_module_conflict: true)