nix(feat): Add postgrest-loadtest
This commit is contained in:
committed by
Steve Chavez
parent
f7b3608d4e
commit
1aebe62a03
@@ -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;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"last_modified": "now"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"title": "Workers Leaving The Lumière Factory In Lyon"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"actor": 1,
|
||||
"name": "John Doe",
|
||||
"last_modified": "now"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "John"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
GET http://postgrest/
|
||||
Prefer: tx=commit
|
||||
|
||||
HEAD http://postgrest/actors?actor=eq.1
|
||||
Prefer: tx=commit
|
||||
|
||||
GET http://postgrest/actors?select=*,roles(*,films(*))
|
||||
Prefer: tx=commit
|
||||
|
||||
POST http://postgrest/films?columns=title
|
||||
Prefer: tx=rollback
|
||||
@post.json
|
||||
|
||||
PUT http://postgrest/actors?actor=eq.1&columns=name
|
||||
Prefer: tx=rollback
|
||||
@put.json
|
||||
|
||||
PATCH http://postgrest/actors?actor=eq.1
|
||||
Prefer: tx=rollback
|
||||
@patch.json
|
||||
|
||||
DELETE http://postgrest/roles
|
||||
Prefer: tx=rollback
|
||||
|
||||
GET http://postgrest/rpc/call_me?name=John
|
||||
|
||||
POST http://postgrest/rpc/call_me
|
||||
@rpc.json
|
||||
|
||||
OPTIONS http://postgrest/actors
|
||||
Reference in New Issue
Block a user