Unicorn Sync – Production environment

Hello friends,

Today I would like to talk about a problem statement and its possible solution or workaround.

Problem Statement:

Suppose you are using Unicorn for Sitecore item serialization. You have deployed your code and Sitecore items on staging/Production environment and released it to client/content author for content entry. So content author is doing content entry regularly and developers are doing their development as well. After sometime developers deployed the code and Sitecore item and ran unicorn sync. What will happen?

It would over right the staging/Production content. 🙂

What is the resolution of this issue?

Solutions – 1 (Create multiple unicorn configuration files)

You can create multiple unicorn configuration files for non-production and production environment. In the production environment, you can disable sync for home and its children by excluding Home item in the unicorn configuration file.

Solutions -2 (Sync items those are new on disk)

Using unicorn configuration file (Unicorn.Configs.NewItemsOnly.Example), you can override the default behavior of unicorn to load/sync only items that are new on the disc. In this way, your existing item(s) will not be over write. When you run unicorn sync, it would sync only new items. It will not do anything for the existing items.

 

Thanks for your time.

Leave a comment