12th_fix error
This commit is contained in:
@@ -127,6 +127,31 @@ def create_tables():
|
||||
FOREIGN KEY (user_id) REFERENCES dt_users(id) ON DELETE SET NULL,
|
||||
FOREIGN KEY (job_id) REFERENCES dt_translation_jobs(id) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
''',
|
||||
|
||||
'dt_notifications': '''
|
||||
CREATE TABLE IF NOT EXISTS dt_notifications (
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
notification_uuid VARCHAR(36) NOT NULL UNIQUE COMMENT '通知唯一識別碼',
|
||||
user_id INT NOT NULL COMMENT '使用者ID',
|
||||
type VARCHAR(20) NOT NULL DEFAULT 'info' COMMENT '通知類型',
|
||||
title VARCHAR(255) NOT NULL COMMENT '通知標題',
|
||||
message TEXT NOT NULL COMMENT '通知內容',
|
||||
job_uuid VARCHAR(36) NULL COMMENT '關聯任務UUID',
|
||||
link VARCHAR(500) NULL COMMENT '相關連結',
|
||||
is_read BOOLEAN DEFAULT FALSE NOT NULL COMMENT '是否已讀',
|
||||
read_at TIMESTAMP NULL COMMENT '閱讀時間',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '建立時間',
|
||||
expires_at TIMESTAMP NULL COMMENT '過期時間',
|
||||
extra_data JSON NULL COMMENT '額外數據',
|
||||
INDEX idx_notification_uuid (notification_uuid),
|
||||
INDEX idx_user_id (user_id),
|
||||
INDEX idx_job_uuid (job_uuid),
|
||||
INDEX idx_is_read (is_read),
|
||||
INDEX idx_created_at (created_at),
|
||||
FOREIGN KEY (user_id) REFERENCES dt_users(id) ON DELETE CASCADE,
|
||||
FOREIGN KEY (job_uuid) REFERENCES dt_translation_jobs(job_uuid) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
'''
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user