feat: add casts to+from text for text newtypes
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
6700413593
commit
68cd9c5bb4
@ -12,5 +12,15 @@ begin
|
||||
, qualified_name || '_of_string(val text)'
|
||||
, ' returns ' || qualified_name || E' language sql as \'select row(val);\';'
|
||||
);
|
||||
execute concat( 'create cast '
|
||||
, ' (' || qualified_name || ' as text)'
|
||||
, ' with function ' || qualified_name || E'_to_string(' || qualified_name || ')'
|
||||
, ' as assignment;'
|
||||
);
|
||||
execute concat( 'create cast '
|
||||
, ' (text as ' || qualified_name || ')'
|
||||
, ' with function ' || qualified_name || E'_of_string(text)'
|
||||
, ' as assignment;'
|
||||
);
|
||||
end;
|
||||
$$;
|
||||
|
@ -8,15 +8,6 @@ source ./scripts/env.sh ./.env.schema
|
||||
base_or_head="$1"
|
||||
rev="$2"
|
||||
|
||||
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
|
||||
|
||||
db() {
|
||||
echo -n "postgresql:///$1?port=$port&user=$POSTGRES_USER&password=$POSTGRES_PASSWORD"
|
||||
}
|
||||
@ -28,21 +19,34 @@ 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
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git worktree remove --force "./$base_or_head" &>/dev/null || true
|
||||
rm -rf "./$base_or_head" &>/dev/null || true
|
||||
git worktree add "./$base_or_head" --detach "$rev" &>/dev/null
|
||||
if [[ -n "$rev" ]]; then
|
||||
git worktree remove --force "./$base_or_head" &>/dev/null || true
|
||||
rm -rf "./$base_or_head" &>/dev/null || true
|
||||
git worktree add "./$base_or_head" --detach "$rev" &>/dev/null
|
||||
|
||||
cp docker-compose.yml "./$base_or_head/docker-compose.yml"
|
||||
cp .env.schema "./$base_or_head/.env.schema"
|
||||
cp docker-compose.yml "./$base_or_head/docker-compose.yml"
|
||||
cp .env.schema "./$base_or_head/.env.schema"
|
||||
|
||||
cd "./$base_or_head"
|
||||
docker compose up --wait --wait-timeout 30 -d "$base_or_head"
|
||||
cd "./$base_or_head"
|
||||
fi
|
||||
|
||||
docker compose up --wait --wait-timeout 30 -d "${base_or_head:-head}"
|
||||
initdb
|
||||
ls ./schema/ | xargs -I{} bash -c "set -e; $(declare -f query_file); query_file \"$(db dnim)\" ./schema/{}"
|
||||
|
Loading…
Reference in New Issue
Block a user