13 lines
473 B
MySQL
13 lines
473 B
MySQL
|
|
create table if not exists rel_invitations (
|
||
|
|
id uuid not null primary key,
|
||
|
|
email text not null,
|
||
|
|
base_id uuid not null references bases(id) on delete cascade,
|
||
|
|
class_oid oid not null,
|
||
|
|
created_by uuid not null references users(id) on delete restrict,
|
||
|
|
privilege text not null,
|
||
|
|
expires_at timestamptz,
|
||
|
|
unique (email, base_id, class_oid, privilege)
|
||
|
|
);
|
||
|
|
create index on rel_invitations (base_id, class_oid);
|
||
|
|
create index on rel_invitations (email);
|