diff --git a/Documentation/GRDB3MigrationGuide.md b/Documentation/GRDB3MigrationGuide.md index f698f1a0b..62ba66443 100644 --- a/Documentation/GRDB3MigrationGuide.md +++ b/Documentation/GRDB3MigrationGuide.md @@ -141,12 +141,12 @@ The integration of GRDB with SQLCipher has changed. 2. The default SQLCipher version which comes with GRDB 4 is now SQLCipher 4, which is incompatible with SQLCipher 3. SQLCipher 3 is still supported, though. See [Encryption] for more details. -3. The `cipherPageSize` and `kdfIterations` configuration properties are discontinued. With GRDB 4, run sql pragmas in the `prepareDatabase` property of the configuration: +3. The `cipherPageSize` and `kdfIterations` configuration properties are discontinued. With GRDB 4, run sql pragmas in the `onConnect` method of the configuration: ```swift var configuration = Configuration() configuration.passphrase = "secret" - configuration.prepareDatabase = { db in + configuration.onConnect { db in try db.execute(sql: "PRAGMA cipher_page_size = 4096") try db.execute(sql: "PRAGMA kdf_iter = 128000") } diff --git a/GRDB/Core/Database.swift b/GRDB/Core/Database.swift index 043ccdea0..041321dfe 100644 --- a/GRDB/Core/Database.swift +++ b/GRDB/Core/Database.swift @@ -963,7 +963,7 @@ extension Database { /// Call this method from Configuration.onConnect, as in the example below: /// /// var config = Configuration() - /// config.prepareDatabase = { db in + /// config.onConnect { db in /// try db.usePassphrase("secret") /// } public func usePassphrase(_ passphrase: String) throws { diff --git a/GRDB/Fixit/GRDB-4.0.swift b/GRDB/Fixit/GRDB-4.0.swift index 1c6c41220..d4e9487cc 100644 --- a/GRDB/Fixit/GRDB-4.0.swift +++ b/GRDB/Fixit/GRDB-4.0.swift @@ -257,13 +257,13 @@ extension ValueObservation { } extension Configuration { - @available(*, unavailable, message: "Run the PRAGMA cipher_page_size in Configuration.prepareDatabase instead.") + @available(*, unavailable, message: "Run the PRAGMA cipher_page_size in Configuration.onConnect instead.") public var cipherPageSize: Int { get { preconditionFailure() } set { preconditionFailure() } } - @available(*, unavailable, message: "Run the PRAGMA kdf_iter in Configuration.prepareDatabase instead.") + @available(*, unavailable, message: "Run the PRAGMA kdf_iter in Configuration.onConnect instead.") public var kdfIterations: Int { get { preconditionFailure() } set { preconditionFailure() }