-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift 2: userVersion gone #194
Comments
@patr1ck I want to rethink a more unified extension Database {
public var userVersion: Int {
get { return Int(scalar("PRAGMA user_version") as! Int64) }
set { try! run("PRAGMA user_version = \(newValue)") }
}
} |
Cool, makes sense. Thank you! |
I did try to use the extension above but then when I try to set the value of userVersion I get this error: fatal error: 'try!' expression unexpectedly raised an error: attempt to write a readonly database even if I explicitly use try! Connection(localPdfDbPath.relativePath!, readonly:false) |
I've just confirmed that extension appears to be working in the current release version so I'm closing this out. (PS: @stephencelis I love how easy it is to add this functionality via the extension!) @violabg, I tried the playground example below and everything seemed to behave as expected. E.g. I set import SQLite
let db = try! Connection("foo.sqlite", readonly: false)
db.trace { print($0) }
extension Connection {
public var userVersion: Int {
get { return Int(scalar("PRAGMA user_version") as! Int64) }
set { try! run("PRAGMA user_version = \(newValue)") }
}
}
db.userVersion = 7
print(db.userVersion) |
I see in the
swift-2
branch that getting and setting the userVersion was removed. Would you accept a PR that brought this back or was this intentionally left out?Thanks for your hard work!
The text was updated successfully, but these errors were encountered: