Skip to content

Instantly share code, notes, and snippets.

@cazzer
Last active November 26, 2016 06:29
Show Gist options
  • Save cazzer/11b2bfcd9ad4895414c158f5bb60c6d6 to your computer and use it in GitHub Desktop.
Save cazzer/11b2bfcd9ad4895414c158f5bb60c6d6 to your computer and use it in GitHub Desktop.
Row Level Security: Schema
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