File tree Expand file tree Collapse file tree 1 file changed +2
-12
lines changed
Modules/DataModel/Sources/PocketCastsDataModel/Private/Managers/Util Expand file tree Collapse file tree 1 file changed +2
-12
lines changed Original file line number Diff line number Diff line change @@ -4,22 +4,12 @@ import PocketCastsUtils
4
4
5
5
class DatabaseHelper {
6
6
class func setup( queue: PCDBQueue ) {
7
- var startingSchemaVersion : Int32 = 0
8
-
9
- queue. read { db in
7
+ queue. write { db in
10
8
do {
11
9
try db. executeQuery ( " PRAGMA busy_timeout = 10000 " , values: nil ) . close ( )
12
10
13
- let rs = try db. executeQuery ( " PRAGMA user_version " , values: nil )
14
- if rs. next ( ) { startingSchemaVersion = rs. int ( forColumnIndex: 0 ) }
15
- rs. close ( )
16
- } catch {
17
- FileLog . shared. addMessage ( " Failed to setup database \( db. lastErrorCode ( ) ) : \( db. lastErrorMessage ( ) ) actual error: \( error) " )
18
- }
19
- }
11
+ let startingSchemaVersion = db. pragmaUserVersion ( ) ?? 0
20
12
21
- queue. write { db in
22
- do {
23
13
var newSchemaVersion = startingSchemaVersion
24
14
upgradeIfRequired ( schemaVersion: & newSchemaVersion, db: db)
25
15
You can’t perform that action at this time.
0 commit comments