2022-02-12 09:29:20 +08:00
|
|
|
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
|
2022-12-29 07:41:29 +08:00
|
|
|
touch "$DUMP_DIR/initialization.failed"
|
|
|
|
|
2022-02-12 09:29:20 +08:00
|
|
|
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
2022-02-16 01:00:45 +08:00
|
|
|
CREATE USER "oc_$POSTGRES_USER" WITH PASSWORD '$POSTGRES_PASSWORD' CREATEDB;
|
|
|
|
ALTER DATABASE "$POSTGRES_DB" OWNER TO "oc_$POSTGRES_USER";
|
2023-01-17 23:19:48 +08:00
|
|
|
GRANT ALL PRIVILEGES ON DATABASE "$POSTGRES_DB" TO "oc_$POSTGRES_USER";
|
|
|
|
GRANT ALL PRIVILEGES ON SCHEMA public TO "oc_$POSTGRES_USER";
|
2022-02-12 09:29:20 +08:00
|
|
|
EOSQL
|
|
|
|
|
2022-12-29 07:41:29 +08:00
|
|
|
rm "$DUMP_DIR/initialization.failed"
|
|
|
|
|
2022-02-12 09:29:20 +08:00
|
|
|
set +ex
|