-- | The capability through which a run reports its progress. A project-- imports "Database.DagMigrations", which re-exports everything that this-- module exports.module Database.DagMigrations.Progress ( Progress (..), ProgressEvent (..), TrackingVersion (..), silentProgress, )whereimport Database.DagMigrations.Error (Direction, FingerprintMismatch)-- | The version of the tracking table's schema. Version 0 is the table of-- @dbmigrations@.newtype TrackingVersion = TrackingVersion Int deriving (Eq, Ord, Show)-- | An event of a run.data ProgressEvent i = -- | The run created the tracking table, at this version. TrackingTableCreated TrackingVersion | -- | The run upgraded the tracking table from the first version to the -- second. TrackingTableUpgraded TrackingVersion TrackingVersion | -- | The run recorded the fingerprint of this applied migration, which -- had none (trust on first use). FingerprintRecorded i | -- | The run found this mismatch, and continued under the warning -- policy. FingerprintMismatchIgnored (FingerprintMismatch i) | -- | The run is about to apply or revert this migration, in its own -- transaction. MigrationStarted Direction i | -- | The run committed the migration's transaction. MigrationFinished Direction i deriving (Eq, Show)-- | Receives each event of a run. The runner reports events only through-- this capability; the library prints and logs nothing itself.newtype Progress i = Progress { reportProgress :: ProgressEvent i -> IO () }-- | Ignores every event.silentProgress :: Progress isilentProgress = Progress (const (pure ()))