-- ============================================================
-- FreightDesk — Seed Data Migration
-- Imports existing business data from JSON ledger
-- ============================================================

-- Note: Run this after 001_initial_schema.sql
-- This inserts the seed data from seed_data.json

-- The actual seed data will be loaded via the seed.js script
-- which reads supabase/seed_data.json and inserts via Supabase client

-- This file is a placeholder for any SQL-level seed operations
-- For example, updating computed fields after data load:

-- Update shipper totals after loads are inserted
-- UPDATE shippers SET
--     total_freight = (SELECT COALESCE(SUM(freight_charged), 0) FROM loads WHERE shipper_id = shippers.id),
--     total_commission = (SELECT COALESCE(SUM(commission), 0) FROM loads WHERE shipper_id = shippers.id),
--     pending_amount = (SELECT COALESCE(SUM(pending_from_shipper), 0) FROM loads WHERE shipper_id = shippers.id);
