Untitled

mail@pastecode.io avatar
unknown
sh
2 years ago
3.0 kB
7
Indexable
Never
#!/bin/bash

set -e
set -u



psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
    CREATE DATABASE accounts_service;
    CREATE USER puser with ENCRYPTED PASSWORD 'puser' ;
    GRANT ALL PRIVILEGES ON DATABASE accounts_service TO puser;

EOSQL

psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
    CREATE DATABASE chats_db;
    CREATE USER test_user with ENCRYPTED PASSWORD 'test' ;
    GRANT ALL PRIVILEGES ON DATABASE chats_db TO test_user;

EOSQL

psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
    CREATE DATABASE orders_service;
    CREATE USER puser with ENCRYPTED PASSWORD 'puser' ;
    GRANT ALL PRIVILEGES ON DATABASE orders_service TO puser;

EOSQL

psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
    CREATE DATABASE orders_service;
    CREATE USER puser with ENCRYPTED PASSWORD 'puser' ;
    GRANT ALL PRIVILEGES ON DATABASE orders_service TO puser;

EOSQL

psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
    CREATE DATABASE orders_service;
    CREATE USER puser with ENCRYPTED PASSWORD 'puser' ;
    GRANT ALL PRIVILEGES ON DATABASE orders_service TO puser;

EOSQL

psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
    CREATE DATABASE auth;
    CREATE USER auth with ENCRYPTED PASSWORD 'auth' ;
    GRANT ALL PRIVILEGES ON DATABASE auth TO auth;

EOSQL

psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
    CREATE DATABASE delivery_db;
    CREATE USER test_user with ENCRYPTED PASSWORD 'test' ;
    GRANT ALL PRIVILEGES ON DATABASE delivery_db TO test_user;

EOSQL

psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
    CREATE DATABASE delivery_db;
    CREATE USER test_user with ENCRYPTED PASSWORD 'test' ;
    GRANT ALL PRIVILEGES ON DATABASE delivery_db TO test_user;

EOSQL

psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
    CREATE DATABASE geo_db;
    CREATE USER test_user with ENCRYPTED PASSWORD 'test' ;
    GRANT ALL PRIVILEGES ON DATABASE geo_db TO test_user;

EOSQL

psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
    CREATE DATABASE notifications_db;
    CREATE USER test_user with ENCRYPTED PASSWORD 'test' ;
    GRANT ALL PRIVILEGES ON DATABASE notifications_db TO test_user;

EOSQL

psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
    CREATE DATABASE orders_service;
    CREATE USER puser with ENCRYPTED PASSWORD 'puser' ;
    GRANT ALL PRIVILEGES ON DATABASE orders_service TO puser;
EOSQL

psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
    CREATE DATABASE onboarding_db;
    CREATE USER test_user with ENCRYPTED PASSWORD 'test' ;
    GRANT ALL PRIVILEGES ON DATABASE onboarding_db TO test_user;
EOSQL

psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
    CREATE DATABASE onboarding_db;
    CREATE USER test_user with ENCRYPTED PASSWORD 'test' ;
    GRANT ALL PRIVILEGES ON DATABASE onboarding_db TO test_user;

EOSQL
psql -v ON_ERROR_STOP=0 --username "$POSTGRES_USER" <<-EOSQL
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
EOSQL