的Yii的文件说DO define foreign-key relationships in the database schema。
你可以试试下列表格吗?警予应该能够拿起两个外键:
create table a (
id int not null primary key,
extraid int not null unique
);
create table b (
id references a(id),
notsamextraid references a(extraid)
);
编辑:要找出是否已经有两个表之间的外键,你可以使用下面的查询。这不是在这个星球上最漂亮的查询,但随后有复制和粘贴:-)
select t1.owner, t1.constraint_name, t1.constraint_type, t1.table_name, c1.column_name,
t2.owner, t2.constraint_name, t2.constraint_type, t2.table_name, c2.column_name
from all_constraints t1
join all_cons_columns c1
on t1.constraint_name=c1.constraint_name
and t1.owner=c1.owner
and t1.table_name=c1.table_name
join all_constraints t2
on t1.owner=t2.owner
and t1.r_constraint_name=t2.constraint_name
join all_cons_columns c2
on t2.constraint_name=c2.constraint_name
and t2.owner=c2.owner
and t2.table_name=c2.table_name
and c1.position=c2.position
where t1.constraint_type = 'R'
and t1.table_name in ('A','B');
我没有权限改变表......我用的方式....在Yii框架中解决这个问题的一种方法? – sasori
如果表b和a之间有两个外键约束,你可以问问设置表的人吗? –
我可以问明天,但是没有任何oracle命令可以用来在sql开发人员中运行,以了解是否有两个关键约束条件? – sasori