mirror of
https://github.com/kou029w/quot.git
synced 2025-01-18 16:08:03 +00:00
grant anon role
This commit is contained in:
parent
8756685659
commit
d5996574b6
2 changed files with 7 additions and 2 deletions
|
@ -7,7 +7,7 @@ services:
|
||||||
environment:
|
environment:
|
||||||
PGRST_DB_URI: postgresql://postgres:${POSTGRES_PASSWORD}@/postgres?host=/var/run/postgresql
|
PGRST_DB_URI: postgresql://postgres:${POSTGRES_PASSWORD}@/postgres?host=/var/run/postgresql
|
||||||
PGRST_DB_SCHEMA: public
|
PGRST_DB_SCHEMA: public
|
||||||
PGRST_DB_ANON_ROLE: postgres
|
PGRST_DB_ANON_ROLE: anon
|
||||||
volumes:
|
volumes:
|
||||||
- postgres_socket:/var/run/postgresql
|
- postgres_socket:/var/run/postgresql
|
||||||
depends_on: [db]
|
depends_on: [db]
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
-- migrate:up
|
-- migrate:up
|
||||||
|
CREATE ROLE anon;
|
||||||
|
ALTER ROLE anon SET statement_timeout = '1s';
|
||||||
|
|
||||||
CREATE FUNCTION update_timestamp() RETURNS trigger LANGUAGE plpgsql AS $$
|
CREATE FUNCTION update_timestamp() RETURNS trigger LANGUAGE plpgsql AS $$
|
||||||
BEGIN
|
BEGIN
|
||||||
NEW.updated = CURRENT_TIMESTAMP;
|
NEW.updated = CURRENT_TIMESTAMP;
|
||||||
|
@ -14,10 +17,12 @@ CREATE TABLE pages (
|
||||||
updated TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
updated TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
);
|
);
|
||||||
|
|
||||||
|
GRANT ALL ON pages TO anon;
|
||||||
|
|
||||||
CREATE TRIGGER pages_updated BEFORE UPDATE ON pages FOR EACH ROW
|
CREATE TRIGGER pages_updated BEFORE UPDATE ON pages FOR EACH ROW
|
||||||
EXECUTE PROCEDURE update_timestamp();
|
EXECUTE PROCEDURE update_timestamp();
|
||||||
|
|
||||||
-- migrate:down
|
-- migrate:down
|
||||||
DROP TRIGGER pages_updated ON pages;
|
|
||||||
DROP TABLE pages;
|
DROP TABLE pages;
|
||||||
DROP FUNCTION update_timestamp();
|
DROP FUNCTION update_timestamp();
|
||||||
|
DROP ROLE anon;
|
||||||
|
|
Loading…
Add table
Reference in a new issue