diff --git a/Makefile b/Makefile index 750c891..ab668ad 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,9 @@ PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) $(EXTENSION)--$(EXTVERSION).sql: $(CDBSCRIPTS) cartodb_hooks.sql Makefile - cat $(CDBSCRIPTS) | sed 's/\ $@ + echo "SET search_path TO cartodb,public,pg_catalog;" > $@ + cat $(CDBSCRIPTS) | \ + sed -e 's/\> $@ echo "GRANT USAGE ON SCHEMA cartodb TO public;" >> $@ cat cartodb_hooks.sql >> $@ diff --git a/scripts-available/CDB_Roles.sql b/scripts-available/CDB_Roles.sql new file mode 100644 index 0000000..c984d3c --- /dev/null +++ b/scripts-available/CDB_Roles.sql @@ -0,0 +1,13 @@ +DO LANGUAGE 'plpgsql' $$ +BEGIN + IF NOT EXISTS ( SELECT * FROM pg_roles WHERE rolname= 'cdb_org_admin' ) + THEN + CREATE ROLE cdb_org_admin NOLOGIN; + END IF; + + IF NOT EXISTS ( SELECT * FROM pg_roles WHERE rolname= 'cdb_org_user' ) + THEN + CREATE ROLE cdb_org_user NOLOGIN; + END IF; +END +$$; diff --git a/scripts-enabled/000-CDB_Roles.sql b/scripts-enabled/000-CDB_Roles.sql new file mode 120000 index 0000000..793ce20 --- /dev/null +++ b/scripts-enabled/000-CDB_Roles.sql @@ -0,0 +1 @@ +../scripts-available/CDB_Roles.sql \ No newline at end of file