artisan migration and seeding on sqlite in memory, always empty?
NickName:Glasnhost Ask DateTime:2017-06-08T04:05:28

artisan migration and seeding on sqlite in memory, always empty?

I'm trying to setup migration and seeding for a Laravel 5.4 application. Migration and seeding are working for mysql db. However when I try to run it on a sqlite in memory db, it seems to me that the db remains empty. Migration apparently run, but seeding complains about missing tables.

I simply configured sqlite as this in database.php

    'sqlite_memory' => [
        'driver' => 'sqlite',
        'database' => ':memory:',
        'prefix' => '',
    ],

and I set my default connections as

'default' => env('DB_CONNECTION', 'test_sqlite'),

I had eliminated all other kinds of connections from database.php and .env, just in case.

After succesfully running php artisan migrate, I enter sqlite3 and I see only a db:

Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .database
seq  name             file                                                      
---  ---------------     
 0    main                                                                       
sqlite> .dbinfo
sqlite> .tables
sqlite> 

It looks to me as there is nothing inside. If I try php artisan db:seed, I get immediately "no such table error" on any table..

I did manage however to make sqlite work with file db. I don't know how to troubleshoot this...

Copyright Notice:Content Author:「Glasnhost」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/44421846/artisan-migration-and-seeding-on-sqlite-in-memory-always-empty

More about “artisan migration and seeding on sqlite in memory, always empty?” related questions

artisan migration and seeding on sqlite in memory, always empty?

I'm trying to setup migration and seeding for a Laravel 5.4 application. Migration and seeding are working for mysql db. However when I try to run it on a sqlite in memory db, it seems to me that t...

Show Detail

Laravel - How do I migrate data into a live database using artisan migration?

I have successfully created a database 'translations' table using artisan migration. When this database is released into a production environment, I will start getting translation text files for new

Show Detail

php artisan migrate with sqlite throws error, database is locked

I was trying to play a bit with Laravel and SQLite but whenever I run php artisan migrate I always get the same error: Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 5 databa...

Show Detail

Conceptual difference between seeding and migration

We use knex for database migrations, and we now need to introduce database seeding to the mix. Seeding is a concept in knex, and the seed files are run by separate commands. Currently, we need to s...

Show Detail

Laravel4 Seeding in testing environment fails using SQLite, while succeeds using mysql

In short: seeding is working fine with mysql while breaks with sqlite. The broken code is like DB::table('user')->insert($users); Seed code: <?php public function run() { DB::table('use...

Show Detail

artisan output one by one

If I run php artisan migrate:fresh --seed --force in console everything works as expected. The output is displayed one by one. Dropped all tables successfully. Migration table created successfull...

Show Detail

Laravel Migration and seeding error

I am just starting to use the Laravel framework and its command prompt. I'm having trouble with the migration and seeding features, however. I am developing on a WAMP server on a Windows 7 64-bit ...

Show Detail

Entity Framework Migration Automatic Seeding

I am trying to migrate from the old SQL Server CE and winforms to Entity Framework code-first Migration as this is the new approach I have taken for the past 1 and half year now. My question is: I...

Show Detail

Why is Laravel PHPUnit in-memory test seeding my main db?

[UPDATE] Testing seems to work find in-memory if i used query builder (i.e. DB::table()), but uses main table when using Eloquent. Still no hint. I have followed these 2 tutorials to get in-memory

Show Detail

Environment specific prompt when migrating or seeding in Laravel/Artisan

I like that Artisan will prompt me before running potentially destructive operations like migrating and seeding on production and I'm wondering if there's any way for me to get that functionality in

Show Detail