datocms / cli

Official CLI to interact with DatoCMS projects!
MIT License
7 stars 7 forks source link

Generated migrations do not run deletions first #17

Open Loque- opened 1 year ago

Loque- commented 1 year ago

I recently ran into an issue where generated migrations wouldn't run because the delete operations ran after updates and creation actions.

Unless I am missing some detail, I think it's safe to assume that all delete operations should happen at the start of a generated migration. It would be great to have this implemented as an improvement to the generated migration files.

This issue occurred to us when we replaced a modular content field with a links field on a model that had the same name - the script didn't create the delete action for the modular content field before the create action of the links field with the same name, causing the migration to fail and manual debugging was required alongside adjusting the generated migration file.

Hope this ticket helps, really appreciate all the tooling around this and it helps us recommend and evangelise DatoCMS as the platform to use. Many thanks 🙌

stefanoverna commented 1 year ago

Hi @Loque-, thanks for the report! It would really help us if you could send us a reproducible case:

If you're not comfortable sharing these info here, please send us a message at support@datocms.com referencing this issue. We'll take a quick snapshot of your project, so that we'll have the exact setup of yours, and fix the issue.

Loque- commented 1 year ago

Hey sure thing - it will be really easy for me to make a reproducible case, but I have a client demo this week, will hopefully be able to spin something up soon. Cheers 🙌