Hi, did you add DatabaseMigrations to your test?
use Illuminate\Foundation\Testing\DatabaseMigrations;
use DatabaseMigrations;
Hi!
I have added a column, and changed one columnname in a new migration. I'm running Postgres.
For my test I use Sqlite.
Schema::table('log_services', function (Blueprint $table) {
$table->date('end')->nullable();
$table->renameColumn('date', 'start');
});
The new migration look like above
I get the following errormessage
SQLSTATE[HY000]: General error: 1 table log_services has no column named end (SQL: insert into "log_services" ("title", "start", "end", "user_id", "updated_at", "created_at")
The code works without a problem on local env using postgres, but test fails in sqlite
Any advice?
Problem solved by creating two new migrations
one with
$table->date('end')->nullable();
and one with
$table->renameColumn('date', 'start');
From Laravel documentation https://laravel.com/docs/8.x/migrations
Dropping or modifying multiple columns within a single migration while using an SQLite database is not supported.
Please or to participate in this conversation.