Skip to content

Commit 8658b7b

Browse files
committed
Merge branch 'development'
2 parents 32b2923 + 42eeb54 commit 8658b7b

File tree

87 files changed

+5513
-1722
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+5513
-1722
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,6 @@ Tests/SPM/Packages
112112

113113
# Ruby
114114
.ruby-version
115+
116+
# Test products
117+
Tests/products

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:
77

88
#### 5.x Releases
99

10+
- `5.13.x` Releases - [5.13.0](#5130)
1011
- `5.12.x` Releases - [5.12.0](#5120)
1112
- `5.11.x` Releases - [5.11.0](#5110)
1213
- `5.10.x` Releases - [5.10.0](#5100)
@@ -79,6 +80,24 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:
7980

8081
---
8182

83+
## 5.13.0
84+
85+
Released November 7, 2021 • [diff](https://github.com/groue/GRDB.swift/compare/v5.12.0...v5.13.0)
86+
87+
- **Breaking Change**: [#1076](https://github.com/groue/GRDB.swift/pull/1076) by [@groue](https://github.com/groue): Require Swift 5.3 and Xcode 12
88+
- **New**: :star: [#1088](https://github.com/groue/GRDB.swift/pull/1088) by [@groue](https://github.com/groue): Shared ValueObservation
89+
- **New**: :star: [#1095](https://github.com/groue/GRDB.swift/pull/1095) by [@groue](https://github.com/groue): Precise foreign key checks for migrations
90+
- **New**: [#1078](https://github.com/groue/GRDB.swift/pull/1078) by [@groue](https://github.com/groue): Non-mutating persistence methods `saved` and `inserted`, and existence-checking methods `isEmpty` and `exists`
91+
- **New**: `DatabasePool.erase()` prevents concurrent reads until it has completed.
92+
- **New**: The `close()` method allows precise closing of database connections.
93+
- **New**: Filtering records by single-column primary key now properly encodes dates and uuids according to the customized strategies (`filter(id:)`, `deleteAll(_:keys:)`, etc.)
94+
- **New**: `DatabaseUUIDEncodingStrategy.lowercaseString` can encode UUID as a lowercased string. For clarity, the `string` strategy has been deprecated and renamed `uppercaseString`.
95+
- **Documentation Update**: :star: The [Concurrency Guide](Documentation/Concurrency.md) got a major overhaul.
96+
- **Documentation Update**: :star: A new [ValueObservation Sharing](README.md#valueobservation-sharing) chapter describes how to share database observations and spare database resources.
97+
- **Documentation Update**: :star: The [Migrations](Documentation/Migrations.md) guide tells how you can mitigate slow foreign key checks during schema changes.
98+
- **Documentation Update**: The [Date and UUID Coding Strategies](README.md#date-and-uuid-coding-strategies) chapter describes the new support for date and uuid primary key coding in requests by single-column primary key.
99+
- **Documentation Update**: A new [Testing for Record Existence](README.md#testing-for-record-existence) chapter describes the new `request.isEmpty(_:)`, `Record.exists(_:id:)` and `Record.exists(_:key:)` methods.
100+
82101
## 5.12.0
83102

84103
Released September 25, 2021 • [diff](https://github.com/groue/GRDB.swift/compare/v5.11.0...v5.12.0)

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Starting points:
118118

119119
GRDB has a strong focus on safe concurrency. Not only safe as "does not crash", but safe as "actively protects your application data". The topic is discussed in (too) many places:
120120

121-
- [Concurrency Guide](README.md#concurrency)
121+
- [Concurrency Guide](Documentation/Concurrency.md)
122122
- [Why Adopt GRDB?](https://github.com/groue/GRDB.swift/blob/master/Documentation/WhyAdoptGRDB.md#strong-and-clear-multi-threading-guarantees)
123123
- [Four different ways to handle SQLite concurrency](https://medium.com/@gwendal.roue/four-different-ways-to-handle-sqlite-concurrency-db3bcc74d00e)
124124
- [Good Practices for Designing Record Types](https://github.com/groue/GRDB.swift/blob/master/Documentation/GoodPracticesForDesigningRecordTypes.md#fetch-in-time)
@@ -313,7 +313,7 @@ Features that blur this focus are non-goals:
313313
[Non-Goals]: #non-goals
314314
[Report Bugs]: #report-bugs
315315
[RxGRDB]: http://github.com/RxSwiftCommunity/RxGRDB
316-
[Concurrency]: #concurrency
316+
[Concurrency]: Documentation/Concurrency.md
317317
[Sponsoring and Professional Support]: #sponsoring-and-professional-support
318318
[SQL Console in the Debugger]: #sql-console-in-the-debugger
319319
[SQLCipher in a Shared App Container]: #sqlcipher-in-a-shared-app-container

Documentation/Combine.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ let newPlayerCount = dbQueue.writePublisher { db -> Int in
191191

192192
The difference is that the last fetches are performed in the `thenRead` function. This function accepts two arguments: a readonly database connection, and the result of the `updates` function. This allows you to pass information from a function to the other (it is ignored in the sample code above).
193193

194-
When you use a [database pool], this method applies a scheduling optimization: the `thenRead` function sees the database in the state left by the `updates` function, and yet does not block any concurrent writes. This can reduce database write contention. See [Advanced DatabasePool](../README.md#advanced-databasepool) for more information.
194+
When you use a [database pool], this method applies a scheduling optimization: the `thenRead` function sees the database in the state left by the `updates` function, and yet does not block any concurrent writes. This can reduce database write contention. See [Advanced DatabasePool](Concurrency.md#advanced-databasepool) for more information.
195195

196196
When you use a [database queue], the results are guaranteed to be identical, but no scheduling optimization is applied.
197197

@@ -205,6 +205,7 @@ It completes on the main queue, unless you provide a specific [scheduler] to the
205205
Database Observation publishers are based on [ValueObservation] and [DatabaseRegionObservation]. Please refer to their documentation for more information. If your application needs change notifications that are not built as Combine publishers, check the general [Database Changes Observation] chapter.
206206

207207
- [`ValueObservation.publisher(in:scheduling:)`]
208+
- [`SharedValueObservation.publisher()`]
208209
- [`DatabaseRegionObservation.publisher(in:)`]
209210

210211

@@ -250,6 +251,22 @@ This publisher has the same behavior as ValueObservation:
250251
See [ValueObservation Scheduling](../README.md#valueobservation-scheduling) for more information.
251252

252253

254+
#### `SharedValueObservation.publisher()`
255+
256+
[SharedValueObservation] tracks changes in database values. You can turn it into a Combine publisher:
257+
258+
```swift
259+
let sharedObservation = ValueObservation
260+
.tracking { db in try Player.fetchAll(db) }
261+
.shared(in: dbQueue)
262+
263+
// A publisher with output [Player] and failure Error
264+
let publisher = sharedObservation.publisher()
265+
```
266+
267+
This publisher has the same behavior as SharedValueObservation.
268+
269+
253270
#### `DatabaseRegionObservation.publisher(in:)`
254271

255272
[DatabaseRegionObservation] notifies all transactions that impact a tracked database region. You can turn it into a Combine publisher:
@@ -374,14 +391,16 @@ let cancellable = hallOfFamePublisher.sink(
374391
[Demo Application]: DemoApps/GRDBCombineDemo/README.md
375392
[SQLite]: http://sqlite.org
376393
[ValueObservation]: ../README.md#valueobservation
394+
[SharedValueObservation]: ../README.md#valueobservation-sharing
377395
[`DatabaseRegionObservation.publisher(in:)`]: #databaseregionobservationpublisherin
378396
[`ValueObservation.publisher(in:scheduling:)`]: #valueobservationpublisherinscheduling
397+
[`SharedValueObservation.publisher()`]: #sharedvalueobservationpublisher
379398
[`readPublisher(receiveOn:value:)`]: #databasereaderreadpublisherreceiveonvalue
380399
[`writePublisher(receiveOn:updates:)`]: #databasewriterwritepublisherreceiveonupdates
381400
[`writePublisher(receiveOn:updates:thenRead:)`]: #databasewriterwritepublisherreceiveonupdatesthenread
382401
[`migratePublisher(_:receiveOn:)`]: Migrations.md#asynchronous-migrations
383402
[configured]: ../README.md#databasepool-configuration
384403
[database pool]: ../README.md#database-pools
385404
[database queue]: ../README.md#database-queues
386-
[database snapshot]: ../README.md#database-snapshots
405+
[database snapshot]: Concurrency.md#database-snapshots
387406
[scheduler]: https://developer.apple.com/documentation/combine/scheduler

0 commit comments

Comments
 (0)