GRDB.swift v4.11.0 Release Notes

Release Date: 2020-03-02 // about 4 years ago
  • 🚀 Released March 2, 2020 • diff

    🆕 New

    • #706: Enhance SQLLiteral and SQL interpolation again
    • #710: Check if all migrations have been applied
    • #712 by @pakko972: Automatic iOS memory management
    • #713: Enhance DatabaseMigrator isolation

    💥 Breaking Change

    • #709: Simplify DatabaseMigrator API

    Database migrations have a new behavior which is a breaking change. However, it is very unlikely to impact your application.

    In previous versions of GRDB, a foreign key violation would immediately prevent a migration from successfully complete. Now, foreign key checks are deferred until the end of each migration. This means that some migrations will change their behavior:

    // Used to fail, now succeeds
    migrator.registerMigration(...) { db in
        try violateForeignKeyConstraint(db)
        try fixForeignKeyConstraint(db)
    }
    
    // The catch clause is no longer called
    migrator.registerMigration(...) { db in
        do {
            try performChanges(db)
        } catch let error as DatabaseError where error.resultCode == .SQL_CONSTRAINT {
            // Handle foreign key error
        }
    }
    

    ⏪ If your application happens to define migrations that are impacted by this change, please open an issue so that we find a way to restore the previous behavior.