You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Documentation/Index.md
+32-9Lines changed: 32 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,7 @@ install SQLite.swift with Carthage:
78
78
2. Update your Cartfile to include the following:
79
79
80
80
```
81
-
github "stephencelis/SQLite.swift" ~> 0.11.0
81
+
github "stephencelis/SQLite.swift" ~> 0.11.1
82
82
```
83
83
84
84
3. Run `carthage update` and [add the appropriate framework][Carthage Usage].
@@ -100,32 +100,32 @@ install SQLite.swift with Carthage:
100
100
``` sh
101
101
# Using the default Ruby install will require you to use sudo when
102
102
# installing and updating gems.
103
-
sudo gem install cocoapods
103
+
[sudo] gem install cocoapods
104
104
```
105
105
106
106
3. Update your Podfile to include the following:
107
107
108
108
``` ruby
109
109
use_frameworks!
110
110
111
-
pod 'SQLite.swift', '~> 0.11.0'
111
+
pod 'SQLite.swift', '~> 0.11.1'
112
112
```
113
113
114
-
4. Run `pod install`.
114
+
4. Run `pod install --repo-update`.
115
115
116
116
117
117
#### Requiring a specific version of SQLite
118
118
119
119
If you want to use a more recent version of SQLite than what is provided with the OS you can require the `standalone` subspec:
120
120
121
121
``` ruby
122
-
pod 'SQLite.swift/standalone', '~> 0.11.0'
122
+
pod 'SQLite.swift/standalone', '~> 0.11.1'
123
123
```
124
124
125
125
By default this will use the most recent version of SQLite without any extras. If you want you can further customize this by adding another dependency to sqlite3 or one of its subspecs:
126
126
127
127
```ruby
128
-
pod 'SQLite.swift/standalone', '~> 0.11.0'
128
+
pod 'SQLite.swift/standalone', '~> 0.11.1'
129
129
pod 'sqlite3/fts5', '= 3.15.0'# SQLite 3.15.0 with FTS5 enabled
SQLite.swift provides a convenience property on `Database` to query and set the [`PRAGMA user_version`](https://sqlite.org/pragma.html#pragma_schema_version). This is a great way to manage your schema’s version over migrations.
1084
+
You can add a convenience property on `Connection` to query and set the [`PRAGMA user_version`](https://sqlite.org/pragma.html#pragma_user_version).
1085
+
1086
+
This is a great way to manage your schema’s version over migrations.
1085
1087
1086
1088
``` swift
1089
+
extensionConnection {
1090
+
publicvar userVersion: Int32 {
1091
+
get { returnInt32(try!scalar("PRAGMA user_version") as!Int64)}
1092
+
set { try!run("PRAGMA user_version = \(newValue)") }
1093
+
}
1094
+
}
1095
+
```
1096
+
1097
+
Then you can conditionally run your migrations along the lines of:
1098
+
1099
+
```swift
1087
1100
if db.userVersion ==0 {
1088
1101
// handle first migration
1089
1102
db.userVersion=1
@@ -1092,8 +1105,10 @@ if db.userVersion == 1 {
1092
1105
// handle second migration
1093
1106
db.userVersion=2
1094
1107
}
1095
-
```-->
1108
+
```
1096
1109
1110
+
For more complex migration requirements check out the schema management system
1111
+
[SQLiteMigrationManager.swift][].
1097
1112
1098
1113
## Custom Types
1099
1114
@@ -1429,6 +1444,13 @@ let config = FTS5Config()
1429
1444
1430
1445
try db.run(emails.create(.FTS5(config))
1431
1446
// CREATE VIRTUAL TABLE "emails" USING fts5("subject", "body" UNINDEXED)
1447
+
1448
+
// Note that FTS5 uses a different syntax to select columns, so we need to rewrite
1449
+
// the last FTS4 query above as:
1450
+
let replies = emails.filter(emails.match("subject:\"Re:\"*))
1451
+
// SELECT * FROM "emails" WHERE "emails" MATCH 'subject:"Re:"*'
0 commit comments