19 lines
619 B
SQL
19 lines
619 B
SQL
create table if not exists bases (
|
|
id uuid not null primary key,
|
|
name text not null default '',
|
|
url text not null,
|
|
owner_id uuid not null references users(id)
|
|
on delete restrict,
|
|
user_role_prefix text not null default '__itmu__'
|
|
);
|
|
create index on bases (owner_id);
|
|
|
|
create table if not exists base_user_perms (
|
|
id uuid not null primary key,
|
|
base_id uuid not null references bases(id),
|
|
user_id uuid not null references users(id),
|
|
perm text not null,
|
|
unique (base_id, user_id, perm)
|
|
);
|
|
create index on base_user_perms (user_id);
|
|
create index on base_user_perms (base_id);
|