Patch update for syncronization

HI, I had an issue in synchronization phase, when I need to migrate from ‘A’ app to ‘B’ app, and --patch-content doest effect.
So I after this step, I get mirrored apps.

Steps to reproduce
sq config use A
sq sync out v1
sq config use B
sq sync in --patch-content v1

Please fully implement patch update.

I don’t get it. Can you give me more details?

I think I know what the problem is.

The patch parameter needs an update to Squidex, which has not been released officially yet.

When we can get that update ?

@Sebastian or if can use some docker version, to have that feature we can go with that way.

In current time, when I do some changes in B applications, and do some changes in A applications, after sync in out, I lose updates from B.

You can try docker-tag dev-6932, but this will not solve your problem.

The sync command only works on full contents, like a primary-secondary replication. For a primary-primary sync you need a conflict resolution mechanism, or something like a per-field change-log.

Lets say you have 2 fields A, B

You start with A: a1, B: b1 and create a clone of your app.

Now server 1 changes A to a2 server 2 changes B to b2. How do you know that a2 and b2 is correct?

1 Like

For my case A is development application, and B is application for client, I mean production.
In Start when I have in A: a1: 1, and clone that to B: a1:1
After that I give B application to client, and hi change B: a1: 2,
After, I do my development in A: a1: 1, a2: 2.
When I finish my development we have this state
A: a1:1, a2: 2
B: a1: 2,
After that I need to merge them.
But in current time I get this result
A: a1: 1, a2:2
B: a1: 1, a2:2
B Application loses his data.

Yes, you described the same problem. But how do you know that a1: 1 is not correct? It is just not solved by the sync command and I am not sure if there is an easy solution for that.

Perhaps you can solve it with a special sync command, where you create diffs of multiple versions before you sync in something, so basically a base line.

So your “base line” would be { A: a1, B: b1 }

Then Server X calculates the diff from { A: a2, B: b1 } => { A: a2 }
Then Server Y calculates the diff from { A: a1, B: b2 } => { B: b2 }

Then Server X applies the diff { A: a2 } + { A: a1, B: b1 } => { A: a2, B: b1 }
Then Server Y applies the diff { B: b2 } + { A: a2, B: b1 } => { A: a2, B: b2 }

But it depends on the order, and you can only do it on a per field level (no arrays).

a1:1 is not correct, beacuse the B client application changes is primary for me, because it changes from client. And I need to keep everything what client changed. I need only add new elements

But you don’t know that a field has not been changed by a client. I mean the client could have changed B from b1 to b2 to b1.

In any case, I need to save all client content changes. and add only new added content. Can you help me ?

If we adda flag to the sync to make an insert instead of an upsert, then it would fail for all existing contents. Would this help?

What you mean will fail ?
Will be perfect if cli can find diff, and add to B only new added

The sync command would output an error for all content items that already exist on B.

Okay, I need skip syncing for elements that already exists. And add new items.

Yes, this would skip them. I can provide an update to the CLI today.

1 Like

Thank you will wait for your update.

A new version (CLI v8.18.0) has been released. You can add the flag --content-action Create to the sync command.

1 Like

I downloaded that version. Saw an update --content-action.
Try this command sync in folder --content-action=Upsert
After that A overrides B content again, maybe another flag I need to use, or I run the wrong command ?