Migrate schema from between apps, persist schema field validation schemaIds

I have…

  • [ X] Read the following guideline: Troubleshooting and Support | Squidex. I understand that my support request might get deleted if I do not follow the guideline.
  • Used code blocks with ``` to format my code examples like JSON or logs properly.

I’m submitting a…

  • Regression (a behavior that stopped working in a new release)
  • Bug report
  • Performance issue
  • [ X] Documentation issue or request

Current behavior

I have a .net console app to migrate schemas and schema content from one app to another.
When using the SchemaClient to add a new schema (via PostSchemaAsync method), If a Field is a ‘references’ type and has associated schemaIds listed under validation, they are not getting created with that validation in the target app. Is there an additional flag i need to set or a separate api call i need to make?

Expected behavior

Schema Field gets created with associated validation schemaIds in target app

Minimal reproduction of the problem

Environment

App Name:

  • Self hosted with docker
  • [x ] Self hosted with IIS
  • Self hosted with other version
  • Cloud version

Version: [VERSION]

Browser:

  • [ x] Chrome (desktop)
  • Chrome (Android)
  • Chrome (iOS)
  • Firefox
  • Safari (desktop)
  • Safari (iOS)
  • IE
  • Edge

Others:

To be honest, I don’t understand the question. But have you considered to just use the CLI for that:

for instance, here is some sample code for reference
`{
var sourceSchemas = await sourceClient.Schemas.GetSchemasAsync();

foreach (var sourceSchema in sourceSchemas.Items)
{
    var schemaName = sourceSchema.Name;

    var schemaDto = new CreateSchemaDto
    {
        Name = schemaName,
        Fields = sourceSchema.Fields.Select(f => new UpsertSchemaFieldDto
        {
            Name = f.Name,
            Properties = f.Properties,
            Partitioning = f.Partitioning,

        }).ToList(),
        Properties = sourceSchema.Properties,
        Category = sourceSchema.Category,
        IsPublished = true
    };
        await targetClient.Schemas.PostSchemaAsync(schemaDto);

}}`
source app:


target app post migration:

You have to convert them to the new IDs.

1 Like

Ah, i see. Thanks Sebastian.

1 Like