fix: migrate and gen_migrations should work
Some checks failed
migrate-stage / migrate-stage (push) Has been cancelled
gen-migrations / gen-migrations (push) Successful in 15s
migrate-devel / migrate-devel (push) Failing after 5s

This commit is contained in:
Orion Kindel 2023-07-20 12:48:07 -05:00
parent 68cd9c5bb4
commit ee6390d723
Signed by untrusted user who does not match committer: orion
GPG Key ID: 6D4165AE4C928719
4 changed files with 18 additions and 16 deletions

@ -1 +1 @@
Subproject commit 2d996399411565af57e30ca2d2082764bd1ed9e1
Subproject commit 3b3eae9b02e25ae9077d5f5e0c63cf694b896e58

View File

@ -2,7 +2,7 @@ create schema human_uuid;
select public.create_newtype_text('human_uuid.huid');
create table human_uuid.used (huid text primary key);
create table human_uuid.used (human_uuid.huid text primary key);
create table human_uuid.object
( id int primary key generated always as identity
, word text unique

View File

@ -8,6 +8,17 @@ source ./scripts/env.sh ./.env.schema
base_or_head="$1"
rev="$2"
if [[ -n "$base_or_head" ]]; then
docker compose kill "$base_or_head"
docker compose rm -vf "$base_or_head"
fi
if [[ "$base_or_head" = "base" ]]; then
port=5432
else
port=5433
fi
db() {
echo -n "postgresql:///$1?port=$port&user=$POSTGRES_USER&password=$POSTGRES_PASSWORD"
}
@ -19,17 +30,6 @@ initdb() {
psql --quiet $(db postgres) -c "create database dnim"
}
if [[ -n "$base_or_head" ]]; then
docker compose kill "$base_or_head"
docker compose rm -vf "$base_or_head"
if [[ "$base_or_head" = "head" ]]; then
port=5433
else
port=5432
fi
fi
if [[ "$rev" = "empty" ]]; then
docker compose up --wait --wait-timeout 30 -d "$base_or_head"
initdb

View File

@ -1,6 +1,6 @@
#! /bin/bash
set -e
set -xe
source ./scripts/env.sh ./.env.schema
@ -15,7 +15,7 @@ fi;
migration="./migrations/${base}_to_${head}.sql"
db() {
echo -n "postgresql:///dnim?port=$1&user=$POSTGRES_USER&password=$POSTGRES_PASSWORD"
echo -n "postgresql+pg8000:///dnim?port=$1&user=$POSTGRES_USER&password=$POSTGRES_PASSWORD"
}
if [[ -z "$base" ]] || [[ -z "$head" ]]; then
@ -23,9 +23,11 @@ if [[ -z "$base" ]] || [[ -z "$head" ]]; then
exit 1;
fi
set +e
schema_changed=$(git diff --quiet "$base" "$head" -- ./schema)
schema_changed_exit=$?
if [[ $schema_changed_exit="1" ]]; then
set -e
if [[ "$schema_changed_exit" = "0" ]]; then
echo ""
exit 0;
fi;