Skip to content

Instantly share code, notes, and snippets.

@mannharleen
Last active February 26, 2020 01:16
Show Gist options
  • Save mannharleen/871d184f284e095ffc7a514488cd6d4d to your computer and use it in GitHub Desktop.
Save mannharleen/871d184f284e095ffc7a514488cd6d4d to your computer and use it in GitHub Desktop.
drop table originflowjobs;
create table originflowjobs (id SERIAL PRIMARY KEY, user_id text NOT NULL, flow_id text NOT NULL, run_id text unique NOT NULL, flow_label text, flow_info text, status text NOT NULL, created_ts timestamp NOT NULL, updated_ts timestamp NOT NULL, custom_json jsonb);
CREATE INDEX index_user_id_flow_id ON originflowjobs(user_id, flow_id, run_id);
ALTER TABLE public.originflowjobs ENABLE ROW LEVEL SECURITY;
CREATE ROLE testuser1 WITH LOGIN PASSWORD 'testuser1';
GRANT select, insert, update, delete ON TABLE originflowjobs TO testuser1;
GRANT USAGE, SELECT ON SEQUENCE originflowjobs_id_seq TO testuser1;
CREATE POLICY originflowjobs_userId
ON originflowjobs
USING (user_id = CURRENT_USER);
-------------------------------------------------
-- other useful commands
--CREATE POLICY originflowjobs_testuser1
--ON originflowjobs
--FOR SELECT TO testuser1
--USING (userId = 'testuser1');
--DROP POLICY originflowjobs_testuser1
--ON originflowjobs;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment