File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -10,4 +10,17 @@ rm -f /tmp/.s.PGSQL.*
1010rm -f /var/log/api-umbrella/trafficserver/error.log
1111
1212make
13+
14+ # Wait for PostgreSQL to be ready before running database setup.
15+ echo " Waiting for PostgreSQL to be ready..."
16+ until PGPASSWORD=dev_password psql -h postgres -U postgres -c ' \q' 2> /dev/null; do
17+ echo " PostgreSQL is unavailable - sleeping"
18+ sleep 1
19+ done
20+ echo " PostgreSQL is ready"
21+
22+ # Run database setup as postgres superuser to create the database and roles.
23+ # This is idempotent and safe to run on every startup.
24+ DB_USERNAME=postgres DB_PASSWORD=dev_password api-umbrella db-setup
25+
1326api-umbrella run
Original file line number Diff line number Diff line change @@ -63,6 +63,9 @@ return function()
6363 local removing_comments = true
6464 for _ , line in ipairs (lines ) do
6565 if not removing_comments or (line ~= " " and not startswith (line , " --" )) then
66+ if startswith (line , " CREATE SCHEMA" ) then
67+ line = line :gsub (" ^CREATE SCHEMA" , " CREATE SCHEMA IF NOT EXISTS" )
68+ end
6669 if startswith (line , " COMMENT ON EXTENSION" ) then
6770 line = " -- " .. line
6871 end
You can’t perform that action at this time.
0 commit comments