Files
hldrCenter/server/sql/page_imgs/page_imgs.sql
2025-11-01 23:36:31 +08:00

15 lines
1.1 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.
CREATE TABLE page_image (
id INT NOT NULL AUTO_INCREMENT COMMENT '图片ID主键',
page VARCHAR(50) NOT NULL DEFAULT '' COMMENT '所属页面home-首页base-overview-基地概况等)',
image_url VARCHAR(512) NOT NULL DEFAULT '' COMMENT '图片URL',
sort INT NOT NULL DEFAULT 0 COMMENT '排序首页1-3其他页面1',
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
-- 单独一行显式声明主键,确保 goctl 识别
PRIMARY KEY (id),
-- 唯一约束也单独声明
UNIQUE KEY uk_page_sort (page, sort) COMMENT '控制同一页面+排序唯一'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT '页面图片表';
-- 索引单独创建
CREATE INDEX idx_page ON page_image (page) COMMENT '按页面查询';