Record migration scripts in Web UI

Hi,

first of all: DatoCMS is the most awesome Headless CMS of all I tried by far. I started using it a few days after the first after the Nested Blocks feature and used that since day 1. No other CMS works this well with component-based design and is that easy and self-explanatory for editors. Amazing piece of software.

One of the main reasons I like DatoCMS so much as a developer, is the effortless Entity-Relationship modeling + instant GraphQL API without writing any code. And I am really missing that when it comes to Migration scripts: Environments and migrations - Write and test migration scripts - DatoCMS Docs

Here I have to read API docs, no type definitions, and have to fill out tons of fields. But I am spoiled now by composing Models and Blocks in the DatoCMS web interface effortlessly :smiley:

I never know what the final model will be like when I start a new task, I prototype and experiment a lot, and then at some point, I am done and happy with the result. At this point I’d like to have that as a migration script.

Something like a “migration script recorder” would really nice. This idea came to me when I made some e2e tests with Playwright. I use a Chrome Extension for that to record e2e test script code by actually interacting with the site. Then I adapt the script code as I see fit and then put the actually e2e test script in place to run automatically post-deploy.

Something analogous for DatoCMS Migrations would be awesome. I envision a workflow like so:

  1. start a new feature: fork the primary environment into a sandbox environment feature-123
  2. on feature-123 there would be a “Record” button and I’d activate it. While “Record”-mode is active, all Model changes I perform with UI in feature-123 are recorded to JS script code that makes use of datocms-client calls.
  3. when I am done, I copy&paste the recorded code to a new migration JS file in my repo and make some adaptions.
  4. do Environments and migrations - Apply migrations to primary environment - DatoCMS Docs

So it would be a semi-automatic solution: I wouldn’t expect it to generate the perfect migration script, but 95% of all the boilerplate that I can copy-paste. Just as in the e2e test case.

A brazen request for sure, I assume this would be a lot of work.

Would love to hear if more people would like something like this and if it is possible that this happens at some point in the future.

Cheers,
Kai

This can be considered a duplicate of Allow diffing of two environments, to capture as a migration script

1 Like