What the Strapi 5 upgrade does to your database
Strapi 5 requires MySQL 8.0 or later, requires better-sqlite3 for SQLite projects, and shortens database identifiers longer than 55 characters through a data migration script. If your Strapi v4 project runs on MySQL 5, or on SQLite with a driver other than better-sqlite3, the database has to change before or during the move to Strapi 5, not after it. Identifiers that exceed 55 characters are shortened with a hash suffix when the data migration runs on first start, so table and column names in your database will change. Confirm the exact list of supported versions and the migration behavior against the Strapi v4 to v5 migration docs before you schedule the work.
The database work belongs to the same upgrade path as the code work, not to a separate maintenance task. Strapi's docs say to back up the database first because downgrading is not supported, so a failed migration cannot be reversed by reinstalling v4 code against the changed schema. Your plan should therefore include a verified backup taken immediately before the upgrade, a restore test, and a named owner who decides whether to roll forward or restore. The supported list also includes PostgreSQL 14 or later, MariaDB 10.3 or later and SQLite 3, so a move to a different engine is a possible option, though it adds a data move on top of the upgrade. Ask your team which of these engines your organization already operates and supports.
Test the whole migration on a copy of production data before any cutover. Restore the backup to a separate environment with the same database engine and version you will run in production, point a Strapi 5 instance at it, and let the data migration script run to completion. Check that every content type loads, that long identifiers resolved as expected, and that media and relations still point to the right records. Record the duration of the run and the database size before and after, since these figures set the maintenance window for the production upgrade. Your own environment, not a general estimate, should determine how long that window needs to be.
Database changes in Strapi 5 and what each one requires
This table lists each database change Strapi 5 brings, what it affects in your project, and the work you need to finish before the upgrade. Read each row against your current database engine and your custom queries. The main takeaway is that the MySQL and SQLite changes may need infrastructure work, while the identifier change can break hand-written SQL that references long names.
| Change | Impact | Action needed |
|---|---|---|
| MySQL 5 unsupported | Strapi 5 requires MySQL 8.0 as the minimum, so a MySQL 5 database cannot be used after the upgrade. | Confirm your server version, plan a MySQL 8.0 or later upgrade, and rehearse it on a copy of production data. |
| SQLite must use better-sqlite3 | Projects must use the better-sqlite3 package with client set to sqlite, so older SQLite driver setups stop working. | Replace the driver dependency, update the client setting in the database configuration, and test local and CI startup. |
| Identifiers limited to 55 characters | Table and column names longer than 55 characters are shortened with a hash suffix by a data migration script, so raw SQL, reports and custom code that use the old names will fail. | Search custom queries, views, BI tools and integrations for long names, then update them to the shortened names after a test run. |
| Supported engines: PostgreSQL 14+, MariaDB 10.3+, SQLite 3 | These are the engines Strapi 5 supports, and PostgreSQL 14 is the oldest PostgreSQL version in the supported list. | Check the engine and version you run today, and upgrade the engine first if it falls outside this list. |
| No MongoDB or other NoSQL support | Projects on MongoDB or another NoSQL database have no supported path in Strapi 5, so the data must move to a supported relational engine. | Plan a data move to a supported database before the upgrade, using a tested export and import process. |
| Data migration scripts run on first start | Strapi 5 changes the schema when it first starts, so the database is altered without a manual step and cannot be reversed by a downgrade. | Take a verified backup, run the migration on a restored copy first, and confirm the pre-upgrade backup can be restored. |
Decide the database path before the upgrade starts
The diagram starts at the database engine your project runs today and follows one branch per engine. MySQL 5 must move to MySQL 8.0 or later first, SQLite projects switch to the better-sqlite3 driver with client set to sqlite, and MySQL 8.0, MariaDB 10.3 or later, and PostgreSQL projects confirm their versions are supported. Every branch then meets the same two checks: an inventory of identifiers longer than 55 characters, and a backup and restore test on a copy before the go or no-go decision for the upgrade sequence.
Each database engine branch ends in the same identifier and copy-test checks before the upgrade.
What to prepare before touching the database
These six items are the groundwork that makes a Strapi 5 database change reversible and testable. Each one answers a question the team must settle before the migration script runs: how to get back, what will break, which runtime is supported, and who decides.
Verified database backup
Take a full backup of the database before any upgrade step, and confirm it restores. Strapi's documentation says to back up the database first because downgrading is not supported, so this backup is the only way back once the Strapi 5 data migration has run. Record the backup time, the storage location and the checksum, and restore it to a scratch server to prove it is usable.
Strapi migration FAQInventory of long identifiers
List every table and column name longer than 55 characters. Strapi 5 limits database identifiers to 55 characters and shortens longer ones with a hash suffix in a data migration script. Include names referenced in custom queries, raw SQL in plugins, reports, BI tools and stored views, because a renamed identifier will break any code that still uses the old name.
Node.js version check
Confirm the Node.js version on every build and runtime host against Strapi 5's requirement. Strapi 5 runs only on Active or Maintenance LTS Node.js versions, so an end-of-life runtime must be upgraded before the project will start. Check CI runners, container base images and the production server, since a version mismatch between them is a common cause of failed starts after a database change.
Strapi installation requirementsTest environment from a production copy
Build a staging environment from a recent copy of production data and run the full migration there first. The copy should match production's database engine and major version, character set and collation, and approximate data volume, so that the migration time and any identifier shortening can be observed. Keep the copy inside the same network controls as production, because it contains real personal data.
Database users, extensions and settings
Document every database user, role, extension, schema, connection string option and SSL setting that the Strapi configuration depends on. Check that the upgraded database version still provides each extension, and that the Strapi database user can create and alter the objects the migration needs. For SQLite projects, confirm the project uses the better-sqlite3 package with the client set to sqlite, since other SQLite drivers are not supported.
Named rollback owner and restore target
Name one person who has authority to call a rollback, and write down the restore time target before the change window opens. The owner should hold the backup location, the restore procedure and the decision criteria, such as migration errors or failed smoke tests. Agree the target with the business owner, because a restore from backup discards any content written after the backup was taken.
How the database move differs by current setup
Strapi 5 does not support MySQL 5, so the server must move to MySQL 8.0 or later before the new major version can start. This is the largest database change in the group because it involves the server itself, not only the application. Treat the server upgrade as its own project with its own backup and rollback point, and rehearse the identifier change on a copy of the database before anything touches production.
- Upgrade the server first: Move to MySQL 8.0 or later and confirm the application connects with the upgraded server before you change Strapi.
- Check the Strapi config: Confirm the connection settings point at the upgraded server, including host, port, and credentials.
- Test identifier shortening on a copy: Run the Strapi 5 data migration against a restored copy and review which long identifiers were renamed.
- Review application queries: Look for custom SQL or raw queries that reference shortened table or column names.
- Record the server version: Keep the exact version in your upgrade notes so auditors can match it to the test run.
Before go-live, check that the Strapi configuration and the upgraded server agree, and that the copy test completed without errors.
SQLite projects must switch to the better-sqlite3 driver, and the database client must be set to sqlite. Strapi 5 supports only this driver for SQLite, so a project that relied on another SQLite package needs its dependency and configuration changed together. File location and permissions are the usual causes of failure after the switch, because the database file and its directory must remain writable by the process that runs Strapi.
- Replace the driver: Install better-sqlite3 and remove the previous SQLite package from the project dependencies.
- Set the client: Confirm the database configuration uses the sqlite client value.
- Confirm file paths: Check that the database file path resolves the same way in development, staging and production.
- Check permissions: Verify the Strapi process user can read and write the database file and its directory, including temporary journal files.
- Rebuild dependencies: Reinstall packages on the target Node.js version, since native modules must compile for it.
Before go-live, start Strapi from a clean checkout, confirm the migration completes on a copy, and confirm the file is written after a restart.
Projects already on MySQL 8.0 or later, or MariaDB 10.3 or later, do not need a server change to meet the minimum, but they still need the identifier shortening. Here the main data change is that long table and column names are shortened with a hash suffix during the first start of Strapi 5. Confirm the engine version against Strapi's current supported list, because the list is the reference for the version you run, not the version you ran when the project was built.
- Confirm the engine version: Check the exact MySQL or MariaDB version against the Strapi installation requirements and note it in the upgrade record.
- Run the identifier change on a copy: Restore a recent backup and let the Strapi 5 migration rename long identifiers.
- Compare renamed objects: List identifiers that changed so you can find any scripts, reports or backups that reference the old names.
- Update external consumers: Check reporting tools, views and read-only jobs that query Strapi tables directly.
- Keep the pre-upgrade backup: Store a full backup taken before the migration, since downgrading is not supported.
Before go-live, confirm the engine version is on the supported list and that reporting queries still return results against the renamed objects.
PostgreSQL projects need the database engine checked against the supported window, then the Strapi 5 migration handled as a separate task. Strapi 5 supports PostgreSQL 14 or later, but the PostgreSQL project itself has its own end-of-life dates, so a version that is still accepted by Strapi may be close to losing community support. A major PostgreSQL upgrade should be planned on its own timeline, because it changes the server data directory and has its own rollback approach.
- Check the major version: Confirm the server runs a major version that Strapi 5 accepts and that is still supported by PostgreSQL.
- Note the support end date: Record when your current major version leaves PostgreSQL support so the upgrade has a deadline.
- Plan the major upgrade separately: Choose an upgrade method, such as dump and restore, pg_upgrade or logical replication, and rehearse it before the Strapi change.
- Check identifier shortening: Run the Strapi 5 migration on a restored copy and review renamed identifiers as with other databases.
- Confirm minor releases: Keep the server on current minor releases, since they replace executables without changing the storage format.
Before go-live, confirm the database version in production, the test copy, and the upgrade record all match.
Why PostgreSQL 17 or 18 is the safer target for new work
If you are choosing a database for a new Strapi 5 project, or moving a database that you will run for several years, target PostgreSQL 17 or 18 rather than the oldest version Strapi 5 accepts. PostgreSQL 18 is supported until November 14, 2030, PostgreSQL 17 until November 8, 2029, PostgreSQL 16 until November 9, 2028, PostgreSQL 15 until November 11, 2027, and PostgreSQL 14 until November 12, 2026. Versions 13 and earlier are no longer supported. Strapi 5 itself accepts PostgreSQL 14 or later, so a version that is supported by Strapi but near the end of its PostgreSQL window will need another upgrade within months. Confirm the current support dates on the PostgreSQL versioning page before you fix a target version, because a database that reaches end of life during your Strapi project's lifetime creates a second migration you did not plan for.
PostgreSQL is released under the PostgreSQL License, a permissive open source license similar to the BSD and MIT licenses, so licensing does not add a cost or a distribution condition to the database itself. Minor releases never change the internal storage format, which means routine patching is an executable replacement and restart. Major upgrades need a separate plan. The documented options are a dump and restore with pg_dumpall, pg_upgrade, or logical replication. Logical replication works across major versions and can limit downtime to several seconds, but it requires you to plan replication slots, sequence handling and the cutover procedure. Test whether your Strapi tables and sequences replicate as expected on a copy before you commit to that path.
Plan high availability and connection handling as separate decisions. PostgreSQL supports hot standby servers and both synchronous and asynchronous replication, but it does not include software that detects a primary failure and promotes a standby, so automatic failover requires an external tool that you select, configure and test. Connection pooling with PgBouncer is also a separate choice that affects how Strapi's connections behave under load and during failover. Neither decision is required by Strapi 5. Ask your database team to document the chosen tools, their owners and the recovery test they will run before the upgrade window opens.
The database upgrade sequence with checks and rollback points
This sequence moves a Strapi project's database to a Strapi 5 supported engine in a rehearsed order, so each step has a pass check and a known rollback point. The output is a production migration with a verified backup, recorded results and a documented way back if a check fails.
Take and verify a full database backup
Before anything else changes, the team takes a full backup of the production database and confirms it can be restored. The Strapi migration documentation says to back up the database first because downgrading is not supported, so this backup is the only rollback point. The step passes when a restore of the backup into a separate instance completes and the restored row counts match the source. Keep the backup, its checksum and the restore log with the change record.
Inventory identifiers and custom SQL
The engineer lists every table and column name that could exceed 55 characters, since Strapi 5 shortens longer database identifiers with a hash suffix through a data migration script. The same review covers raw SQL queries, custom migrations, database views and reporting tools that read Strapi tables directly, because renamed identifiers will break them. The step passes when the list is complete, each item has an owner, and each custom query is marked for update or confirmed unaffected. Confirm the exact naming rules against the Strapi breaking change page before you start.
Build a copy of production in staging
The team restores the verified backup into an isolated staging environment that matches production's engine version, configuration, file storage settings and environment variables. Staging must not connect to production services such as email, webhooks or third-party APIs during test runs. The step passes when the staging copy starts on the current Strapi 4 code, the admin panel loads and a sample of entries matches production. This copy is where every later rehearsal runs.
Upgrade the database engine or driver on the copy
On the copy only, the team upgrades the database to a version Strapi 5 supports. MySQL 5 is no longer supported, so MySQL 8.0 is the minimum, and SQLite projects must switch to the better-sqlite3 package with the client set to sqlite. For PostgreSQL, the team checks the supported versions and end-of-support dates in the PostgreSQL versioning policy and plans the major upgrade with pg_dumpall, pg_upgrade or logical replication. The step passes when the engine reports the target version, the application connects, and a read query returns the expected data.
Run the upgrade tool and data migration on the copy
The engineer runs the Strapi 5 upgrade tool and its codemods on the copy's code, then starts Strapi 5 so the data migration scripts run on first start, including identifier shortening. The team records the console output and any script that fails or warns. The step passes when Strapi 5 starts without migration errors and the migration log shows every script completed. If a script fails, the rollback point is the pre-upgrade backup restored into the copy, and the team fixes the cause before rerunning.
Check counts, relations, drafts and media
The team compares row counts for each content type and component against the pre-upgrade backup, then samples relations, published and draft versions, localized entries and media references. Media links are checked against the upload provider, since a broken reference will not show up in row counts. The automated test suite runs against the copy and results are recorded. The step passes when counts match, sampled relations and drafts render correctly in the admin panel and API, and tests pass or each failure has a documented decision. Any unexplained mismatch stops the sequence.
Repeat on a fresh copy and schedule production
The team repeats the full run from a new copy of the backup and records how long each step takes, so the production window is based on measured results. Once two clean runs match, the team agrees a change window with the business owners and freezes schema and content model changes for the period. The step passes when the timed runs are documented, the window is approved in writing and the rollback plan names who decides to restore the backup. Ask your partner or internal lead to confirm the timing for your data volume, since no general figure applies.
Run production migration and record results
With the verified backup in place and the freeze active, the team runs the database engine upgrade and the Strapi 5 migration on production using the same steps as the rehearsal. They repeat the count, relation, draft and media checks, run smoke tests on the admin panel and key API endpoints, and keep the backup available until sign-off. The step passes when the checks match the rehearsal results and the change record captures the backup location, migration log, check outcomes and sign-off. If a check fails, the team restores the pre-upgrade backup, since downgrade is not supported.
What makes the database work longer or shorter
This table lists the factors that lengthen or shorten database work before a Strapi 5 upgrade, with the effect each one has and what to confirm in your environment. Read each row against your own database and reporting setup, since the same driver can add a day of work for one team and almost none for another. The main takeaway is that the engine version, long identifiers and any direct SQL access usually decide the scope more than raw data size.
| Driver | Effect on the work | What to confirm |
|---|---|---|
| Size of the database and media metadata | Larger data increases the time to copy, back up and run the migration script on a test copy | Total database size, row counts for the largest tables, and whether media metadata sits in the same database |
| Tables and columns with names over 55 characters | Strapi 5 shortens long identifiers with a hash suffix in a data migration script, so every reference to those names must be checked | A list of long table, column and index names, and which of them appear in custom code or reports |
| Custom SQL, raw queries and reporting tools | Queries that read table names directly can break after identifiers are shortened or schema changes run | Every database user, report, dashboard and export job that connects to the Strapi database, and the table names each one reads |
| Plugins that add their own tables | Plugin tables follow their own schema and may need plugin updates before the upgrade can complete | Installed plugins, their Strapi 5 compatibility status, and the tables each one creates |
| Current engine and version | MySQL 5 must move to MySQL 8.0 or later, SQLite projects must switch to better-sqlite3, and supported versions need less change | Exact engine and version in use, the driver in package.json for SQLite projects, and the target version in your hosting plan |
| Whether an engine upgrade must run in the same window | Combining a database engine upgrade with the Strapi upgrade doubles the variables if something fails | Whether the engine upgrade can be done and tested separately before the Strapi upgrade starts |
| Number of environments sharing the database | Shared development, staging or reporting databases must be migrated together or separated, which adds coordination | Which environments and teams use the same database, and who signs off each one |
| Ability to restore a copy within the planned window | Without a tested restore, a failed migration may leave no clean state to return to, since downgrading is not supported | Backup method, restore test history, and whether a restored copy can be migrated end to end within the planned window |
Questions teams ask before the database work starts
How much does the database work cost, and what drives the fee?
The fee follows from the written scope, and DeployOpen does not publish a price list. The main drivers are whether the database engine changes (for example MySQL 5 to MySQL 8.0, or SQLite to a different engine), how many environments need the migration rehearsed, how much custom SQL and how many plugin tables the project carries, and how many identifiers exceed the 55-character limit. Ask for a quote that lists each database, environment and test cycle as a separate line, and confirm whether the work is fixed-scope with agreed deliverables before testing starts. One-time work is the inventory, the engine change and the copy tests. Recurring costs, such as hosting and backups, sit outside this work and should be quoted separately.
How long does the database migration take?
The window depends on the size of the data, the number of identifiers that need shortening, and how many test cycles the copy needs before sign-off. No fixed duration applies to every project. The Strapi data migration script runs on the first start of Strapi 5, so its runtime grows with the database. Plan at least one full rehearsal on a copy of production, measure the run time, then repeat after each fix. Ask your partner or your own team to report the rehearsal timings and the list of identifiers that will be shortened before setting a production window.
What does the database work need from our team?
It needs four things. First, access to the database server, including a recent backup and a way to create a copy for testing. Second, access to the code repository so the team can see the custom queries and plugin configuration. Third, a named owner who signs off each test run against the expected content and workflows. Fourth, a backup window agreed with the business, because the production database must be backed up before the upgrade starts and must stay unchanged until the rehearsal results are accepted.
Can our own team do the database changes without a partner?
Yes, if the team has database administration skills for the engine you run, working knowledge of Strapi's data model, and time for several test cycles on copies. Start with the Strapi breaking change pages for MySQL 5, better-sqlite3 and database identifiers, then run the upgrade on a copy and check the results before touching production. A partner is most useful when the team lacks one of those skills, when the schema has heavy custom SQL, or when the release date leaves no room for repeated rehearsals.
Can we roll back the database after the Strapi 5 upgrade?
No. Strapi's migration documentation says downgrading is not supported, so a rollback means restoring the database from the backup taken before the upgrade and returning the code to the Strapi 4 version. That is why the tested copy matters: a successful rehearsal on a copy of production shows that the backup restores cleanly and that the migration completes. Confirm that backups are taken immediately before the window, that restores have been tested, and that the team knows who decides to roll back.
Should we move to PostgreSQL while we upgrade to Strapi 5?
Treat it as a separate decision with its own timing. Strapi 5 supports PostgreSQL 14 or later, MySQL 8.0 or later, MariaDB 10.3 or later and SQLite 3, so PostgreSQL is not required for the upgrade. PostgreSQL 14 reaches end of support in November 2026, so a new deployment should target a version with later support dates such as 17 or 18. Doing the engine change and the Strapi upgrade together adds risk, because a failure could come from either change. Many teams upgrade Strapi first on the engine they already run, then plan the PostgreSQL move as its own migration.
Which database engine does a Strapi 5 project need to support for our compliance review?
Strapi 5 supports the engines listed in its installation requirements, and it does not support MongoDB or other NoSQL databases. Your compliance and security teams should review the engine version, its support end date, its access controls, its backup and restore method and its encryption settings before approving the change. Confirm with the database vendor the security patch policy for the version you choose. DeployOpen prepares the evidence for those reviews but does not issue audit reports or certifications.
How DeployOpen scopes and delivers the database upgrade
DeployOpen plans the database side of a Strapi 5 upgrade as a written, fixed-scope piece of work. The scope covers the database engine, the version target, the identifier and SQLite changes, and a rehearsal of the migration on a copy of production data before any change reaches live systems.
How we scope
- Inventory the current database engine, version, hosting model and every Strapi project that connects to it.
- Check identifier lengths and the SQLite driver against Strapi 5 requirements before estimating the build.
- Agree in writing which database versions, backups, copies and test runs are included in the fixed scope.
- Record which items are out of scope, such as code changes, plugin ports or front-end updates, so costs stay visible.
How we build
- Stand up the target database version in a non-production environment that matches your infrastructure.
- Run the Strapi data migration against a restored copy of production data and log every failure or warning.
- Test the migrated copy with editors' core workflows, API calls and scheduled jobs before sign-off.
- Document the rollback point and the pre-upgrade backup so the cutover can be reversed if needed.
How we hand over
- Deliver a runbook with the exact database steps, the migration log and the verification checklist used.
- Hand over backup and restore procedures tested on the copy, with the restore commands your team will run.
- Walk your database and platform engineers through the cutover sequence and the decision points.
- List the database settings, credentials and version pins your team must own after the upgrade.
How we support
- Support the production cutover window in the agreed scope and record what was changed.
- Offer ongoing support, upgrades and continuous testing as a retainer after the engagement closes.
- Confirm with your team which database maintenance tasks, such as minor version updates, stay in-house or move to a retainer.

