After upgrading from Drupal v9.1.7 to v9.2.0, on a lot of nodes the custom layout builder override layouts were reset to the default layout, resulting in a massive data loss. To make things worse, this only happened on live and not on stage, and was only noticed a few days later. I don't know what has caused the issue, the customer is pretty upset, and I quickly and selectively need to restore the override layouts from a DB snapshot the night before the update (and leave the rest of the data untouched).
So far I know two things:
- All affected nodes have a
node.changed
timestamp matching the time of the update deployment.
- On all affected nodes
node__layout_builder_layout
has been trimmed to one section (same as the default, non-override layout)
- On all affected nodes only the last revision is lost, without generating a new revision id.
- The override layouts usually consist of custom, non-reuseable
block_content
blocks. All the blocks still seem to exist in the DB.
I'd like to know:
- How can I check if a node has an override layout, or is using the default layout of the layout builder (if possible with a plain SQL query, without PHP)
- What else do I need to restore except the
node__layout_builder_layout
table (assuming custom content blocks used by the override layouts still seem to exist) to restore a node's override layout
- Can I savely use SQL
where a <> b
or SQL where a = b
with a
and b
being the blob content of node__layout_builder_layout.layout_builder__layout_section
?