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
19 lines
794 B
SQL
19 lines
794 B
SQL
-- ============================================================
|
|
-- BharathTrucks — Messages Migration
|
|
-- ============================================================
|
|
|
|
CREATE TABLE IF NOT EXISTS messages (
|
|
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
|
|
sender_id UUID NOT NULL REFERENCES app_users(id),
|
|
receiver_id UUID NOT NULL REFERENCES app_users(id),
|
|
load_id UUID REFERENCES loads(id),
|
|
content TEXT NOT NULL,
|
|
is_read BOOLEAN DEFAULT FALSE,
|
|
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_messages_receiver ON messages(receiver_id, is_read);
|
|
CREATE INDEX IF NOT EXISTS idx_messages_sender ON messages(sender_id);
|
|
|
|
ALTER TABLE messages ENABLE ROW LEVEL SECURITY;
|
|
CREATE POLICY "Allow all on messages" ON messages FOR ALL USING (true) WITH CHECK (true);
|