24 lines
914 B
SQL
24 lines
914 B
SQL
-- +goose Up
|
|
-- +goose StatementBegin
|
|
|
|
CREATE TABLE IF NOT EXISTS admin_notifications (
|
|
id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
|
|
admin_user_id BIGINT UNSIGNED NOT NULL COMMENT '接收管理员ID',
|
|
type VARCHAR(32) NOT NULL COMMENT '通知类型: system系统, chat聊天等',
|
|
title VARCHAR(128) NOT NULL COMMENT '通知标题',
|
|
content TEXT NULL COMMENT '通知内容',
|
|
is_read TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已读',
|
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
KEY idx_admin_notifications_user_read_created (admin_user_id, is_read, created_at)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='管理员通知消息表';
|
|
|
|
-- +goose StatementEnd
|
|
|
|
-- +goose Down
|
|
-- +goose StatementBegin
|
|
|
|
DROP TABLE IF EXISTS admin_notifications;
|
|
|
|
-- +goose StatementEnd
|