MarseyWorld/scripts/schema.sh

14 lines
533 B
Bash
Raw Normal View History

2023-10-24 19:04:40 +00:00
#apply env vars
2023-07-27 23:47:56 +00:00
. /e
2023-10-06 12:28:40 +00:00
#generate schema.sql
2023-08-04 13:30:06 +00:00
pg_dump -O -x --schema-only "$DATABASE_URL" > '/d/schema.sql'
2023-07-27 23:47:56 +00:00
2023-10-06 12:28:40 +00:00
#generate seed-badges.sql
pg_dump -O -x --data-only --inserts -t 'badge_defs' "$DATABASE_URL" > "/d/seed-badges.sql"
2023-07-27 23:47:56 +00:00
2023-10-06 12:28:40 +00:00
#generate seed-hats.sql
pg_dump -O -x --data-only --inserts -t 'hat_defs' "$DATABASE_URL" > "/d/seed-hats.sql"
2023-08-01 07:13:46 +00:00
sed -i -E "s/(INSERT INTO public.hat_defs VALUES \(.*', )[0-9]{2,}?,/\12,/g" "/d/seed-hats.sql"
sed -i -E "s/INSERT INTO public.hat_defs VALUES \(.*, [0-9]{1,6}, [0-9]{10}\);//g" "/d/seed-hats.sql"