Update: 2026-05-08 01:41:28
This commit is contained in:
18
scripts/create_notifications_table.sql
Normal file
18
scripts/create_notifications_table.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- Notifications Table
|
||||
CREATE TABLE IF NOT EXISTS notifications (
|
||||
id CHAR(36) PRIMARY KEY,
|
||||
user_id CHAR(36) NOT NULL,
|
||||
tenant_id CHAR(36) NOT NULL,
|
||||
title VARCHAR(255) NOT NULL,
|
||||
body TEXT,
|
||||
type ENUM('info', 'success', 'warning', 'error') DEFAULT 'info',
|
||||
category VARCHAR(50) DEFAULT 'general',
|
||||
entity_type VARCHAR(50) NULL,
|
||||
entity_id CHAR(36) NULL,
|
||||
is_read TINYINT(1) DEFAULT 0,
|
||||
read_at TIMESTAMP NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
INDEX idx_user_read (user_id, is_read),
|
||||
INDEX idx_tenant (tenant_id),
|
||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
Reference in New Issue
Block a user