Create role publicuser if it does not exist

This commit is contained in:
Rafa de la Torre 2016-08-08 15:24:21 +02:00
parent e82f5b0264
commit 966dd4268a
2 changed files with 27 additions and 0 deletions

View File

@ -1,5 +1,18 @@
-- Install dependencies -- Install dependencies
CREATE EXTENSION plpythonu; CREATE EXTENSION plpythonu;
CREATE EXTENSION postgis; CREATE EXTENSION postgis;
-- Create role publicuser if it does not exist
DO
$$
BEGIN
IF NOT EXISTS (
SELECT *
FROM pg_catalog.pg_user
WHERE usename = 'publicuser') THEN
CREATE ROLE publicuser LOGIN;
END IF;
END
$$ LANGUAGE plpgsql;
-- Install the extension -- Install the extension
CREATE EXTENSION crankshaft VERSION 'dev'; CREATE EXTENSION crankshaft VERSION 'dev';

View File

@ -2,5 +2,19 @@
CREATE EXTENSION plpythonu; CREATE EXTENSION plpythonu;
CREATE EXTENSION postgis; CREATE EXTENSION postgis;
-- Create role publicuser if it does not exist
DO
$$
BEGIN
IF NOT EXISTS (
SELECT *
FROM pg_catalog.pg_user
WHERE usename = 'publicuser') THEN
CREATE ROLE publicuser LOGIN;
END IF;
END
$$ LANGUAGE plpgsql;
-- Install the extension -- Install the extension
CREATE EXTENSION crankshaft VERSION 'dev'; CREATE EXTENSION crankshaft VERSION 'dev';