freightdesk/supabase/migrations/002_seed_data.sql
FreightDesk 1a4eaaa040 Initial commit: FreightDesk v1.0
- Express + EJS server-rendered app
- Supabase PostgreSQL database
- Auth: username/password with bcrypt
- Dashboard with business stats
- Load CRUD with filters
- WhatsApp message parser
- Payment tracking
- Shipper & vehicle management
- Reports (monthly, top shippers, routes)
- Government-app aesthetic (tricolor theme)
- Dark mode support
- Docker + Coolify deployment ready
- Seed data from existing business ledger (88 loads, 41 shippers, 70 vehicles)
2026-06-07 18:57:24 +00:00

19 lines
978 B
SQL

-- ============================================================
-- 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);