Migrations running before database creation

System Information
  • Strapi Version: 4.11.1
  • Operating System: Ubuntu
  • Database: Postgres
  • Node Version: 16.20
  • NPM Version: 8.19
  • Yarn Version:

When installing Strapi for the first time, in this case it is not the standard installation, but a version without modifications to the core but with the APIs, plugins, etc.

When running npm start for the first time, I get an error on the migrations, so I realized that the migrations are running before the tables being created.

however, the migrations are saved in the database as executed, which means that on the second startup they are not executed again (which is expected), however if they were executed the tables would already exist and the migration would be successful.

I added a step to check if the table exists, it avoids the error, but I can’t run the migration again after the tables are created.

Is there a way to run the migrations via CLI (apparently not according to the documentation) or to run them after creating the database or maybe don’t save their execution in the strapi_migrations table?

Any change made to the DB not done by strapi will be reverted as soon as strapi restarts.