Files
acmcc/supabase/migrations/20260317171347_2586e2e3-44de-4411-9310-553acab83479.sql
2026-06-01 20:19:26 -04:00

8 lines
464 B
SQL

-- Add target_month (YYYY-MM-01 format) and completed_at to payables
ALTER TABLE public.payables ADD COLUMN target_month DATE DEFAULT date_trunc('month', CURRENT_DATE)::date;
ALTER TABLE public.payables ADD COLUMN completed_at TIMESTAMP WITH TIME ZONE;
-- Update existing payables to have target_month based on due_date or created_at
UPDATE public.payables SET target_month = COALESCE(date_trunc('month', due_date)::date, date_trunc('month', created_at)::date);