Execute a sql query before a content-type change manually

System Information
  • Strapi Version: 4.0.7
  • Database: mysql
  • Node Version: v14.19.1
  • NPM Version: v6.14.16

Hello,

I have this issue where I have to delete draft mode from a content-type without deleting draft entries,
And making the draft mode manual, with creating field status.

I have to do this in one commit so multiple environments and everyone on this project doesn’t have to do it in multiple steps.
“Strapi delete every row having published_at is NULL, when we delete draft mode”

To do this task, I modified the schema (add status: enum [published, draft]), set draft mode to false and I wrote this migration :

  • add column state
  • populate this column with “published” or “draft”
  • update draft rows with dummy date for published_at

the problem is that content-type update before the migration, so I’m losing draft entries.

The same applies if I write it in the bootstrap function (src/index.js)

Thank you,

is there anybody?