You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an app runs its migrations at start-up (common with containers and rolling deploys), Migrator::up has three gaps that every such app has to work around:
No lock. Two instances starting at the same time can both see a migration as pending and run it twice.
No bounded wait. A migration that needs a lock held by a long-running query waits indefinitely and blocks everything queued behind it.
Unknown applied migrations are an error. After a rollback to the previous release, seaql_migrations contains a migration the older binary doesn't know, and up refuses to start, even though expand-only migrations are designed to be compatible with the release before.
Today the workaround is to reimplement the runner on top of MigrationTrait, SchemaManager and seaql_migrations.
Proposal
Options on the migrator, e.g.:
Migrator::up_with(db,MigrateOptions{lock:true,// Postgres: pg_advisory_lock; MySQL: GET_LOCKlock_timeout:Some(Duration::from_secs(5)),// per migration, e.g. SET LOCAL lock_timeoutallow_unknown_applied:true,// skip instead of erroring
..Default::default()}).await?;
Defaults keep today's behaviour, so nothing changes for existing users.
Happy to send a PR if this direction is acceptable.
Closing as a duplicate: tolerating unknown applied migrations landed in #3246 (ignore_missing_migrations()), and the lock is #3245. The per-migration lock timeout can already be set with SET LOCAL lock_timeout inside the migration.
Activity
patrick-immometrica commentedon Nov 15, 2026
Closing as a duplicate: tolerating unknown applied migrations landed in #3246 (
ignore_missing_migrations()), and the lock is #3245. The per-migration lock timeout can already be set withSET LOCAL lock_timeoutinside the migration.