New release: GRDB 4.11

Hello Swift community,

GRDB, the "toolkit for SQLite databases, with a focus on application development" has been upgraded to version 4.11.0.

Since the last announcement in this forum, quite a few improvements have been added. Most notably:

  • @gjeck added an API for renaming table columns.

  • @pakko972 has enabled automatic memory management on iOS (GRDB now automatically frees non-essential memory when application gets a memory warning, or when application enters background).

  • The SQL builder, named the "query interface", understands more application requests:

    extension Team {
        static let players = hasMany(Player.self)
    }
    
    // Delete all empty teams without any players
    try Team.having(Team.players.isEmpty).deleteAll(db)
    
  • Extending the query interface with support for more SQLite functions or expressions has become much easier (Swift 5+):

    // Add support for the DATE SQLite function
    func date(_ value: SQLExpressible) -> SQLExpression {
        SQLLiteral("DATE(\(value))").sqlExpression
    }
    
    let players = try Player
        .filter(date(Column("creationDate")) == "2020-03-02")
        .fetchAll(db)
    

Version v4.11.0 also comes with a breaking change, in the way database migrations are handled. The probability that it breaks any application is so low that I decided to ship anyway.

For a detailed description of this breaking change, and other information, check out the full release notes.

Happy GRDB!

3 Likes

As an extra bonus, I also released GitHub - groue/SortedDifference: A general sequence diffing algorithm, with a very specific purpose, which helps applications synchronize the content of their local database with remote server payloads. I use it all the time, so someone else may enjoy it as well :slightly_smiling_face:!

2 Likes