Skip to content

Conversation

dakira
Copy link
Contributor

@dakira dakira commented Mar 21, 2016

Having this configurable by ENV allows for easily running tests in memory by adding this to the phpunit.xml:

<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>

@GrahamCampbell GrahamCampbell changed the title allow for setting sqlite database via env [5.2] Allow for setting sqlite database via env Mar 23, 2016
@taylorotwell taylorotwell merged commit cd0a902 into laravel:master Mar 24, 2016
@MadMikeyB
Copy link
Contributor

This is causing breaks in 5.2.27. To reproduce, grab a fresh laravel install.

nano .env

Change DB_CONNECTION to sqlite in .env only. Save file.

touch database/database.sqlite (the database_path('database.sqlite') set in database/config.php before this change)
php artisan make:auth
php artisan migrate

  [InvalidArgumentException]            
  Database (homestead) does not exist.  

Because it's looking for homestead.

Change DB_DATABASE to this:
DB_DATABASE=/database/database.sqlite

and we still receive an error

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

Additionally, even if I put a full path in and it works - do we really want a path as a DB_DATABASE? Could that not be abstracted to a DB_PATH environment variable which is only then used by the SQLite Driver?

MadMikeyB added a commit to MadMikeyB/laravel that referenced this pull request Apr 1, 2016
@dakira
Copy link
Contributor Author

dakira commented May 18, 2016

@jamesfairhurst This change makes it actually easier to do the local testing in sqlite. You only need the two settings above to your phpunit.xml and use the DatabaseMigrations trait in your tests. No manual migrations necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants