create table if not exists public.games ( id bigint generated by default as identity primary key, user_id uuid not null references auth.users(id) on delete cascade, data jsonb not null ); create table if not exists public.groups ( id bigint generated by default as identity primary key, user_id uuid not null references auth.users(id) on delete cascade, data jsonb not null ); alter table public.games enable row level security; alter table public.groups enable row level security; create policy "Users manage their own games" on public.games for all to authenticated using (auth.uid() = user_id) with check (auth.uid() = user_id); create policy "Users manage their own groups" on public.groups for all to authenticated using (auth.uid() = user_id) with check (auth.uid() = user_id); create index if not exists games_user_id_idx on public.games(user_id); create index if not exists groups_user_id_idx on public.groups(user_id);