FileMigrationCheckpointStore

A checkpoint store that survives the process, which is the only kind that makes resuming real.

One small file per migration under directory. It is written to a temporary file and moved into place, so a process killed mid-write leaves the previous checkpoint intact rather than a truncated one — the failure this store exists to handle is the process dying, and dying during the write is not a special case.

A file is the right default because a migration is usually a job with a volume attached and no database of its own. Anything with somewhere better to put a cursor should implement MigrationCheckpointStore against that instead.

Constructors

Link copied to clipboard
constructor(directory: Path)

Functions

Link copied to clipboard
open suspend override fun clear(id: String)

Forgets id, so the next run starts from the beginning. Called when a migration completes.

Link copied to clipboard
open suspend override fun load(id: String): MigrationCheckpoint?

The checkpoint stored under id, or null if this migration has not run before.

Link copied to clipboard
open suspend override fun save(id: String, checkpoint: MigrationCheckpoint)

Records how far the migration id has got. Called once per acknowledged batch.