mitgliederverwaltung/Justfile

53 lines
1.1 KiB
Makefile

run: install-dependencies start-database migrate-database seed-database
mix phx.server
install-dependencies:
mix deps.get
migrate-database:
mix ash.setup
reset-database:
mix ash.reset
seed-database:
mix run priv/repo/seeds.exs
start-database:
docker compose up -d
ci-dev: lint audit test
lint:
mix format --check-formatted
mix compile --warnings-as-errors
mix credo
audit:
mix sobelow --config
mix deps.audit
mix hex.audit
test:
mix test
format:
mix format
regen-migrations migration_name:
#!/bin/bash
set -euo pipefail
# Get count of untracked migrations
N_MIGRATIONS=$(git ls-files --others priv/repo/migrations | wc -l)
# Rollback untracked migrations
mix ash_postgres.rollback -n $N_MIGRATIONS
# Delete untracked migrations and snapshots
git ls-files --others priv/repo/migrations | xargs rm
git ls-files --others priv/resource_snapshots | xargs rm
# Regenerate migrations
mix ash.codegen --name {{migration_name}}
# Run migrations if flag
if echo $* | grep -e "-m" -q; then
mix ash.migrate
fi