fix: gen-migrations workflow
Some checks failed
gen-migrations / gen-migrations (push) Failing after 7s
Some checks failed
gen-migrations / gen-migrations (push) Failing after 7s
This commit is contained in:
parent
7613dc8749
commit
3a14f001f6
@ -8,6 +8,11 @@ services:
|
||||
env_file: ['./.env.schema']
|
||||
volumes: ['/var/run/postgresql:/var/run/postgresql']
|
||||
command: '-p 5432'
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "pg_isready" ]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
head:
|
||||
container_name: 'head'
|
||||
network_mode: 'host'
|
||||
@ -16,3 +21,8 @@ services:
|
||||
env_file: ['./.env.schema']
|
||||
volumes: ['/var/run/postgresql:/var/run/postgresql']
|
||||
command: '-p 5433'
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "pg_isready" ]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
@ -18,10 +18,6 @@ db() {
|
||||
echo -n "postgresql:///$1?port=$port&user=$POSTGRES_USER&password=$POSTGRES_PASSWORD"
|
||||
}
|
||||
|
||||
isready() {
|
||||
until psql $(db postgres) -c "select 1" &>/dev/null; do true; done;
|
||||
}
|
||||
|
||||
initdb() {
|
||||
dropdb=$(mktemp)
|
||||
echo "drop database dnim with (force);" > "$dropdb"
|
||||
@ -31,7 +27,6 @@ initdb() {
|
||||
|
||||
if [[ "$rev" = "empty" ]]; then
|
||||
docker compose up -d "$base_or_head"
|
||||
isready
|
||||
initdb
|
||||
exit 0
|
||||
fi
|
||||
@ -46,6 +41,5 @@ cp .env.schema "./$base_or_head/.env.schema"
|
||||
cd "./$base_or_head"
|
||||
docker compose up -d "$base_or_head"
|
||||
|
||||
isready
|
||||
initdb || (docker compose logs "$base_or_head" && exit 1)
|
||||
ls ./schema/ | xargs -I{} bash -c "set -e; $(declare -f query_file); query_file \"$(db dnim)\" ./schema/{}" || (docker compose logs "$base_or_head" && exit 1)
|
||||
|
@ -28,8 +28,6 @@ if [[ ! -f "$migration" ]]; then
|
||||
./scripts/build.sh base "$base" 1>&2 || (echo "base failed to build" && exit 1)
|
||||
./scripts/build.sh head "$head" 1>&2 || (echo "head failed to build" && exit 1)
|
||||
|
||||
until pg_isready -p 5432 1>/dev/null && pg_isready -p 5433 1>/dev/null; do true; done;
|
||||
|
||||
migra --unsafe "$(db 5432)" "$(db 5433)" || echo "migra exited with code $?. this is /probably/ fine" 1>&2
|
||||
else
|
||||
cat "$migration"
|
||||
|
Loading…
Reference in New Issue
Block a user