Latest Migration Guide
Migrating from GRDB 6 to GRDB 7
The complete guide for upgrading to GRDB 7 with Swift 6 support
GRDB 7 Migration Highlights
GRDB 7 brings full support for Swift 6 and requires Xcode 16.3+ and Swift 6.1+.New Requirements
- Swift Compiler: 6.1+ (was Swift 5.7+)
- Xcode: 16.3+ (was Xcode 14.0+)
- iOS: 13.0+ (was 11.0+)
- macOS: 10.15+ (was 10.13+)
- tvOS: 13.0+ (was 11.0+)
- watchOS: 7.0+ (was 4.0+)
- SQLite: 3.20.0+ (was 3.19.3+)
Major Changes
Column Coding Strategies
Column Coding Strategies
In GRDB 6, coding strategies were static properties. In GRDB 7, they are methods that accept a column argument:
Cancellable Async Database Accesses
Cancellable Async Database Accesses
In GRDB 6, async database accesses completed even if the wrapper Task was cancelled.In GRDB 7, async accesses respect Task cancellation. If a Task is cancelled:
- Reads and writes throw
CancellationError - Pending transactions are rolled back
- The database is not modified
ValueObservation and Main Actor
ValueObservation and Main Actor
By default, Opt-out with a specific scheduler:
ValueObservation now fosters the main actor:Record Base Class Discouraged
Record Base Class Discouraged
Subclassing the
Record class is discouraged in GRDB 7. Refactor to Swift structs:Access to SQLite C Functions
Access to SQLite C Functions
Additional imports may be needed:
All Migration Guides
GRDB 7 Migration Guide
Swift 6 support, new requirements, and breaking changes
GRDB 6 Migration Guide
UPSERT support, RETURNING clause, and persistence callbacks
GRDB 5 Migration Guide
Major refactoring and Swift 5.2+ requirement
Changelog
Complete version history with all changes
Migration Best Practices
Update to Latest Minor Version
Before upgrading to a new major version, update to the latest minor version of your current major version and fix all deprecation warnings.
Review the Migration Guide
Read the complete migration guide for your target version. Pay special attention to breaking changes that affect your codebase.
Update Dependencies
Update companion libraries like GRDBQuery and GRDBSnapshotTesting to compatible versions.