Mysql 继续得到约束冲突?
这是我的schema.ymlMysql 继续得到约束冲突?,mysql,database,doctrine,Mysql,Database,Doctrine,这是我的schema.yml Products: columns: title: { type:string(35) } img_path: { type: string(100) } is_activated: { type: boolean, notnull: true, default: 0 } price: { type: integer, notnull: true } Auctions: columns: pid: { type:
Products:
columns:
title: { type:string(35) }
img_path: { type: string(100) }
is_activated: { type: boolean, notnull: true, default: 0 }
price: { type: integer, notnull: true }
Auctions:
columns:
pid: { type: bigint }
last_bider: { type: bigint }
starts_at: { type: timestamp, notnull: true }
ends_at: { type: timestamp, notnull: true }
relations:
Products:
local: pid
foreign: id
User:
local: last_bider
foreign: id
User:
columns:
username: { type: string(20) }
In.yml
Products:
my_pendant:
title: 1 Gram Gold Rose Pendant
img_path: test/pendant.jpg
is_activated: 1
price: 25
User:
username1:
username: denis
Auctions:
pendant_auc:
pid: my_pendant
last_bider: username1
starts_at: 2011-26-06
ends_at: 2011-28-06
我不断受到约束违反:
尝试将夹具插入数据库时,无法添加或更新“pid”和“id”上的子行-拍卖和产品之间的关系
我在用教义。。。我不明白为什么会发生这种情况。我自己的一个问题:那么YAML会自动为您分配pk元素吗?我会说pid在产品定义中缺失,但我不会相信上帝。。。几个小时后,我找到了解决办法。fixture(拍卖表)中的pid和last_bider必须写为表名,而不是列名。