Projects synchronization

Current behavior

Hi, Sebastian.

We have two different environments in our project (“dev”, “prod”). We would like to transfer all the data from one project to another (it is necessary for our CI).

So, I’ve investigated the topic, in which you showed an example, how to synchronize ONE schema. Can I do something alike for all schemas in my app regardless of the schema names? As I got, we can get certain schema of the project (sq schemas get schema1 > schema.json), then we can sync schema(sq schemas sync schema.json). And we can do the same process for all schemas one by one. But there also is a command (sq schemas list > ./schemas/schemas.json), which allows to save ALL schemas of the project in json. Perhaps, there is a way, which I can proceed to implement ALL schemas synchronization in one command?

I’ve also had a look on this. Can this mechanism help me achieve what I want?

Or, perhaps, it will be better to use backups?

Expected behavior

Synchronization after getting all schemas regardless of the schema names

Minimal reproduction of the problem

Environment

  • [x] Cloud version
  • CLI version is 5.2

Browser:

  • [x] All

Hi, there is a full sync tool now: https://docs.squidex.io/02-documentation/developer-guides/automation-tools#synchronize-all-app-settings-beta

If you want to clone your app as a one-time thing I can also handle it for you and restore a backup with another app name.

Wow, fast reply :+1:

Unfortunately, it is going to be not only one time operation (as part of the CI), so, as I got, I’ll not be able to use backups…

But I tried the tool you mentioned, and nothing happened with my schema in the cloud. Let me reproduce all commands one by one, (maybe I messed something?). Case: move all data from “text-source” project (with some data) to “test-destination” (which is empty).

  • Creating two configurations for each project (and select test source)

  • sq sync new ./sync. After that the folder condition is:

image

  • sq config use test-destination

  • sq sync in ./sync. After that I have the following output:

But my schema doesn’t have any data. I believe, I just got something wrong… (btw I can see, that there are several requests in the API call log, but these requests are all GET).

How have you defined your schemas? The files with __ are ignored and only templates. But you can also export your current config to the folder with sq sync out and then import it.

Yes, it works. Thank you very much :hugs:.
The only question left is contents. As I got, I have to import it separatedly with the schema?

Yes, the problem is that there is no possible automatic export, because of how references are handled right now.

And the only way to do it is following command:
sq content export -u -output=./sync/contents/page1.json --format=JSON page1

But maybe there is a way to export contents of all schemas of the app and then import this contents?

At the moment it is not possible. The problem are references and assets. But I can probably provide a solution that works for everything except references and assets.

Got you. Thank you very much

@Sebastian hello,one again. Having a problem with import of JSON. I’m trying to run the following commands:

@Sebastian First one is export
sq content export terms-and-conditions --output=./dev-data/contents/terms-and-conditions.json --format=JSON
And next is import:
sq content import --format=JSON --fields=devId,main-header.en=main-header,main-header.de-DE=main-header,download-pdf-link.en=download-pdf-link,download-pdf-link.de-DE=download-pdf-link terms-and-conditions .\dev-data\contents\terms-and-conditions.json

We have two languages in our app: en (English) and de-DE(German (Germany)).
The structure of schema “terms-and-conditions” is below:

But every time I’m trying to “import”, I receive the following label:

Imported: 0. Completed.

Perhaps, I missed something?

Hi, your problem is the same like this: Import schema content issues

But this topic uses a different command.

@Sebastian the same situation with CSV import. Always receiving fields with “invalid” label, when exporting data :sleepy:

What structure do you get after export? Can you post the header of your CSV file?