phonograph/migrations/20250522224809_bases.up.sql
Brent Schroeter ced7eced4a sqlx etc
2025-05-26 22:08:29 -07:00

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);