Files
admin/db/09_support_feedback.sql
T

36 lines
2.3 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- ============================================================
-- 09_support_feedback.sql
-- 官网问题反馈(support 页面用户提交)
-- ============================================================
CREATE TABLE IF NOT EXISTS `www_support_feedbacks` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`feedback_no` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '反馈编号(对外展示,如 FB20260818A3F2B1',
`product_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联产品 IDwww_products.id',
`product_name_zh` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '提交时产品中文名快照',
`product_name_en` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '提交时产品英文名快照',
`description` TEXT NOT NULL COMMENT '问题描述',
`email` VARCHAR(100) NOT NULL COMMENT '联系邮箱',
`log_file_path` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '日志文件相对路径(/uploads/support-logs/...,空表示未上传)',
`log_file_name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '日志原始文件名',
`log_file_size` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '日志文件大小(字节)',
`status` VARCHAR(20) NOT NULL DEFAULT 'pending' COMMENT '处理状态: pending / processing / resolved',
`visitor_ip` VARCHAR(45) NOT NULL DEFAULT '' COMMENT '访客 IP',
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_feedback_no` (`feedback_no`),
KEY `idx_email` (`email`),
KEY `idx_created` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
COMMENT='官网问题反馈';
-- 若表已存在(无 feedback_no 列),按顺序执行以下迁移:
-- ALTER TABLE `www_support_feedbacks`
-- ADD COLUMN `feedback_no` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '反馈编号(对外展示)' AFTER `id`;
-- UPDATE `www_support_feedbacks`
-- SET `feedback_no` = CONCAT('FB', DATE_FORMAT(`created_at`, '%Y%m%d'), UPPER(SUBSTRING(MD5(CONCAT(`id`, `created_at`)), 1, 6)))
-- WHERE `feedback_no` = '';
-- ALTER TABLE `www_support_feedbacks`
-- ADD UNIQUE KEY `uk_feedback_no` (`feedback_no`);