How can data models (data types) be changed in Pimcore without losing data?

When data types are changed in Pimcore, the data previously entered in the objects is usually lost. Users must therefore weigh up whether they would rather keep a suboptimal data model or maintain data at great expense.

The Pimcore Data Director Bundle developed by Blackbit provides a remedy: 

The bundle allows you to adapt your data model to new requirements and Pimcore developments without losing data. 

When data is imported into Pimcore with the Pimcore Data Director, the following three steps take place:

  1. Importing the raw data from a data source
  2. Editing the raw data
  3. Importing the data into the Pimcore data objects

The Pimcore objects themselves can also serve as the data source for the first step. To convert the data type of an object field, the first step is to fetch the data from the Pimcore objects. Then you can adapt the data type of the object field (or the object module or the field collection). Of course, in this case, the data is also lost for the time being. But now you can import into the changed object fields on the basis of the raw data.

You can find an illustrative example of lossless data model transformation with the Pimcore Data Director Bundle here in our video tutorial.