0
中関係は以下の、多くの関係1つを作成しようとしていますと、問題が直面していますのsymfony 1.4 - ドクトリン - モデルスキーマ
Country:
actAs:
Timestampable: ~
I18n:
fields: [country_name]
columns:
country_code: { type: string(30), notnull:true, unique: true }
country_name: { type: string(200), notnull:true }
country_flag: { type: string(200), notnull: flase }
created_by: {type: bigint, notnull: true }
updated_by: {type: bigint, notnull: false }
relations:
sfGuardUser1: { local: created_by, foreign: id, class: sfGuardUser }
sfGuardUser2: { local: updated_by, foreign: id, class: sfGuardUser }
City:
actAs:
Timestampable: ~
I18n:
fields: [city_name]
columns:
city_name: { type: string(100), notnull: true }
country_code: { type: integer, notnull: true }
created_by: {type: bigint, notnull: true }
updated_by: {type: bigint, notnull: false }
relations:
Country:
local: country_code
foreign: country_code
class: Country
sfGuardUser1: { local: created_by, foreign: id, class: sfGuardUser }
sfGuardUser2: { local: updated_by, foreign: id, class: sfGuardUser }
が生成されたSQLである私のYMLのsechmaです。上記のymlは両方のテーブルに制約を作成していますが、私はCityテーブルの制約を作成するだけです。どのように私はそれを行うことができます考えですか?
よろしく、id
へ
どのような制約について話していますか? – greg0ire
Countryテーブルのcountry_code列に「unique:true」と表示されていますか? – Tom
この外部キーの制約はありますか?そうであれば、モデル内の関係を手動で管理し、スキーマから取り除くことによってのみそれらを取り除くことができます。 – benlumley