Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add sqlite to lumen?

Tags:

php

sqlite

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:

DB_CONNECTION=sqlite
DB_HOST=localhost
DB_DATABASE=database.sqlite

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:

Dotenv::load(__DIR__.'/../');
$app->withFacades();

I can't find what is wrong.

I work on ubuntu 14.04

like image 434
SzK Avatar asked Dec 01 '22 14:12

SzK


1 Answers

In my .env file I changed to:

DB_CONNECTION=sqlite
# DB_HOST=localhost
# DB_DATABASE=database.sqlite

I left only

DB_CONNECTION=sqlite

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

like image 184
SzK Avatar answered Dec 21 '22 08:12

SzK