-
-
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
command to create database #624
Comments
I've worked a while on that and solved it with the following code: // MARK: FIRST INITIALIZER
func firstInitialization() {
//print(Constants.Database.databaseFilePath)
let fileManager = FileManager.default
if fileManager.fileExists(atPath: Constants.Database.databaseFilePath) {
//print("database file exists")
} else {
//print("database file doesnt exist. creating now")
try! database.prepare(createSystemTableStatement).run()
}
} After running the The databaseFilePath is static let databaseFilePath = "\(NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0])/\(databaseFileName)" databaseFileName is like "mydatabase.db". Don't know if it's the correct solution, that's how it worked for me. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello
what is the command to create database file ?
because i have the error : unable to open database file (code 14)
thanks
The text was updated successfully, but these errors were encountered: