From 0c7e14eb9ba79514da252c8bee4725ce146a86d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Thu, 27 Feb 2020 21:02:17 +0100 Subject: [PATCH] Documentation for DatabaseMigrator.hasUnappliedMigrations --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 768b36ece..0825f5562 100644 --- a/README.md +++ b/README.md @@ -4945,7 +4945,18 @@ try migrator.migrate(dbQueue, upTo: "v1") // fatal error: database is already migrated beyond migration "v1" ``` -Check if a migration has been applied: +Check if migrations are needed: + +```swift +if try migrator.hasUnappliedMigrations(in: dbQueue) { + // Some migrations have not been applied +} +if try migrator.hasUnappliedMigrations(in: dbQueue, upTo: "v2") { + // Some migrations have not been applied until "v2" +} +``` + +Check if a specific migration has been applied: ```swift let appliedMigrations = try migrator.appliedMigrations(in: dbQueue)