ORM-11: Implement Migrator::run() #11
Labels
No labels
area:core
area:database
area:migrations
area:model
area:relations
area:schema
area:tests
breaking-change
size:M
size:S
tracking
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
NoctisWolfshadow/tessera-orm#11
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Depends on: #8, #10
Context
run()applies pending migrations safely: each migration is atomic with its tracking row, history edits are refused, and two processes starting at the same time cannot both apply the same migration.Tasks
ModifiedorMissingmigration returnsMigrationError::Drift { .. }and applies nothing.BEGIN IMMEDIATE,execute_batch(up), insert the tracking row,COMMIT. Any failure rolls back and returnsMigrationError::Failed { version, name, source }.IMMEDIATEstops two processes from both applying the same migration.MigrationReport { applied: Vec<i64> }.Database::transaction_depth() > 0.Example
Per-migration SQL sequence:
Error messages (
Display):Acceptance criteria
appliedis empty).run()insideDatabase::transactionreturns an error.Database::transactionwith savepoint nesting #8rebuilds_tablesmigrations (foreign-key-safe) #12Migrator::rollback(steps)#13