26 lines
1.1 KiB
SQL
26 lines
1.1 KiB
SQL
-- +goose Up
|
|
-- +goose StatementBegin
|
|
|
|
CREATE TABLE IF NOT EXISTS chat_qrcode_delivery_tasks (
|
|
id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
|
|
conversation_id BIGINT UNSIGNED NOT NULL COMMENT '待补发二维码的会话ID',
|
|
status VARCHAR(16) NOT NULL DEFAULT 'pending' COMMENT '任务状态: pending待补发, sent已补发, failed失败',
|
|
qrcode_id BIGINT UNSIGNED NULL COMMENT '补发使用的二维码ID',
|
|
error_message VARCHAR(255) NOT NULL DEFAULT '' COMMENT '失败原因',
|
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
sent_at DATETIME NULL COMMENT '补发完成时间',
|
|
UNIQUE KEY uk_qrcode_delivery_conversation (conversation_id),
|
|
KEY idx_qrcode_delivery_status_created (status, created_at),
|
|
KEY idx_qrcode_delivery_qrcode (qrcode_id)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='发布群二维码补发任务';
|
|
|
|
-- +goose StatementEnd
|
|
|
|
-- +goose Down
|
|
-- +goose StatementBegin
|
|
|
|
DROP TABLE IF EXISTS chat_qrcode_delivery_tasks;
|
|
|
|
-- +goose StatementEnd
|