Is it possible remove database from code? #94

Closed
opened 2025-12-29 15:24:31 +01:00 by adam · 3 comments
Owner

Originally created by @avshiyanov on GitHub (Oct 22, 2016).

For example after each update of app I want delete previous DB

Originally created by @avshiyanov on GitHub (Oct 22, 2016). For example after each update of app I want delete previous DB
adam closed this issue 2025-12-29 15:24:31 +01:00
Author
Owner

@JohnEstropia commented on GitHub (Oct 23, 2016):

@avshiyanov You can simply delete the sqlite file before you initialize anything else. Which version of CoreStore are you using?

@JohnEstropia commented on GitHub (Oct 23, 2016): @avshiyanov You can simply delete the sqlite file before you initialize anything else. Which version of CoreStore are you using?
Author
Owner

@avshiyanov commented on GitHub (Oct 23, 2016):

@JohnEstropia I use swift3 branch

@avshiyanov commented on GitHub (Oct 23, 2016): @JohnEstropia I use swift3 branch
Author
Owner

@JohnEstropia commented on GitHub (Oct 23, 2016):

If so you can use the SQLiteStore's fileURL property to pass to FileManager.default.removeItem(at:):

let storage = SQLiteStore(...)
_ = try? FileManager.default.removeItem(at: storage.fileURL)

CoreStore.addStorage(storage, ...)
@JohnEstropia commented on GitHub (Oct 23, 2016): If so you can use the `SQLiteStore`'s `fileURL` property to pass to `FileManager.default.removeItem(at:)`: ``` swift let storage = SQLiteStore(...) _ = try? FileManager.default.removeItem(at: storage.fileURL) CoreStore.addStorage(storage, ...) ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore#94