Understand how refinery manages migrations
mainRefinery tracks migration state by creating a internal table in your database that stores the versions and metadata of all applied migrations.
When a Runner is executed:
- It compares the applied migrations in the database with the available migrations in your code.
- It checks for divergent migrations (where checksums don't match) or missing migrations.
- It executes any unapplied migrations.
Transaction Behavior
- Default: Each migration is run in its own single transaction.
- Grouped: You can configure the runner to wrap the entire execution of all migrations in a single transaction by calling
.set_grouped(true)on theRunner.