Skip to content

Commit 4d543d8

Browse files
author
Nathan Fallet
authored
Merge pull request #1121 from stephencelis/pk
2 parents c93728f + b53434e commit 4d543d8

File tree

8 files changed

+71
-13
lines changed

8 files changed

+71
-13
lines changed

Diff for: CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
0.13.3 (25-01-2022), [diff][diff-0.13.3]
2+
========================================
3+
4+
* UUID Fix ([#1112][])
5+
* Add prepareRowIterator method to an extension of Statement. ([#1119][])
6+
* Adding primary key support to column with references ([#1121][])
7+
18
0.13.2 (25-01-2022), [diff][diff-0.13.2]
29
========================================
310

@@ -102,6 +109,7 @@
102109
[diff-0.13.0]: https://github.com/stephencelis/SQLite.swift/compare/0.12.2...0.13.0
103110
[diff-0.13.1]: https://github.com/stephencelis/SQLite.swift/compare/0.13.0...0.13.1
104111
[diff-0.13.2]: https://github.com/stephencelis/SQLite.swift/compare/0.13.1...0.13.2
112+
[diff-0.13.3]: https://github.com/stephencelis/SQLite.swift/compare/0.13.2...0.13.3
105113

106114
[#142]: https://github.com/stephencelis/SQLite.swift/issues/142
107115
[#315]: https://github.com/stephencelis/SQLite.swift/issues/315
@@ -142,3 +150,6 @@
142150
[#1095]: https://github.com/stephencelis/SQLite.swift/pull/1095
143151
[#1100]: https://github.com/stephencelis/SQLite.swift/pull/1100
144152
[#1105]: https://github.com/stephencelis/SQLite.swift/pull/1105
153+
[#1112]: https://github.com/stephencelis/SQLite.swift/pull/1112
154+
[#1119]: https://github.com/stephencelis/SQLite.swift/pull/1119
155+
[#1121]: https://github.com/stephencelis/SQLite.swift/pull/1121

Diff for: Documentation/Index.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ process of downloading, compiling, and linking dependencies.
8181

8282
```swift
8383
dependencies: [
84-
.package(url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.13.2")
84+
.package(url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.13.3")
8585
]
8686
```
8787

@@ -102,7 +102,7 @@ install SQLite.swift with Carthage:
102102
2. Update your Cartfile to include the following:
103103

104104
```ruby
105-
github "stephencelis/SQLite.swift" ~> 0.13.2
105+
github "stephencelis/SQLite.swift" ~> 0.13.3
106106
```
107107

108108
3. Run `carthage update` and [add the appropriate framework][Carthage Usage].
@@ -132,7 +132,7 @@ install SQLite.swift with Carthage:
132132
use_frameworks!
133133
134134
target 'YourAppTargetName' do
135-
pod 'SQLite.swift', '~> 0.13.2'
135+
pod 'SQLite.swift', '~> 0.13.3'
136136
end
137137
```
138138

@@ -146,7 +146,7 @@ with the OS you can require the `standalone` subspec:
146146

147147
```ruby
148148
target 'YourAppTargetName' do
149-
pod 'SQLite.swift/standalone', '~> 0.13.2'
149+
pod 'SQLite.swift/standalone', '~> 0.13.3'
150150
end
151151
```
152152

@@ -156,7 +156,7 @@ dependency to sqlite3 or one of its subspecs:
156156

157157
```ruby
158158
target 'YourAppTargetName' do
159-
pod 'SQLite.swift/standalone', '~> 0.13.2'
159+
pod 'SQLite.swift/standalone', '~> 0.13.3'
160160
pod 'sqlite3/fts5', '= 3.15.0' # SQLite 3.15.0 with FTS5 enabled
161161
end
162162
```
@@ -172,7 +172,7 @@ If you want to use [SQLCipher][] with SQLite.swift you can require the
172172
target 'YourAppTargetName' do
173173
# Make sure you only require the subspec, otherwise you app might link against
174174
# the system SQLite, which means the SQLCipher-specific methods won't work.
175-
pod 'SQLite.swift/SQLCipher', '~> 0.13.2'
175+
pod 'SQLite.swift/SQLCipher', '~> 0.13.3'
176176
end
177177
```
178178

Diff for: Documentation/Planning.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ additions and Pull Requests, as well as to keep the Issues list clear of
66
enhancement requests so that bugs are more visible.
77

88
> ⚠ This document is currently not actively maintained. See
9-
> the [0.13.3 milestone](https://github.com/stephencelis/SQLite.swift/issues?q=is%3Aopen+is%3Aissue+milestone%3A0.13.3)
9+
> the [0.13.4 milestone](https://github.com/stephencelis/SQLite.swift/issues?q=is%3Aopen+is%3Aissue+milestone%3A0.13.4)
1010
> on Github for additional information about planned features for the next release.
1111
1212
## Roadmap

Diff for: README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Swift code.
136136

137137
```swift
138138
dependencies: [
139-
.package(url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.13.2")
139+
.package(url: "https://github.com/stephencelis/SQLite.swift.git", from: "0.13.3")
140140
]
141141
```
142142

@@ -160,7 +160,7 @@ install SQLite.swift with Carthage:
160160
2. Update your Cartfile to include the following:
161161

162162
```ruby
163-
github "stephencelis/SQLite.swift" ~> 0.13.2
163+
github "stephencelis/SQLite.swift" ~> 0.13.3
164164
```
165165

166166
3. Run `carthage update` and
@@ -191,7 +191,7 @@ SQLite.swift with CocoaPods:
191191
use_frameworks!
192192
193193
target 'YourAppTargetName' do
194-
pod 'SQLite.swift', '~> 0.13.2'
194+
pod 'SQLite.swift', '~> 0.13.3'
195195
end
196196
```
197197

Diff for: SQLite.swift.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "SQLite.swift"
3-
s.version = "0.13.2"
3+
s.version = "0.13.3"
44
s.summary = "A type-safe, Swift-language layer over SQLite3."
55

66
s.description = <<-DESC

Diff for: SQLite.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@
13331333
INFOPLIST_FILE = "$(SRCROOT)/Sources/SQLite/Info.plist";
13341334
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
13351335
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1336-
MARKETING_VERSION = 0.13.2;
1336+
MARKETING_VERSION = 0.13.3;
13371337
PRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLite;
13381338
PRODUCT_NAME = SQLite;
13391339
SKIP_INSTALL = YES;
@@ -1356,7 +1356,7 @@
13561356
INFOPLIST_FILE = "$(SRCROOT)/Sources/SQLite/Info.plist";
13571357
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
13581358
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
1359-
MARKETING_VERSION = 0.13.2;
1359+
MARKETING_VERSION = 0.13.3;
13601360
PRODUCT_BUNDLE_IDENTIFIER = com.stephencelis.SQLite;
13611361
PRODUCT_NAME = SQLite;
13621362
SKIP_INSTALL = YES;

Diff for: Sources/SQLite/Typed/Schema.swift

+20
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,26 @@ public final class TableBuilder {
309309
column(name, V.declaredDatatype, nil, true, unique, check, nil, (table, other), nil)
310310
}
311311

312+
public func column<V: Value>(_ name: Expression<V>, primaryKey: Bool, check: Expression<Bool>? = nil,
313+
references table: QueryType, _ other: Expression<V>) where V.Datatype == Int64 {
314+
column(name, V.declaredDatatype, primaryKey ? .default : nil, false, false, check, nil, (table, other), nil)
315+
}
316+
317+
public func column<V: Value>(_ name: Expression<V>, primaryKey: Bool, check: Expression<Bool?>,
318+
references table: QueryType, _ other: Expression<V>) where V.Datatype == Int64 {
319+
column(name, V.declaredDatatype, primaryKey ? .default : nil, false, false, check, nil, (table, other), nil)
320+
}
321+
322+
public func column<V: Value>(_ name: Expression<V?>, primaryKey: Bool, check: Expression<Bool>? = nil,
323+
references table: QueryType, _ other: Expression<V>) where V.Datatype == Int64 {
324+
column(name, V.declaredDatatype, primaryKey ? .default : nil, true, false, check, nil, (table, other), nil)
325+
}
326+
327+
public func column<V: Value>(_ name: Expression<V?>, primaryKey: Bool, check: Expression<Bool?>,
328+
references table: QueryType, _ other: Expression<V>) where V.Datatype == Int64 {
329+
column(name, V.declaredDatatype, primaryKey ? .default : nil, true, false, check, nil, (table, other), nil)
330+
}
331+
312332
public func column<V: Value>(_ name: Expression<V>, unique: Bool = false, check: Expression<Bool>? = nil,
313333
defaultValue: Expression<V>? = nil, collate: Collation) where V.Datatype == String {
314334
column(name, V.declaredDatatype, nil, false, unique, check, defaultValue, nil, collate)

Diff for: Tests/SQLiteTests/SchemaTests.swift

+27
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ class SchemaTests: XCTestCase {
317317
"CREATE TABLE \"table\" (\"int64\" INTEGER NOT NULL UNIQUE REFERENCES \"table\" (\"int64\"))",
318318
table.create { t in t.column(int64, unique: true, references: table, int64) }
319319
)
320+
XCTAssertEqual(
321+
"CREATE TABLE \"table\" (\"int64\" INTEGER PRIMARY KEY NOT NULL REFERENCES \"table\" (\"int64\"))",
322+
table.create { t in t.column(int64, primaryKey: true, references: table, int64) }
323+
)
320324
XCTAssertEqual(
321325
"CREATE TABLE \"table\" (\"int64\" INTEGER NOT NULL CHECK (\"int64\" > 0) REFERENCES \"table\" (\"int64\"))",
322326
table.create { t in t.column(int64, check: int64 > 0, references: table, int64) }
@@ -329,13 +333,24 @@ class SchemaTests: XCTestCase {
329333
"CREATE TABLE \"table\" (\"int64\" INTEGER NOT NULL UNIQUE CHECK (\"int64\" > 0) REFERENCES \"table\" (\"int64\"))",
330334
table.create { t in t.column(int64, unique: true, check: int64 > 0, references: table, int64) }
331335
)
336+
XCTAssertEqual(
337+
"CREATE TABLE \"table\" (\"int64\" INTEGER PRIMARY KEY NOT NULL CHECK (\"int64\" > 0) REFERENCES \"table\" (\"int64\"))",
338+
table.create { t in t.column(int64, primaryKey: true, check: int64 > 0, references: table, int64) }
339+
)
332340
XCTAssertEqual(
333341
"""
334342
CREATE TABLE \"table\" (\"int64\" INTEGER NOT NULL UNIQUE CHECK (\"int64Optional\" > 0) REFERENCES
335343
\"table\" (\"int64\"))
336344
""".replacingOccurrences(of: "\n", with: ""),
337345
table.create { t in t.column(int64, unique: true, check: int64Optional > 0, references: table, int64) }
338346
)
347+
XCTAssertEqual(
348+
"""
349+
CREATE TABLE \"table\" (\"int64\" INTEGER PRIMARY KEY NOT NULL CHECK (\"int64Optional\" > 0) REFERENCES
350+
\"table\" (\"int64\"))
351+
""".replacingOccurrences(of: "\n", with: ""),
352+
table.create { t in t.column(int64, primaryKey: true, check: int64Optional > 0, references: table, int64) }
353+
)
339354

340355
XCTAssertEqual(
341356
"CREATE TABLE \"table\" (\"int64Optional\" INTEGER REFERENCES \"table\" (\"int64\"))",
@@ -345,6 +360,10 @@ class SchemaTests: XCTestCase {
345360
"CREATE TABLE \"table\" (\"int64Optional\" INTEGER UNIQUE REFERENCES \"table\" (\"int64\"))",
346361
table.create { t in t.column(int64Optional, unique: true, references: table, int64) }
347362
)
363+
XCTAssertEqual(
364+
"CREATE TABLE \"table\" (\"int64Optional\" INTEGER PRIMARY KEY REFERENCES \"table\" (\"int64\"))",
365+
table.create { t in t.column(int64Optional, primaryKey: true, references: table, int64) }
366+
)
348367
XCTAssertEqual(
349368
"CREATE TABLE \"table\" (\"int64Optional\" INTEGER CHECK (\"int64\" > 0) REFERENCES \"table\" (\"int64\"))",
350369
table.create { t in t.column(int64Optional, check: int64 > 0, references: table, int64) }
@@ -357,10 +376,18 @@ class SchemaTests: XCTestCase {
357376
"CREATE TABLE \"table\" (\"int64Optional\" INTEGER UNIQUE CHECK (\"int64\" > 0) REFERENCES \"table\" (\"int64\"))",
358377
table.create { t in t.column(int64Optional, unique: true, check: int64 > 0, references: table, int64) }
359378
)
379+
XCTAssertEqual(
380+
"CREATE TABLE \"table\" (\"int64Optional\" INTEGER PRIMARY KEY CHECK (\"int64\" > 0) REFERENCES \"table\" (\"int64\"))",
381+
table.create { t in t.column(int64Optional, primaryKey: true, check: int64 > 0, references: table, int64) }
382+
)
360383
XCTAssertEqual(
361384
"CREATE TABLE \"table\" (\"int64Optional\" INTEGER UNIQUE CHECK (\"int64Optional\" > 0) REFERENCES \"table\" (\"int64\"))",
362385
table.create { t in t.column(int64Optional, unique: true, check: int64Optional > 0, references: table, int64) }
363386
)
387+
XCTAssertEqual(
388+
"CREATE TABLE \"table\" (\"int64Optional\" INTEGER PRIMARY KEY CHECK (\"int64Optional\" > 0) REFERENCES \"table\" (\"int64\"))",
389+
table.create { t in t.column(int64Optional, primaryKey: true, check: int64Optional > 0, references: table, int64) }
390+
)
364391
}
365392

366393
func test_column_withStringExpression_compilesCollatedColumnDefinitionExpression() {

0 commit comments

Comments
 (0)