test: Reorganize test/ folder into one subdirectory for each test type

This commit is contained in:
Wolfgang Walther
2022-01-07 13:10:36 +01:00
committed by Wolfgang Walther
parent 8060fe3559
commit 8b63d928ae
110 changed files with 19 additions and 19 deletions
+34
View File
@@ -0,0 +1,34 @@
CREATE ROLE postgrest_test_anonymous;
GRANT postgrest_test_anonymous TO :USER;
CREATE SCHEMA test;
-- PUT+PATCH target needs one record and column to modify
CREATE TABLE test.actors (
PRIMARY KEY (actor),
actor INT,
name TEXT,
last_modified TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO test.actors VALUES (1, 'John Doe');
-- POST target needs generated PK
CREATE TABLE test.films (
PRIMARY KEY (film),
film INT GENERATED BY DEFAULT AS IDENTITY,
title TEXT
);
-- DELETE target remains empty
CREATE TABLE test.roles (
actor INT REFERENCES test.actors,
film INT REFERENCES test.films,
character TEXT
);
CREATE FUNCTION test.call_me (name TEXT) RETURNS TEXT
STABLE LANGUAGE SQL AS $$
SELECT 'Hello ' || name || ', how are you?';
$$;
GRANT USAGE ON SCHEMA test TO postgrest_test_anonymous;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA test TO postgrest_test_anonymous;