Automated schema migrations

When looking at this documentation about migrations: Database migrations | Strapi Documentation

I find the following sentence

“These migrations are run automatically when the application starts and are executed before the automated schema migrations that Strapi also performs on boot.”

However, these automated schema migrations are never mentioned anywhere else in the documentation. They got mentioned ONCE on the forums: Documenting the Automated Schema Migrations but nowehere else.

What I would’ve thought they do, is that on startup Strapi checks the schema and the database and changes the database accordingly to the newer schema. However, that doesn’t seem to happen, at least not in our case.

Do we have to write migration files for EVERY change that we do? I thought as long as we are not live, we can just rely on the automated migrations.

This topic has been created from a Discord post (1242803207902593096) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

Anyone wanna say something here?

What I would’ve thought they do, is that on startup Strapi checks the schema and the database and changes the database accordingly to the newer schema.

This is correct.

These migrations are actually mentioned on the docs, here: Database | Strapi Documentation

As you can see in the docs, the auto migration can be turned off. Maby that’s the issue?

Confirming what boaz said, during bootstrap Strapi syncs the schema and the database (the “automatic schema migrations”) so that all tables/columns match. The only reason it wouldn’t run is if forceMigration=false.

Also note that in v5 we’ve added an internal migration system as well, which will also run before user migrations.

You should only need user migration files for project-specific needs that aren’t handled by default.