blob: d3d773105a7e2e08a4341a79a79a19db625fb0bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
BEGIN;
-- roles table
create table roles (
id serial not null primary key,
body_id integer not null references body(id) ON DELETE CASCADE,
name text,
permissions text ARRAY,
unique(body_id, name)
);
-- Record which role(s) each user holds
create table user_roles (
id serial not null primary key,
role_id integer not null references roles(id) ON DELETE CASCADE,
user_id integer not null references users(id) ON DELETE CASCADE
);
COMMIT;
|