threesome fixed
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
-- One-shot: run in Supabase Dashboard → SQL Editor.
|
||||
-- Adds per-match escrow accounting columns used by collect_match_entries / settle_match_reward.
|
||||
|
||||
alter table public.matches
|
||||
add column if not exists escrow_user_id bigint null,
|
||||
add column if not exists entries_collected_at timestamp with time zone null,
|
||||
add column if not exists settled_at timestamp with time zone null;
|
||||
|
||||
do $$
|
||||
begin
|
||||
if not exists (
|
||||
select 1
|
||||
from pg_constraint
|
||||
where conname = 'matches_escrow_user_id_fkey'
|
||||
) then
|
||||
alter table public.matches
|
||||
add constraint matches_escrow_user_id_fkey
|
||||
foreign key (escrow_user_id) references public.users (id);
|
||||
end if;
|
||||
end $$;
|
||||
|
||||
comment on column public.matches.escrow_user_id is
|
||||
'Dedicated users row holding this match pot (username match_escrow_<id>); set on first successful collect.';
|
||||
comment on column public.matches.entries_collected_at is
|
||||
'When both players entry fees were moved into escrow; null until collect succeeds.';
|
||||
comment on column public.matches.settled_at is
|
||||
'When prize + house fee were paid from escrow; null until settle succeeds.';
|
||||
Reference in New Issue
Block a user