docker-postgres/initScript/init.sh

17 lines
526 B
Bash
Raw Permalink Normal View History

2022-06-06 10:28:01 +00:00
#!/bin/bash
set -e
app_password="$POSTGRES_APP_PASSWORD"
2022-06-06 10:28:01 +00:00
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER docker WITH PASSWORD '$app_password';
CREATE DATABASE docker;
GRANT ALL PRIVILEGES ON SCHEMA public TO docker;
2022-06-06 10:28:01 +00:00
GRANT ALL PRIVILEGES ON DATABASE docker TO docker;
2022-06-06 10:28:01 +00:00
-- SELECT datname FROM pg_database WHERE datistemplate = false;
-- SELECT table_schema,table_name
-- FROM information_schema.tables
-- ORDER BY table_schema,table_name;
EOSQL