问题描述
我已经看到关于外键限制问题的许多问题,我得到的是
默认情况下,以下约束不会复制到客户端:FOREIGN KEY约束,UNIQUE约束和DEFAULT约束
I have seen many Questions on foreign key constraints problem and what I got is that By default, the following constraints are not copied to the client: FOREIGN KEY constraints, UNIQUE constraints, and DEFAULT constraints
:
所以,似乎我必须手动创建关系,一旦在客户端上创建模式。
So, it appears I have to "manually" create the relationships, once the schema is created on the client.
一旦在客户端创建了关系,如果在服务器端对表进行任何更改,我必须重新创建所有关系客户端一次又一次。这不是头痛吗有没有办法编写代码或脚本来创建可以复制的客户端的外键约束。如果我们通过更改脚本在客户端进行服务器端表模式的任何更改。
Once relationship has been created on client side, what if I make any changes in tables on server side, I have to recreate all relationships on client side again and again. Is not it'd be a headache. Is there anyway to write code or script to create foreign key constraints on client side that can be just copied. and if we make any changes on server side tables schema that could be done on client side by changing the script.
推荐答案
得到一个通过同步创建客户端表的解决方案,然后添加代码来生成外键约束。它的简单方法而不是自己生成所有表,然后为它们添加约束。只是复制关系的行,这就是所有。
I've got a solution that create client side table via synchronization and then add code to generate foreign key constraints. its easy way rather than to generate all tables ourselves and then add constraints to them. just copy lines for relations and that's all.
这篇关于同步框架2.1外键限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!