create table if not exists room_access ( room uuid not null, "user" uuid not null, granted_by uuid not null, granted_at timestamp with time zone default now() not null, primary key (room, "user") ); create index if not exists idx_room_access_user on room_access ("user");