问题
Well, i'm probing Sync Framework 2.1. It worked great, until i altered a table and added a column. There's a lot written about the theme. Here is my approach
- Alter table and add a column in the databases (master, and slaves)
- rename tracking tables (ex, from todos_tracking to todos_tracking_back)
- Drop the original providing scope
- create a new scope with the same name as the former, skipping the creation of tracking tables
- rename tracking tables to the original name (ex, from todos_tracking_back to todos_tracking)
All of this it just for no losing the track of changes. Spacially for huge data tables.
What was the result? when i update an existing row or delete it the changes are not reflected in the syncronization. But, when i insert a new row the changes are reflected.
Someone has experience with this kind of things?
In my job sometime we need to alter tables adding new columns. And now we are in the need for syncronizing databases.
Hope be clear. Thanks in advance.
回答1:
in step #3, when you drop the scope, you effectively dropped the sync knowledge of what was synched. you might was well just deprovision and reprovision.
tracking tables simply stores what was changed, it doesnt store what was synched. that's in the scope table's knowledge columns.
since you dropped the scope sync knowledge, sync fx has no way to tell that tables from both databases contains similar data. it then tries to apply the existing rows from one database to the other and you are most likely running into conflicts.
try subscribing to ApplyChangesFailed event and you should see conflicts firing.
new inserts will work because these are previously non-existing rows.
来源:https://stackoverflow.com/questions/12285307/sync-framework-and-add-columns