This article covers how to properly use an
Sqlite database with Laravel
Sometime a simple sqlite database suffices to get the job done. With Laravel, it's very quick and easy to configure connections. Unfortunately I had a hard time to figure out why the basic settings didn't work. I was stuck with the following error:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'homestead.users' doesn't exist (SQL: select * from `users` where `email` = email@example.com limit 1)
It was caused by a bad
Update the following file:
sqlite array inside the
connections array and name your database
if you don't want to stick with the default name.
'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'database' => storage_path().'/:database_name.sqlite', 'prefix' => '', ],
Create a new
.sqlite database file inside the
Assuming you are in the root directory of your project, you can do the
homestead defines a
homestead database in its
Edit the key
databases: - :database_name
Prior to get your changes available you must reload
id from the command output then run the following new command:
vagrant reload :id --provision
Like this article? Found it useful?
Share it on your favorite social networks.