mirror of
http://forgejo-oa09toasww4dgii9cj3gpzda.187.127.164.61.sslip.io/iamcoolvivek007/bharath.git
synced 2026-06-11 00:06:51 +00:00
- Govt-app styled freight marketplace - Role-based auth (driver/shipper/broker/admin) - Load board with bidding system - Trip tracking with status flow - In-app messaging - Admin panel - Mobile bottom nav + PWA - Docker + Coolify ready
24 lines
1 KiB
SQL
24 lines
1 KiB
SQL
-- ============================================================
|
|
-- BharathTrucks — Trips Migration
|
|
-- Run AFTER loads migration
|
|
-- ============================================================
|
|
|
|
CREATE TABLE IF NOT EXISTS trips (
|
|
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
|
|
load_id UUID NOT NULL REFERENCES loads(id),
|
|
driver_id UUID NOT NULL REFERENCES app_users(id),
|
|
shipper_id UUID NOT NULL REFERENCES app_users(id),
|
|
bid_id UUID NOT NULL REFERENCES bids(id),
|
|
amount NUMERIC(10,2) NOT NULL,
|
|
status TEXT DEFAULT 'confirmed' CHECK (status IN ('confirmed', 'picked_up', 'in_transit', 'delivered', 'cancelled')),
|
|
picked_up_at TIMESTAMPTZ,
|
|
delivered_at TIMESTAMPTZ,
|
|
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_trips_driver ON trips(driver_id);
|
|
CREATE INDEX IF NOT EXISTS idx_trips_shipper ON trips(shipper_id);
|
|
CREATE INDEX IF NOT EXISTS idx_trips_status ON trips(status);
|
|
|
|
ALTER TABLE trips ENABLE ROW LEVEL SECURITY;
|
|
CREATE POLICY "Allow all on trips" ON trips FOR ALL USING (true) WITH CHECK (true);
|