diff --git a/resources/guidelines/code/core/database-migations.md b/resources/guidelines/code/core/database-migations.md index 770eb4081..50830c91a 100644 --- a/resources/guidelines/code/core/database-migations.md +++ b/resources/guidelines/code/core/database-migations.md @@ -178,6 +178,8 @@ To make those tests fast to run and easier to understand you should not use any You should also especially not rely on the kernel being booted and the service container being available. To test your migration you can get a database connection via `KernelLifecycleManager::getConnection()`. Besides obviously relying on the database, the migration tests should behave like unit tests and rely on nothing else external. +Migration tests should verify idempotence by executing the migration's `update()` method twice whenever that is feasible for the migration under test. +When a migration test needs to create multiple fixture rows, prefer `MultiInsertQueryQueue` to reduce database round-trips and write overhead. This is recommended, but optional. **Be careful with implicit commits**