第112批:修Web收银台下单#1406——detail/reason列从VARCHAR迁移为TEXT
根因:core.php建表 `detail TEXT DEFAULT ''` 在老MySQL(<8.0.13)下被方言层 退化成VARCHAR(500),生产实际是varchar(1059)(灾备快照db_schema_mysql.sql为证), 购物车明细JSON超1059字节报 #1406 Data too long for column 'detail'。 修复: - core.php建表去掉 reason/detail 的 DEFAULT(对齐 sync.php/pay.php 等正确版本) - initTables 加存量迁移:PRAGMA table_info 检测列仍是 varchar 则 ALTER MODIFY 回 TEXT (SQLite 下 type=TEXT 不触发;MODIFY 子句由 sqlMySqlTranslateAlterTable 翻译) - admin.php 两处建表同步去掉 DEFAULT - shop.php 加 detail JSON 超长防御(>60000字节精简 items 明细,完整明细已在 orders.db) - db_schema_mysql.sql 灾备快照同步(防 db_guard 恢复时重建回 VARCHAR)
This commit is contained in:
+2
-2
@@ -470,8 +470,8 @@ CREATE TABLE IF NOT EXISTS `web_transactions` (
|
||||
`type` text COLLATE utf8mb4_bin NOT NULL,
|
||||
`amount` bigint(20) NOT NULL,
|
||||
`operator` varchar(500) COLLATE utf8mb4_bin DEFAULT '',
|
||||
`reason` varchar(500) COLLATE utf8mb4_bin DEFAULT '',
|
||||
`detail` varchar(1059) COLLATE utf8mb4_bin DEFAULT '',
|
||||
`reason` text COLLATE utf8mb4_bin,
|
||||
`detail` text COLLATE utf8mb4_bin,
|
||||
`status` varchar(500) COLLATE utf8mb4_bin DEFAULT 'pending',
|
||||
`created_at` bigint(20) DEFAULT '0',
|
||||
`processed_at` bigint(20) DEFAULT NULL,
|
||||
|
||||
Reference in New Issue
Block a user