laravel development environment sqlite database does not exist laravel development environment sqlite database does not exist sqlite sqlite

laravel development environment sqlite database does not exist


Wow, typos and wrong paths.

Copying the sqlite array from config/database.php into config/development/database.php I forgot to change the path to the development.sqlite file from

__DIR__.'/../database/development.sqlite'

to

__DIR__.'/../../database/development.sqlite'

And for the in memory test it should have been

':memory:'

instead of

':memory'


I noticed that my database.php file had the following

'sqlite' => [    'driver' => 'sqlite',    'database' => env('DB_DATABASE', database_path('database.sqlite')),    'prefix' => '',],

I changed it to read the following, and it worked just fine.

'sqlite' => [    'driver' => 'sqlite',    'database' => database_path('database.sqlite'),    'prefix' => '',],


One of the problem which I faced was I use "touch storage/database.sqlite" in terminal, so database is created in Storage folder instead of database folder.

in my config/database.php path is database_path('database.sqlite')

'sqlite' => [        'driver' => 'sqlite',        'database' => database_path('database.sqlite'),        'prefix' => '',    ],

than I use command "php artisan migrate" which gave me error "Database (/Applications/MAMP/htdocs/FOLDER_NAME/database/database.sqlite) does
not exist."

so it's obvious database file is not in database folder as It was generated in Storage folder, so copy "database.sqlite" from storage folder or run command "touch database/database.sqlite"

Hope that helps.!!