You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
594 B
PL/PgSQL
22 lines
594 B
PL/PgSQL
--Create ctti user and grant permissions
|
|
CREATE ROLE ctti;
|
|
GRANT ALL PRIVILEGES ON DATABASE aact_db TO ctti;
|
|
|
|
/*
|
|
Add the root user if it doesn't exist.
|
|
With the default configuration this shouldn't be an issue,
|
|
but I can see myself forgetting and changing the default POSTGRES_USER
|
|
*/
|
|
DO LANGUAGE plpgsql
|
|
$do$
|
|
BEGIN
|
|
IF NOT EXISTS (
|
|
SELECT FROM pg_catalog.pg_roles -- SELECT list can be empty for this
|
|
WHERE rolname = 'root')
|
|
THEN
|
|
CREATE ROLE root LOGIN PASSWORD 'root'; --SECURITY ISSUE
|
|
GRANT ALL PRIVILEGES ON DATABASE aact_db TO root;
|
|
END IF;
|
|
END
|
|
$do$
|