fix: migrate.sh should look for a migration before skipping
All checks were successful
gen-migrations / gen-migrations (push) Successful in 9s
All checks were successful
gen-migrations / gen-migrations (push) Successful in 9s
This commit is contained in:
parent
1590c5992b
commit
01ee432983
@ -49,14 +49,14 @@ else
|
|||||||
if [[ -f "./migrations/${base}_skipped.sql" ]]; then
|
if [[ -f "./migrations/${base}_skipped.sql" ]]; then
|
||||||
echo "${base} (skipped)"
|
echo "${base} (skipped)"
|
||||||
continue
|
continue
|
||||||
elif ! (schema_changed "$base"); then
|
|
||||||
echo "${base} (skipped, no changes to schema)"
|
|
||||||
continue
|
|
||||||
elif [[ -f "./migrations/$mig" ]]; then
|
elif [[ -f "./migrations/$mig" ]]; then
|
||||||
head=$(echo $mig | awk -F'[_.]' '{print $3}')
|
head=$(echo $mig | awk -F'[_.]' '{print $3}')
|
||||||
echo "${base} -> ${head}"
|
echo "${base} -> ${head}"
|
||||||
query_file "$POSTGRES_URI/dnim" "./migrations/$mig"
|
query_file "$POSTGRES_URI/dnim" "./migrations/$mig"
|
||||||
query "$POSTGRES_URI/dnim" "insert into migration (from_revision, to_revision) values ('$base', '$head');"
|
query "$POSTGRES_URI/dnim" "insert into migration (from_revision, to_revision) values ('$base', '$head');"
|
||||||
|
elif ! (schema_changed "$base"); then
|
||||||
|
echo "${base} (skipped, no changes to schema)"
|
||||||
|
continue
|
||||||
else
|
else
|
||||||
echo "cant find migration for $base" 1>&2
|
echo "cant find migration for $base" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user