Files
2026-08-08 15:53:53 +08:00

13 lines
861 B
SQL
Raw Permalink 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.
-- 006 页面编辑模式:为 pages 表增加 mode 字段
-- 用途:后台「页面」编辑支持「固定版面 fixed / 可视化编辑 builder」两种模式
-- 幂等:用 information_schema 判断列是否存在,存在则跳过(兼容 MySQL 5.7 / 8.x 全版本及 MariaDB
-- 旧数据默认 'fixed',渲染行为不变;已用可视化编辑器存过 layout 的页面可手动置为 'builder'
-- 应用方式:后台「系统 / 数据库升级」→ 找到本文件 → 点「升级」
SET @db = DATABASE();
SET @has = (SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'pages' AND COLUMN_NAME = 'mode');
SET @sql = IF(@has = 0, 'ALTER TABLE `pages` ADD COLUMN `mode` VARCHAR(16) NOT NULL DEFAULT \'fixed\' AFTER `layout`', 'SELECT 1');
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;