DAS_2024_1/borschevskaya_anna_lab_1/init-database.sh

15 lines
541 B
Bash

#!/bin/bash
set -e
# Создаем пользователя redmine и БД redminedb
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER redmine WITH PASSWORD 'redmine-password';
CREATE DATABASE redminedb;
GRANT ALL PRIVILEGES ON DATABASE redminedb TO redmine;
EOSQL
# Даем права на схему public
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USERNAME" -d redminedb <<-EOSQL
ALTER SCHEMA public OWNER TO redmine;
GRANT ALL ON SCHEMA public TO redmine;
EOSQL