顺便说一句,我使用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]