                 try migrator.migrate(dbQueue)
                 XCTFail("Expected error")
             } catch DatabaseError.SQLITE_CONSTRAINT_FOREIGNKEY { }
-            try dbQueue.read { db in
-                try XCTAssertTrue(Row.fetchCursor(db, sql: "PRAGMA foreign_key_check").isEmpty())
-            }
+            try dbQueue.read { try $0.checkForeignKeyViolations() }
         }
     }
     

            }
            let dbQueue = try makeDatabaseQueue()
            try migrator.migrate(dbQueue)
            try dbQueue.read { db in
                // The unique opportunity for corrupt data
                try XCTAssertFalse(Row.fetchCursor(db, sql: "PRAGMA foreign_key_check").isEmpty())
            }
        }
        do {
            var migrator = DatabaseMigrator().disablingDeferredForeignKeyChecks()

            }
            let dbQueue = try makeDatabaseQueue()
            try migrator.migrate(dbQueue)
            try dbQueue.read { try $0.checkForeignKeyViolations() }
        }
        do {
            var migrator = DatabaseMigrator()
