I want to deploy my application in multiple pc's and it's using sqlite for db. Is there any way to set a relative path instead of an absolute one in my env file? Is there any alternative to sqlite to have portable database?
Example is there anyway to use something like this:
DB_DATABASE=${ variable/to/database/folder }/database.sqlite
Instead of:
DB_DATABASE=C:\wamp64\www\JUICE\projects\my-project\database\database.sqlite
First step comment out DB_DATABASE in .env:
#DB_DATABASE=homestead
Second, check you have this in config/database.php
, it's the code that ships with laravel:
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
And you have your database path relative to your application root and changing with the application directory because you rely on the path helper database_path()
.
I can't give you any alternative, I use sqlite
for local development with satisfaction.