0

My problem is simple. I have a lot of generated migrations from a legacy app that I'm rewriting and while trying to add tests I came across this issue:

(I'm running in memory SQLite as the testing DB, with MySQL as the default one)

There was 1 error:

1) Tests\Unit\ExampleTest::testBasicTest
Illuminate\Database\QueryException: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'titulo' (SQL: alter table `receitas_i18n` add `titulo` varchar(150) not null, add `resumo` text not null, add `utensilios` text not null, add `modo_de_preparo` text not null, add `fonte` text not null, add `ingredientes_da_receita` text not null, add `status` tinyint(1) not null default '0', add `rendimento` varchar(100) not null)

Here's the offending migration:

    Schema::table('receitas_i18n', function (Blueprint $table) {
        $table->string('titulo')->nullable()->change();
        $table->text('resumo')->nullable()->change();
        $table->text('utensilios')->nullable()->change();
        $table->text('modo_de_preparo')->nullable()->change();
        $table->text('fonte')->nullable()->change();
        $table->text('ingredientes_da_receita')->nullable()->change();
        $table->string('rendimento')->nullable()->change();
    });

This is not the only place in the migrations where I set a few columns to nullable. Is there a way to test this using SQLite? Is there a workaround for this issue or will I have to setup a MySQL testing DB?

Thanks guys.

André Castelo
  • 173
  • 1
  • 8

0 Answers0