I'm trying to use artisan migrate
to create tables in sqlite
.
I have the following in database.php
'sqlite' => [
'driver' => 'sqlite',
'database' => database_path('database.sqlite'),
'prefix' => '',
],
and this is my migrate class up
function
Schema::connection('sqlite')->create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Note:- I have set DB_CONNECTION to be sqlite via the environment variable.
On the command line I get nothing to migrate
, and no db is created (also no table).
Any ideas how I can get artisan migrate
to create an sqlite
db in laravel 5
?
I have no problem creating mysql
tables via artisan.
Thanks
its because you didnt create the db. use touch
command like this to create new sqlite database.
touch database/database.sqlite
then configure the environment variable like this
DB_CONNECTION=sqlite
DB_DATABASE=/absolute/path/to/database.sqlite
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With