Skip to main content

Module migrate

Module migrate 

Source
Expand description

Migration runner uses the SQLx query facade; SeaORM/Diesel ledger support arrives with their facade methods. Database migration lifecycle — versioned, checksummed, lock-guarded.

Boot-time only (runs in ArclyPlugin::on_init, before the container freezes) — the request hot path never sees this module.

§Guarantees

  • Ledger — every applied migration is recorded in arcly_migrations (version, name, checksum, applied_at) per datasource; re-runs skip.
  • Drift detection — if the code’s checksum for an applied version no longer matches the ledger, the boot fails loudly: someone edited a shipped migration, which silently forks schemas across environments.
  • Fleet safetyrun takes the cluster DLockBackend; replicas booting simultaneously serialize on arcly:lock:migrate:{pool} instead of racing DDL.
  • Multi-tenantrun_all walks every datasource in the registry (deterministic name order) and reports per pool.

§Contract

One SQL statement per Migration::up (portable across the Any driver’s prepared-statement path). Each statement runs inside its own transaction together with its ledger insert, so a failed step leaves no half-applied version behind.

Structs§

MigrationReport
MigrationRunner

Traits§

Migration