Application data migrations live in src/db/migrations/. Each migration implements the MigrationBase contract from
src/db/migration-base.ts: a unique version, a description, and an asynchronous migrate(strapi) function. Register
new migrations in src/db/migrations/index.ts.
src/index.ts runs migrationCore.run(strapi) during Strapi bootstrap. The runner creates a migrations table, reads
applied versions, and runs migrations whose versions are not present. Unapplied migrations are run concurrently, and
their version records are written after all of them succeed. The table uses SQLite-compatible SQL in tests and
MySQL-compatible SQL otherwise.
Migrations have no automatic rollback or transaction wrapper. Keep each migration idempotent so it can safely be retried after a partial failure, and do not rely on registry order or on another unapplied migration having completed. Use Strapi's query API for content data, preserve existing records unless deletion is intentional, and add an integration test for data migrations that verifies the relevant data remains available after migration. Environment-specific changes should be explicitly guarded inside the migration.
Migration 5.3.0 is an example of a data-only migration: it updates the provider field of users linked to legacy
GitHub-provider records, preserving the existing users and provider records.