You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So now the library does support serialization and deserialization for multiple Slate JSON versions, making it possible to gradually migrate database content to the new Slate version. At the moment of writing this, prezly/slate-php does support three (slightly) different JSON serialization formats (and can be extended to more in future):
v0.27 ... v0.39 — block nodes with isVoid property
v0.40 ... v0.45 — isVoid dropped
v0.46 ... ? — leaf objects are not used anymore
This helps to disconnect Slate backend model upgrade from Slate frontend package.
Here's how we handle the v0.40 → v0.46 upgrade.
We've implemented a preconfigured Value serializer to be used throughout our application.
The application always serializes/deserializes Slate values using the above DefaultSerializer. This allows us to normalize all the incoming slate content to the baseline version. Baseline version is the version of the frontend Slate JS package.
When the frontend is updated, we bump the baseline version to 0.46 to start generating the new Value JSON without leaf objects. All the previously db-stored content will be automatically translated to the new 0.46 format.
We can then iterate over all the db values to gradually re-write them to the newest baseline version, if we want to.
e1himself
changed the title
Help handle slate model version updates
Help handle slate model version updates (v0.40 → v0.46)
Jul 5, 2019
Migrating content from one version to another is always a painful task. Especially when there are structural changes.
It would be great if this library did provide version-aware Value serialization.
A good example is Slate
v0.46
update that merges Leaf and Text nodes data into Text node.Before
v0.46
:After
v0.46
:The text was updated successfully, but these errors were encountered: