fix: migrate.sh should look for a migration before skipping
All checks were successful
gen-migrations / gen-migrations (push) Successful in 9s

This commit is contained in:
Orion Kindel 2023-07-20 13:41:33 -05:00
parent 1590c5992b
commit 01ee432983
Signed by untrusted user who does not match committer: orion
GPG Key ID: 6D4165AE4C928719

View File

@ -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