順便說一句,我使用zendframework,學說1.2和MYSQL有助於瞭解和修復MySQL錯誤消息的整體性破壞:1452
//錯誤 消息:SQLSTATE [23000]:完整性約束違規:1452不能添加或更新子行:外鍵約束失敗(gepm2
Regions
,約束Regions_id_Districts_regions_id
外鍵(id
)參考文獻Districts
(regions_id
))
事情是我存儲數據到區表,這些區域的值[ ID :AR, 名稱:測試名稱, Countries_id:UK]
enter code here
##YAML
Country:
tableName: Countries
columns:
id:
type: string(3)
fixed: true
primary: true
notnull: true
name:
type: string(45)
default: null
currency:
type: string(3)
fixed: true
default: null
Region:
tableName: Regions
columns:
id:
type: string(2)
fixed: true
primary: true
notnull: true
name:
type: string(45)
default: null
Countries_id:
type: string(3)
fixed: true
primary: true
notnull: true
relations:
country:
class: Country
local: Countries_id
foreign: id
foreignAlias: regions
foreignType: many
owningSide: true
indexes:
fk_Regions_Countries:
fields: [Countries_id]
District:
tableName: Districts
columns:
id:
type: string(3)
fixed: true
primary: true
notnull: true
name:
type: string(45)
default: null
Regions_id:
type: string(2)
fixed: true
primary: true
notnull: true
relations:
region:
class: Region
local: Regions_id
foreign: id
foreignAlias: districts
foreignType: many
owningSide: true
indexes:
fk_Districts_Regions1:
fields: [Regions_id]