-
Hello! I’m using Dotmim Sync for a project where multiple clients (running a custom POS system with SQLite) sync to a central SQL Server DB via HTTP. The setup includes the following tables:
Some tables are set to "UploadOnly" because transactions are unique to each payment station (e.g., Transaction 1 for PS 1), and stations don’t need the same data. The Issue: Occasionally, a payment station goes unused for a while, making its local data outdated. When I try to sync, I need to trigger a reinitialization. From the documentation, it seems reinitialization causes data loss by deleting all client rows and downloading them again. Question: Is there a way to preserve existing data during reinitialization? After reinitializing, when I start syncing again, the server data gets overwritten due to the conflict resolution policy, which I’d like to avoid. I understand that the conflict resolution policy can be modified, but I specifically need to keep the server data intact. Ideally, I’d like a "Reinitialize and Download Once" behavior. Would an interceptor be useful in this case, or is there another approach I should consider? Any guidance would be greatly appreciated. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You want to keep the rows for all tables that are upload only right, when making a reinit ? Once thing you can test (I didn't test, but it's worth a try) is to intercept the command when a reset is occurring. agent.LocalOrchestrator.OnGetCommand(args =>
{
if (args.CommandType == DbCommandType.Reset)
{
var setupTable = args.ScopeInfo.Setup.Tables[args.Table.TableName, args.Table.SchemaName];
if (setupTable != null && setupTable.SyncDirection == SyncDirection.UploadOnly)
args.Command.CommandText = "Select 1;";
}
}); All the rows from Let me know if it's working |
Beta Was this translation helpful? Give feedback.
You want to keep the rows for all tables that are upload only right, when making a reinit ?
Once thing you can test (I didn't test, but it's worth a try) is to intercept the command when a reset is occurring.
The idea is to replace the
CommandText
property with something that will work but will not delete all the rows:All the rows from
UploadOnly
tables,…