1
0
Fork 0
mirror of https://github.com/kou029w/quot.git synced 2025-01-18 08:05:08 +00:00

grant anon role

This commit is contained in:
Nebel 2022-08-28 22:33:19 +09:00
parent 8756685659
commit d5996574b6
2 changed files with 7 additions and 2 deletions

View file

@ -7,7 +7,7 @@ services:
environment:
PGRST_DB_URI: postgresql://postgres:${POSTGRES_PASSWORD}@/postgres?host=/var/run/postgresql
PGRST_DB_SCHEMA: public
PGRST_DB_ANON_ROLE: postgres
PGRST_DB_ANON_ROLE: anon
volumes:
- postgres_socket:/var/run/postgresql
depends_on: [db]

View file

@ -1,4 +1,7 @@
-- migrate:up
CREATE ROLE anon;
ALTER ROLE anon SET statement_timeout = '1s';
CREATE FUNCTION update_timestamp() RETURNS trigger LANGUAGE plpgsql AS $$
BEGIN
NEW.updated = CURRENT_TIMESTAMP;
@ -14,10 +17,12 @@ CREATE TABLE pages (
updated TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);
GRANT ALL ON pages TO anon;
CREATE TRIGGER pages_updated BEFORE UPDATE ON pages FOR EACH ROW
EXECUTE PROCEDURE update_timestamp();
-- migrate:down
DROP TRIGGER pages_updated ON pages;
DROP TABLE pages;
DROP FUNCTION update_timestamp();
DROP ROLE anon;