Converting an entity with existing contents to revisionable throws exception

I’m trying to convert a core entity (menu_link_content) to revisionable with existing data. I’m trying to figure out how to accomplish this. I saw this go to guide here –

I have a D8.6 site and I’m trying to make the menu_link_content revisionable. On top of that my site has existing content for custom menus. And I cannot just delete these contents. So these has to be ideally migrated to the new revision tables thats created. When I followed the step by step approach in that guide ‘Section 2’ I get the exception –

“Drupal\Core\Entity\EntityStorageException: The SQL storage cannot change the schema for an existing entity type (menu_link_content) with data. in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onEntityTypeUpdate() (line 347 of /var/www/myproj/docroot/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).”

When I delete all the custom menu links content it works.

Please confirm if my understanding is correct in the Section 2 –

“If you are updating the code for an existing site and your entity type already contains some data, you will also need to provide an upgrade path in addition to the changes explained in part 1. The upgrade path is composed of two things “

  • This means before performing the section 2 steps we have to make sure the Section 1 is done. This includes changing the Entity file annotations and setting fields to revisionable etc.

After this step I added the new revision fields like logs, created, time etc to install file and then created a post_update file and specified the fields which revision is set to true in that array.

Any suggestions or examples are welcome. Thanks!