Content Insights Tip #42: Making schema changes


Content Insights Logo

Optimizing Schema Changes in Sitecore Content Hub

Making adjustments to your Content Hub schema is typically a smooth process, but occasionally, things can take an unexpected turn. So, what's causing these hiccups, and how can you adopt best practices for schema alterations? This blog post is here to shed light on these issues.

Common Missteps When Modifying Schema

When it comes to making schema changes, some common pitfalls to avoid include:

  1. Simultaneous Editing: Collaborating with multiple team members on schema modifications is feasible, but keep in mind that it's an all-or-nothing scenario when publishing the new schema. You can't selectively publish changes, so conflicting situations may force you to revert all edits, potentially resulting in wasted time and resources.

  2. Multiple Browser Tabs: Working on the same schema in multiple browser tabs can lead to issues. Browsers cache schema data, which can create conflicts when multiple users access and edit the same schema simultaneously. Small changes may be recoverable, but significant edits could result in significant setbacks.

  3. Different Environments: If you're fortunate enough to have multiple environments, you can sync schema changes across instances. This practice enables you to make and test modifications in a lower environment before going live, saving valuable time and resources. However, it's essential to be cautious as lower environment changes might overwrite alterations made in higher environments.

  4. Lacking Backups: Mistakes are part of the job, and everyone can slip up. Accidental deletions or incorrect field removals can occur. Fortunately, Sitecore keeps regular backups for such situations.

Effective Solutions

Now that we've explored the challenges, let's discuss strategies for overcoming them:


  1. Clear Working Instructions
    Prerequisites:
    • A GitHub repository
    • Content Hub environments (consider a developer sandbox if you have only one production environment)
    • Export your current production schema and store it unzipped in your GitHub repository for easy comparison between versions.

  2. Schema Modification Workflow
    Follow these steps:
    • Import the zipped schema into the lowest environment.
    • Implement the desired schema changes, ensuring you publish them.
    • Export the schema and unzip it, overwriting existing files.
    • Merge any changes made to the schema.
    • Test the alterations in the lower environment.
    • Once approved, proceed to the next environment.

To minimize conflicts, restrict schema changes to a single user within a single browser tab. This will help prevent situations where all changes must be discarded due to conflicts. Also, consider regular testing between minor changes to ensure existing functionality remains intact.

Pro Tip: If you accidentally delete a schema field, don't panic! The data isn't lost. You can recreate the field in the schema, which will restore the data. Just ensure the data hasn't been modified and saved, as Content Hub stores data in JSON format, mapping it to the schema model. After saving the model, any changes to the schema data are stored in JSON, potentially deleting field data. As long as you don't modify the entities, you can safely restore a field or relation.

By following these best practices and maintaining a structured approach, you can streamline schema modifications in Sitecore Content Hub while minimizing disruptions and maximizing efficiency.

Until next time!