Files
fourge-portal/supabase/migrations/add_revision_billing.sql
T
Krao Hasanee d6e49a4c67 Add Stripe fee tracking on paid invoices + backfill function
- Store stripe_fee on invoices when webhook receives checkout.session.completed
- Display Stripe fee and net received in InvoiceDetail when paid via Stripe
- Add backfill-stripe-fees edge function to populate fee on existing paid invoices
- Migration: add stripe_fee column to invoices table
- Includes all pending portal changes (brand book, sign survey, task/project/company updates, etc.)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 12:16:22 -04:00

16 lines
676 B
SQL

-- ============================================================
-- Migration: Add revision billing tracking
-- Run in Supabase → SQL Editor → Run
-- ============================================================
-- Add revision_type and invoiced to submissions
alter table public.submissions
add column revision_type text check (revision_type in ('fourge_error', 'client_revision'));
alter table public.submissions
add column invoiced boolean not null default false;
-- Add submission_id to invoice_items (links a line item to a specific revision)
alter table public.invoice_items
add column submission_id uuid references public.submissions(id) on delete set null;