Improve test db management (#747)

This commit is contained in:
dsimunic
2016-12-01 21:06:10 -08:00
committed by Joe Nelson
parent 6c009b71d3
commit 0d85152e42
11 changed files with 216 additions and 54 deletions
+2 -5
View File
@@ -1,6 +1,3 @@
DROP DATABASE IF EXISTS postgrest_test;
DROP ROLE IF EXISTS postgrest_test;
CREATE USER postgrest_test createdb createrole;
CREATE DATABASE postgrest_test OWNER postgrest_test;
CREATE EXTENSION IF NOT EXISTS pgcrypto;
ALTER DATABASE postgrest_test SET request.jwt.claim.id = '-1';
ALTER DATABASE :db SET request.jwt.claim.id = '-1';
+5
View File
@@ -57,3 +57,8 @@ TO postgrest_test_anonymous;
-- Privileges for non anonymous users
GRANT USAGE ON SCHEMA test TO postgrest_test_author;
GRANT ALL ON TABLE authors_only TO postgrest_test_author;
GRANT USAGE ON SCHEMA postgrest,private,test to :test_user_name;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA postgrest,private,test TO :test_user_name;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA postgrest,private,test TO :test_user_name;
-7
View File
@@ -1,7 +0,0 @@
DROP ROLE IF EXISTS postgrest_test_authenticator, postgrest_test_anonymous, postgrest_test_default_role, postgrest_test_author;
CREATE ROLE postgrest_test_authenticator WITH login noinherit;
CREATE ROLE postgrest_test_anonymous;
CREATE ROLE postgrest_test_default_role;
CREATE ROLE postgrest_test_author;
GRANT postgrest_test_anonymous, postgrest_test_default_role, postgrest_test_author TO postgrest_test_authenticator;