Skip to content

Conversation

@Migaroez
Copy link
Contributor

@Migaroez Migaroez commented Oct 27, 2025

Description

This PR introduces a migration for all BlockLists datatypes and their properties that have correctly been configured with "single mode" to a singleblock equivalent.

The migration has been disabled and will at the earliest be enabled in 18.0 but can be ran by an implementor using their own upgrade plan.
It can also be extended to support other propetyEditors that might encapsulate one of our block based editors.
For more information, consult the documentation_wip.

Testing

A database with one or more blocklists configured with "single mode" will be required. Preferable with that blocklist being nested in other types.

Be warned that the front end part of the single block property editor is not yet ready and you will need to verify the transformation in the db or trough the management api.

In the linked example below, the element doctype has key 'f764977e-72bd-4da4-9b3a-fdcd83592554' and the alias of the single blocklist property is 'single'. (PR lenght doesn't allow including the whole result)
https://gist.github.com/Migaroez/2c025bb1d7c49322431bdc7144bde3c4#file-before-migration-json
https://gist.github.com/Migaroez/2c025bb1d7c49322431bdc7144bde3c4#file-after-migration-json

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Impressive work @Migaroez. I've done a test with a single block list in single block mode and a nested one. I see the expect result in the logs after running the migration:

[16:34:01 INF] Found 1 number of blockListConfigurations with UseSingleBlockMode set to true
[16:34:01 INF] Migration starting for all properties of type: Umbraco.BlockList
[16:34:01 INF] Migration starting for all properties of type: Umbraco.RichText
[16:34:01 INF]   - 2 properties converted, saving...
[16:34:01 INF]   - 2 properties converted, saving...
[16:34:01 INF] Migration succeeded for all properties of type: Umbraco.BlockList
[16:34:01 INF] Migration succeeded for all properties of type: Umbraco.RichText
[16:34:01 INF] At {74332C49-B279-4945-8943-F8F00B1F5949}
[16:34:01 INF] Done

And the expected result on screen:

image

Here's the migrated data for the former:

{
  "layout": {
    "Umbraco.SingleBlock": [
      {
        "$type": "SingleBlockLayoutItem",
        "contentUdi": null,
        "settingsUdi": null,
        "contentKey": "bfad0617-770b-4393-b981-709629eec9b6",
        "settingsKey": null
      }
    ]
  },
  "contentData": [
    {
      "contentTypeKey": "9d3a2959-4e50-464e-9e84-bf60a8400f80",
      "udi": null,
      "key": "bfad0617-770b-4393-b981-709629eec9b6",
      "values": [
        {
          "editorAlias": "Umbraco.TextBox",
          "culture": null,
          "segment": null,
          "alias": "text",
          "value": "Test 1"
        }
      ]
    }
  ],
  "settingsData": [],
  "expose": [
    {
      "contentKey": "bfad0617-770b-4393-b981-709629eec9b6",
      "culture": null,
      "segment": null
    }
  ]
}

I pushed an update for few minor code warning resolutions but otherwise I think the only thing I'd say in review is that I think I'd benefit from a few more code comments, as there are a few pieces here and it's quite involved.

Please could you look at adding XML header comments on all the interfaces, classes and non-private methods, so it's a bit clearer what everything is for, and perhaps annotate a bit more the main MigrateSingleBlockList file? Especially given we aren't looking active this until Umbraco 18, I think whoever might have a need to debug this - or your future self 😉 - might appreciate it.

@iOvergaard iOvergaard changed the base branch from v17/dev to main October 30, 2025 10:53
Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - I think that'll help anyone coming to this in the future and having to make changes or debug issues.

# Conflicts:
#	src/Umbraco.Infrastructure/Migrations/Upgrade/UmbracoPlan.cs
@AndyButland AndyButland enabled auto-merge (squash) November 11, 2025 11:06
@AndyButland AndyButland merged commit 0858d02 into main Nov 11, 2025
25 of 26 checks passed
@AndyButland AndyButland deleted the v17/feature/single-blocklist-migration branch November 11, 2025 11:43
@AndyButland AndyButland changed the title Single block migration Migrations: Provide migration for single block property editor Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants