fix: empty db
Some checks failed
gen-migrations / gen-migrations (push) Failing after 3s

This commit is contained in:
Orion Kindel 2023-07-18 22:10:14 -05:00
parent 2704c5b117
commit be4dca4a74
Signed by untrusted user who does not match committer: orion
GPG Key ID: 6D4165AE4C928719

View File

@ -14,8 +14,9 @@ if [[ "$dnim_database_count" = "0" ]]; then
echo "fresh database"
query "$POSTGRES_URI/postgres" "create database dnim;"
ls ./schema/ | xargs -I{} bash -c "$(declare -f query_file); query_file \"$POSTGRES_URI/dnim\" ./schema/{}"
rev_last='empty'
script=''
head=$(git rev-parse --short HEAD)
query "$POSTGRES_URI/dnim" "insert into migration (from_revision, to_revision) values ('empty', '$head');"
else
get_rev_last="copy (select to_revision from migration order by performed_on desc limit 1) to stdout with null as '';"
rev_last=$(psql "$POSTGRES_URI/dnim" -c "$get_rev_last")