Changeset 0.20.0 (#85)
This commit is contained in:
17
server/database/migrations/007_v0200_notifications.sql
Normal file
17
server/database/migrations/007_v0200_notifications.sql
Normal file
@@ -0,0 +1,17 @@
|
||||
-- 007_v0200_notifications.sql
|
||||
-- Notification infrastructure (v0.20.0 Phase 1)
|
||||
|
||||
CREATE TABLE IF NOT EXISTS notifications (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
type VARCHAR(50) NOT NULL,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
body TEXT DEFAULT '',
|
||||
resource_type VARCHAR(50),
|
||||
resource_id UUID,
|
||||
is_read BOOLEAN DEFAULT false,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_notifications_user_unread ON notifications(user_id, is_read, created_at DESC);
|
||||
CREATE INDEX IF NOT EXISTS idx_notifications_user_created ON notifications(user_id, created_at DESC);
|
||||
Reference in New Issue
Block a user