         }
     }
     
+    /// Returns the identifiers of completed migrations, of which all previous
+    /// migrations have been applied.
+    ///
+    /// - parameter db: A database connection.
+    /// - throws: An eventual database error.
+    public func completedMigrations(_ db: Database) throws -> [String] {
+        let appliedIdentifiers = try appliedMigrations(db)
+        let knownIdentifiers = migrations.map(\.identifier)
+        return Array(zip(appliedIdentifiers, knownIdentifiers)
+            .prefix(while: { $0 == $1 })
+            .map { $0.0 })
+    }
+    
+    /// Returns true if all migrations are applied.
+    ///
+    /// - parameter db: A database connection.
+    /// - throws: An eventual database error.
+    public func hasCompletedMigrations(_ db: Database) throws -> Bool {
+        try completedMigrations(db).last == migrations.last?.identifier
+    }
+    
+    /// Returns whether database contains unknown migration
+    /// identifiers, which is likely the sign that the database
+    /// has migrated further than the migrator itself supports.
+    ///
+    /// - parameter db: A database connection.
+    /// - throws: An eventual database error.
+    public func hasBeenSuperseded(_ db: Database) throws -> Bool {
+        let appliedIdentifiers = try self.appliedIdentifiers(db)
+        let knownIdentifiers = migrations.map(\.identifier)
+        return appliedIdentifiers.contains { !knownIdentifiers.contains($0) }
+    }
+    
+    // MARK: - Non public
+    
+    private mutating func registerMigration(_ migration: Migration) {
+        GRDBPrecondition(
+            !migrations.map({ $0.identifier }).contains(migration.identifier),
+            "already registered migration: \(String(reflecting: migration.identifier))")
+        migrations.append(migration)
+    }
+    
     /// Returns unapplied migration identifier,
     private func unappliedMigrations(upTo targetIdentifier: String, appliedIdentifiers: [String]) -> [Migration] {
         var expectedMigrations: [Migration] = []

        return migrations.map { $0.identifier }.filter { appliedIdentifiers.contains($0) }
    }
    
    /// Returns the identifiers of completed migrations, of which all previous
    /// migrations have been applied.
    ///
    /// - parameter db: A database connection.
    /// - throws: An eventual database error.
    public func completedMigrations(_ db: Database) throws -> [String] {
        let appliedIdentifiers = try appliedMigrations(db)
        let knownIdentifiers = migrations.map(\.identifier)
        return Array(zip(appliedIdentifiers, knownIdentifiers)
            .prefix(while: { $0 == $1 })
            .map { $0.0 })
    }
    
    /// Returns true if all migrations are applied.
    ///
    /// - parameter db: A database connection.
    /// - throws: An eventual database error.
    public func hasCompletedMigrations(_ db: Database) throws -> Bool {
        try completedMigrations(db).last == migrations.last?.identifier
    }
    
    /// Returns whether database contains unknown migration
    /// identifiers, which is likely the sign that the database
    /// has migrated further than the migrator itself supports.
    ///
    /// - parameter db: A database connection.
    /// - throws: An eventual database error.
    public func hasBeenSuperseded(_ db: Database) throws -> Bool {
        let appliedIdentifiers = try self.appliedIdentifiers(db)
        let knownIdentifiers = migrations.map(\.identifier)
        return appliedIdentifiers.contains { !knownIdentifiers.contains($0) }
    }
    
    // MARK: - Non public
    
    private mutating func registerMigration(_ migration: Migration) {
        GRDBPrecondition(
            !migrations.map({ $0.identifier }).contains(migration.identifier),
            "already registered migration: \(String(reflecting: migration.identifier))")
        migrations.append(migration)
    }
    
    /// Returns the applied migration identifiers, even unregistered ones
    ///
    /// - parameter db: A database connection.
    /// - throws: An eventual database error.

    
    // MARK: - Querying Migrations
    
    /// Returns the identifiers of registered and applied migrations, in the
    /// order of registration.
    ///
    /// See also `appliedIdentifiers(_:)`.
    ///
    /// - parameter db: A database connection.
    /// - throws: An eventual database error.
