Fix
This commit is contained in:
@@ -16,19 +16,19 @@ create_db_and_user() {
|
|||||||
|
|
||||||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
|
||||||
-- Create database
|
-- Create database
|
||||||
CREATE DATABASE $($db_name);
|
CREATE DATABASE "$db_name";
|
||||||
|
|
||||||
-- Create user with password
|
-- Create user with password
|
||||||
CREATE USER $db_user WITH ENCRYPTED PASSWORD '$db_password';
|
CREATE USER $db_user WITH ENCRYPTED PASSWORD '$db_password';
|
||||||
|
|
||||||
-- Grant connection to the specific database only
|
-- Grant connection to the specific database only
|
||||||
GRANT CONNECT ON DATABASE $($db_name) TO $db_user;
|
GRANT CONNECT ON DATABASE "$db_name" TO $db_user;
|
||||||
|
|
||||||
-- Make user owner of the database
|
-- Make user owner of the database
|
||||||
ALTER DATABASE $($db_name) OWNER TO $db_user;
|
ALTER DATABASE "$db_name" OWNER TO $db_user;
|
||||||
|
|
||||||
-- Connect to the specific database to set schema permissions
|
-- Connect to the specific database to set schema permissions
|
||||||
\c $($db_name)
|
\c "$db_name"
|
||||||
|
|
||||||
-- Grant schema permissions
|
-- Grant schema permissions
|
||||||
GRANT ALL ON SCHEMA public TO $db_user;
|
GRANT ALL ON SCHEMA public TO $db_user;
|
||||||
|
|||||||
Reference in New Issue
Block a user