Vapor 2.0: Where is the SQLite stored?

Viewed 1435

I'm using Vapor and a built-in SQLite 3 driver: https://github.com/vapor/sqlite

So i changed "driver": "memory" to "driver": "sqlite" in fluent.json and created sqlite.json:

{
    "path": "data.sqlite"
}

But even if I use Spotlight search I cannot find any file called data.sqlite. I cannot also use sqlite-provider which is popular in many tutorials I found because it's not compatible with Vapor 2: Could not generate Xcode project: swift-package: error: unsatisfiable

But nevertheless the data is stored somewhere: I can reboot my Mac, run Vapor and see all the data.

I have read a lot of similar questions here but none of authors used Vapor, so those answers hasn't help me. I need to get this data.sqlite file location. What am I doing wrong?

P.S I'm using Xcode 8.3.2, Swift 3.1, Vapor 2.0.1. SQLite3 is installed.

3 Answers

This happens when you use XCode to build and run your Vapor Project. Xcode uses local temporary directory for every app which is in development stage. Use Vapor's CLI in terminal

 $ vapor build 
 $ vapor run

Then all your old database will be deleted and a new .sqlite file is created in your main directory.

Related