97久久国产亚洲精品超碰热,成人又色又爽的免费网站,色偷偷女人的天堂a,男女高潮喷水在线观看,国内精品一线二线三线区别在哪里

Discuz! 官方交流社區(qū)

標(biāo)題: 分表升級失敗 [打印本頁]

作者: VRobin    時(shí)間: 2023-1-12 13:07
標(biāo)題: 分表升級失敗
執(zhí)行流程

?step=innodb&table=pre_forum_post_1

  1. (1075) Incorrect table definition; there can be only one auto column and it must be defined as a key
  2. ALTER TABLE forum_post_1 ENGINE=InnoDB;
復(fù)制代碼


get_scheme_update_sql 沒有對分表僅需處理



作者: 老周部落    時(shí)間: 2023-1-13 22:45
感謝您的反饋,我們寫個(gè)了修復(fù),可以參考下。
具體得等測試,測試好了再合并。

  1. if (preg_match("/^pre_forum_post_(\\d+)$/i", $table)) {
  2.         logmessage("$table is special post table, need special alter.");
  3.         $sql = "ALTER TABLE ".str_replace(' pre_', ' '.$config['tablepre'], $table)." MODIFY COLUMN position INT unsigned NOT NULL DEFAULT \'0\'";
  4.         logmessage("RUNSQL ".$sql);
  5.         DB::query($sql);
  6.         logmessage("RUNSQL Success");
  7. } else {
  8.         $sql = get_innodb_scheme_update_sql($table);
  9.         logmessage("RUNSQL ".$sql);
  10.         DB::query($sql);
  11.         logmessage("RUNSQL Success");
  12. }
復(fù)制代碼

作者: sohigh    時(shí)間: 2023-4-16 16:45
本帖最后由 sohigh 于 2023-4-16 17:15 編輯
老周部落 發(fā)表于 2023-1-13 22:45
感謝您的反饋,我們寫個(gè)了修復(fù),可以參考下。
具體得等測試,測試好了再合并。

$sql = "ALTER TABLE ".str_replace(' pre_', ' '.$config['tablepre'], $table)." MODIFY COLUMN position INT unsigned NOT NULL DEFAULT \'0\'";

這句沒執(zhí)行
logmessage("$table is special post table, need special alter.");都沒顯示在日志里


作者: 天外飄仙    時(shí)間: 2023-4-16 17:15
sohigh 發(fā)表于 2023-4-16 16:45
pre_forum_post_1  的 position列已經(jīng)變成了自增列,也是主鍵了。但是還報(bào)錯(cuò)

(1075) Incorrect table defi ...

去掉 自增 就好了
作者: sohigh    時(shí)間: 2023-4-16 17:16
天外飄仙 發(fā)表于 2023-4-16 17:15
去掉 自增 就好了

是我搞錯(cuò)了,問題是
$sql = "ALTER TABLE ".str_replace(' pre_', ' '.$config['tablepre'], $table)." MODIFY COLUMN position INT unsigned NOT NULL DEFAULT \'0\'";

這句沒執(zhí)行
logmessage("$table is special post table, need special alter.");都沒顯示在日志里
作者: 天外飄仙    時(shí)間: 2023-4-16 17:24
sohigh 發(fā)表于 2023-4-16 17:16
是我搞錯(cuò)了,問題是
$sql = "ALTER TABLE ".str_replace(' pre_', ' '.$config['tablepre'], $table)."  ...

自己 手動操作數(shù)據(jù)庫表 就好了……

Navicat連接數(shù)據(jù)庫,  表上 右鍵  設(shè)計(jì) 數(shù)據(jù)庫, 選中字段,  去除 自增勾選, 然后保存 就可以了
作者: sohigh    時(shí)間: 2023-4-19 21:17
天外飄仙 發(fā)表于 2023-4-16 17:24
自己 手動操作數(shù)據(jù)庫表 就好了……

Navicat連接數(shù)據(jù)庫,  表上 右鍵  設(shè)計(jì) 數(shù)據(jù)庫, 選中字段,  去除 自增 ...

我是這樣操作的,我想說怎么腳本沒用,是不是哪里錯(cuò)了,你們再查下?方便后面的人




歡迎光臨 Discuz! 官方交流社區(qū) (http://r615.cn/) Powered by Discuz! X5.0