ALTER TABLE Doctrine Error on run Migrations for SQLite base - TDD

Submitted by sr2ds - 4 months ago

If your need run TDD on SQLite (this perfect performance if run on memory) and your migrations have most alter tables, probably you have a problems.

1. Download Sequel Pro for Database Manager
2. Download this package https://github.com/cviebrock/sequel-pro-laravel-export
3. Export your DB for new Migrations;
4. Rename actually migrations folder to migrations_old;
5. Create new migrations folder and past new migrations generateds.
6. Re-run phpunit.

For run phpunit with Sqlite in memory:
'sqlite_testing' => [
    'driver' => 'sqlite',
    'database' => ':memory:',
    // 'database' => 'app/config/testing/sqlite.sqlite',
    'prefix' => '',
],

On your TestCase, do you can run migration and seeds:

public function createApplication()
{
    $unitTesting = true;
    $testEnvironment = 'testing';
    require __DIR__ . '/../../bootstrap/start.php';
    \Artisan::call('migrate');
    \Artisan::call('db:seed');
    \Mail::pretend(true);
}
comments powered by Disqus