我犯了一個錯誤,在我的模式中定義一個名爲desc
的列,它是一個保留關鍵字。我很快意識到自己的錯誤並改變了我的模式,將我的模式列名修改爲description
。symfony 1.4:doctrine:build-sql問題
現在,當我運行doctrine:build --all
或doctrine:build-sql
它仍然基於我以前的錯誤生成sql。
我驗證了這一點,因爲它仍在生成語句中的desc
的sql語句,該語句自從被刪除之後。我清除了緩存,刪除了原始的sql文件,並清除了我的日誌。
世界如何是doctrine:build-sql
產生一個完全刪除和刪除的錯誤?我該如何糾正這個問題?
很明顯,直到我可以修復它,doctrine:build
被打破。
編輯:
這裏是我的原始模式:
ReasonCode:
columns:
id: { type: integer, primary: true, notnull: true, autoincrement: true, unique: true }
desc: { type: string }
RejectionCode:
columns:
id: { type: integer, primary: true, notnull: true, autoincrement: true, unique: true }
desc: { type: string }
ConsiderationCode:
columns:
id: { type: integer, primary: true, notnull: true, autoincrement: true, unique: true }
desc: { type: string }
,這裏是我的修訂方案:
ReasonCode:
columns:
id: { type: integer, primary: true, notnull: true, autoincrement: true, unique: true }
name: { type: string }
RejectionCode:
columns:
id: { type: integer, primary: true, notnull: true, autoincrement: true, unique: true }
name: { type: string }
ConsiderationCode:
columns:
id: { type: integer, primary: true, notnull: true, autoincrement: true, unique: true }
name: { type: string }
這裏的生成生成的SQL模式每次:
CREATE TABLE consideration_code (id BIGINT UNIQUE AUTO_INCREMENT, desc TEXT, name TEXT, PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE reason_code (id BIGINT UNIQUE AUTO_INCREMENT, desc TEXT, name TEXT, PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE rejection_code (id BIGINT UNIQUE AUTO_INCREMENT, desc TEXT, name TEXT, PRIMARY KEY(id)) ENGINE = INNODB;
我試了兩種方式:教條:建模 - 然後教條:建立 - 的SQL,然後教條:建立 - 所有,它以正確的順序做一切。這兩種方式仍舊會導致生成的sql與舊的錯誤。我的php生成的模型也包含錯誤,除了修改的列以外還有一個「desc」字段;即我的php模型中有兩列,而在我的模式中,我只有一列。我也試着用教條清理我的模型:clean-model-files,它沒有找到任何清理的東西。我將在我的原始問題中發佈我的模式,但它非常簡單。 – Patrick
我會試一試...支持。 – Patrick
我覺得很愚蠢。感謝你的建議,它讓我想到了答案。當我清空原始模式,然後嘗試清理模型文件時,結果顯示「找不到需要刪除的任何文件」。之後的解決方案變得很明顯:我正在複製並重命名舊的模式文件作爲備份,並將其放在相同的config/doctrine文件夾中。沒有意識到放置在該文件夾中的所有內容都會嘗試運行。我將舊文件移除到不同的目錄並重新運行構建命令。問題解決了。謝啦。 – Patrick