From d12dad2e344b9e14ba5512efbf89488200c480c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Thu, 22 Jun 2017 20:41:37 +0200 Subject: [PATCH] Deprecate TableMapping.primaryKeyRowComparator --- GRDB/Record/TableMapping.swift | 3 +++ Tests/GRDBTests/TableMappingTests.swift | 2 ++ 2 files changed, 5 insertions(+) diff --git a/GRDB/Record/TableMapping.swift b/GRDB/Record/TableMapping.swift index 887960d3c..bea6da135 100644 --- a/GRDB/Record/TableMapping.swift +++ b/GRDB/Record/TableMapping.swift @@ -249,6 +249,9 @@ extension TableMapping { /// } /// /// - throws: A DatabaseError if table does not exist. + /// - attention: This method is deprecated. It will be removed is the next + /// major version of the library, without any replacement. + @available(*, deprecated) public static func primaryKeyRowComparator(_ db: Database) throws -> (Row, Row) -> Bool { let primaryKey = try rowPrimaryKey(db) return { (lhs, rhs) in diff --git a/Tests/GRDBTests/TableMappingTests.swift b/Tests/GRDBTests/TableMappingTests.swift index bf7cba41f..62bd4b163 100644 --- a/Tests/GRDBTests/TableMappingTests.swift +++ b/Tests/GRDBTests/TableMappingTests.swift @@ -9,6 +9,7 @@ import XCTest class TableMappingTests: GRDBTestCase { + // Test deprecated method primaryKeyRowComparator func testPrimaryKeyRowComparatorWithIntegerPrimaryKey() throws { struct Person : TableMapping { static let databaseTableName = "persons" @@ -32,6 +33,7 @@ class TableMappingTests: GRDBTestCase { } } + // Test deprecated method primaryKeyRowComparator func testPrimaryKeyRowComparatorWithHiddenRowIDPrimaryKey() throws { struct Person : TableMapping { static let databaseTableName = "persons"