0

desc予約済みのキーワードであるという名前の列を自分のスキーマで定義するのを間違えました。私はすぐに間違いに気づき、スキーマを変更して、スキーマの列名を に変更しましたdescription

今、私が実行したとき、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;
4

1 に答える 1

1

doctrine:build-sql生成されたモデル (php クラス) に基づいて SQL を生成します。最初に を使用してモデルを再生成する必要がありますdoctrine:build-model

descに別のフィールドがありませんschema.ymlか? フォルダを空にしようとしましたcacheか? を貼り付けていただけますschema.ymlか?

フィールドはdescまだ生成されたモデル (php ファイル) にありますか?

編集:

もう1つの根本的な解決策:

  1. あなたを空にするschema.yml
  2. doctrine:clean-model-filesすべての古いモデルをきれいにするために実行します
  3. あなたの新しいschema.yml(修正されたもの)を置く
  4. 再実行doctrine:build --all
于 2012-07-03T15:02:38.203 に答える