Last active
November 26, 2016 06:29
-
-
Save cazzer/11b2bfcd9ad4895414c158f5bb60c6d6 to your computer and use it in GitHub Desktop.
Row Level Security: Schema
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create role application_user; | |
grant all on all tables in schema public | |
to application_user; | |
create table users ( | |
name text not null primary key, | |
role text unique not null | |
); | |
create table data ( | |
id uuid default gen_random_uuid() not null primary key, | |
value text, | |
created_at timestamp with time zone default now() | |
); | |
create table user_data ( | |
data_id uuid references data(id), | |
user_role text | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment