How to add sqlite to lumen?

I would like to add sqlite db to my lumen app but I have some troubles. I create migration:

php artisan make:migration create_users_table --create=users

then I changed my .env file, so it looks like:


then I was created database.sqlite and put it in storage folder and when I 'm trying to do:

php artisan migrate

I have

[InvalidArgumentException] Database (database.sqlite) does not exist.

I uncommented this lines in bootstrap/app.php:


I can't find what is wrong.

I work on ubuntu 14.04

In my .env file I changed to:

# DB_HOST=localhost
# DB_DATABASE=database.sqlite

I left only


So Lumen use default config from /vendor/laravel/lumen-framework/config/database.php. It works.

Data Sources and Drivers PHPStorm – SQLite. In the left menu, under Drivers select SQLite and download the driver if required. When setting up this drivers, for the File click the three dots button and select the database.sqlite file you have just created. Select sqlite database file in PHPStorm. Click Test Connection. Everything should connect fine.

According to lumen-framwork/config/database.php

    'sqlite' => [
        'driver'   => 'sqlite',
        'database' => env('DB_DATABASE', storage_path('database.sqlite')),
        'prefix'   => env('DB_PREFIX', ''),

sqlite is the default setting for lumen.

And you can set DB_CONNECTION in .env as follows:


Then lumen will use storage_path('database.sqlite') as storage/database.sqlite

Otherwise, if you would like to assign DB_DATABASE directly, you should give the full path:


First, in the /database folder, create a new .sqlite file called database.sqlite. This file will store our data locally but leave it empty for now. Second, update your .env file to use sqlite, you can delete the .env.example file now but please read more about the env file configurations here. Use the code below as an example for now:

Step 1 : Open .env file & replace respective database configuration with following piece of code.

DB_CONNECTION = sqlite    
#DB_PORT = 3306
#DB_DATABASE = homestead
#DB_USERNAME = homestead
#DB_PASSWORD = secret

Note : lines those are started with # are basically commented code.

Step 2 : Create a new file, name it database.sqlite in database folder. It will store out database structure.

Step 3 : There is need to include this file as ignored in our versioning system as there will be so many changes are going to be made with database i.e. insert, delete, update etc. To ignore database.sqlite, Open .gitignore file, and add this line at the end database/database.sqlite. (i.e. path of database.sqlite file).

Lumen makes connecting with databases and running queries extremely simple. Currently Lumen supports four database systems: MySQL, Postgres, SQLite, and SQL Server.

It seems that Artisan is looking for that SQLite Database from another folder? Please sign in or create an account to participate in this conversation. The most concise screencasts for the working developer, updated daily.

You may not need to specify the column(s) name in the SQLite query if you are adding values for all the columns of the table. However, make sure the order of the values is in the same order as the columns in the table.

Lumens do add up. So if you have one n lumen flashlight and another m lumen flashlight the total luminous flux will be n+m. However interestingly our eyes (and ears) don't operate on a linear scale. 2x the lumens will not be perceived as 2 times the brightness because our eyes and ears work on a logarithmic scale.

  • with v5.4 default file location is /database/database.sqlite