Sync schemas between two environments
This article explains how to update one schema with the other, for example, when you have a development and production environment with the same schema that is out of sync.
This video was created using AI avatars and voices to ensure a consistent look and feel. The use of AI matches our culture of using innovative technologies.
Introduction
In the event that you have separate environments, for example, Development, Testing, Acceptance, and Production, you may need to sync the schemas in these environments. You can do this automatically by running the sync process in Prepr.
Use cases
Check out some of the use cases when you may need to synchronize your schema:
- Sync production to development
An example DTAP strategy is to maintain the schema in the Production environment and when the same content structure is needed for realistic test cases this schema needs to be copied to the Development, Test, or Acceptance environment. Learn more on how to set up a DTAP configuration.
- Sync development to production
After testing your development on the latest schema version in the Development or Test environments, it's possible that you may need to make changes to the schema. In this case, you could copy these changes to the Production environment.
- Share a schema between environments
Use the Shared schemas feature to maintain one schema across multiple environments, for example, for multiple brands. Check out more details in the environments doc.
Syncing rules
Here is a list of rules and constraints to keep in mind before you make the schema sync:
-
To sync a schema, you must have the Schema permission for the target environment. Read more about roles and permissions in Prepr.
-
The schema sync only works between environments in the same organization.
-
Models in your target environment will be overwritten with the models from the current environment if their Singular names match. Some fields may be added or deleted to match a new structure.
Please note, even if a model has the same Display name, but different Singular name in the current and target environments, it's treated as a new model for the target environment. To ensure models are matched and updated successfully make sure the Singular name matches.
- Components in your target environment will be overwritten with the components from the current environment if their Type names match. Some fields may be added or deleted to match a new structure.
Please note, even if a component has the same Display name, but different Type name in the current and target environments, it's treated as a new component for the target environment. To ensure components are matched and updated successfully make sure the Type name matches.
-
Models and components that are not in the current environment and present in the target environment aren't removed. You can choose to delete them manually if necessary.
-
Content in your target environment will be updated to match the new schema.
Warning
Once the sync has finished successfully, the changes cannot be undone. Check the current and target environments for any discrepancies or unused fields before making the schema sync.
Schema sync process
The process below shows you how to sync your schema from one environment (current environment) to another (target environment) with a few steps.
Step 1: Choose the source schema
First, decide on the source schema and navigate to the environment in which it was created. This will be your current environment. For example, if you want to copy your Production schema to Development, navigate to the Production environment.
Step 2: Run the schema sync process
Once you’ve opened the chosen environment with the source schema, do as follows:
- Go to Schema tab and click the Sync schema button at the top right. The Sync schema pop-up window will open.
-
In the pop-up window, ensure you read and understand all the syncing rules.
-
Select the target environment you want to sync your schema to. Here you can only choose from the environments of the same organization.
-
Click Sync schema to confirm and start the process.
Step 3: Check the result
After the sync is done, check the results. You can see which models and components were added or updated in your target environment.
Also, you can view models and components that only exist in your target environment. Prepr doesn't automatically remove or update these models and components when it synchronizes the schema. You can do it yourself later on if needed.
That's it! You‘ve synchronized the schema from your current environment to the target environment.
If you have any questions about schema synchronization, please reach out to our Support team.