put regen-migrations into Justfile
This commit is contained in:
parent
2814fd11ea
commit
48353f8559
2 changed files with 17 additions and 19 deletions
17
Justfile
17
Justfile
|
|
@ -40,3 +40,20 @@ build-docker-container:
|
||||||
# This is meant for debugging the container build process only.
|
# This is meant for debugging the container build process only.
|
||||||
run-docker-container: build-docker-container
|
run-docker-container: build-docker-container
|
||||||
docker run -e "SECRET_KEY_BASE=ahK8BeiDaibaige1ahkooS0chie9lo7the7uuzar0eeBeeCh2iereteshee2Oosu" -e='DATABASE_URL=postgres://postgres@localhost:5432/mv_dev' -e='PORT=4040' -e='PHX_HOST=localhost' --network=host mitgliederverwaltung
|
docker run -e "SECRET_KEY_BASE=ahK8BeiDaibaige1ahkooS0chie9lo7the7uuzar0eeBeeCh2iereteshee2Oosu" -e='DATABASE_URL=postgres://postgres@localhost:5432/mv_dev' -e='PORT=4040' -e='PHX_HOST=localhost' --network=host mitgliederverwaltung
|
||||||
|
|
||||||
|
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
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# 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 $1
|
|
||||||
|
|
||||||
# Run migrations if flag
|
|
||||||
if echo $* | grep -e "-m" -q; then
|
|
||||||
mix ash.migrate
|
|
||||||
fi
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue