Level 1
Seems to be an issue with doctrine/dbal v3.4.1
https://github.com/doctrine/dbal/pull/5597/commits/f62eeba14f2cf5b4aee9495d36e44ee94914b86b
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi all,
after I did a composer update, all my tests are failing. The error message I get is as follows:
• Tests\Feature\ProtocolTest > index can be rendered
ErrorException
Undefined array key -1
at vendor/doctrine/dbal/src/Schema/SqliteSchemaManager.php:605
601▕ $foreignKeyCount = count($foreignKeyDetails);
602▕
603▕ foreach ($columns as $i => $column) {
604▕ // SQLite identifies foreign keys in reverse order of appearance in SQL
➜ 605▕ $columns[$i] = array_merge($column, $foreignKeyDetails[$foreignKeyCount - $column['id'] - 1]);
606▕ }
607▕
608▕ return $columns;
609▕ }
+12 vendor frames
13 database/migrations/2021_09_07_105757_update_models_with_status_id_and_priority_id.php:19
Illuminate\Support\Facades\Facade::__callStatic("table")
+23 vendor frames
37 tests/TestCase.php:38
Illuminate\Foundation\Testing\TestCase::setUp()
It seems like something is wrong with my migration file, but the weird thing is, that it used to work without any problems before I ran composer update. Any ideas about that issue?
Here is the migration file:
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateModelsWithStatusIdAndPriorityId extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('protocols', function (Blueprint $table) {
$table->unsignedBigInteger('status_id')->default(1)->change();
$table->unsignedBigInteger('priority_id')->default(1)->change();
});
Schema::table('activity_reports', function (Blueprint $table) {
$table->unsignedBigInteger('status_id')->default(1)->change();
$table->unsignedBigInteger('priority_id')->default(1)->change();
});
Schema::table('custom_templates', function (Blueprint $table) {
$table->unsignedBigInteger('status_id')->default(1)->change();
$table->unsignedBigInteger('priority_id')->default(1)->change();
});
Schema::table('data_processing_agreements', function (Blueprint $table) {
$table->unsignedBigInteger('status_id')->default(1)->change();
$table->unsignedBigInteger('priority_id')->default(1)->change();
});
Schema::table('data_protection_impact_assessments', function (Blueprint $table) {
$table->unsignedBigInteger('status_id')->default(1)->change();
$table->unsignedBigInteger('priority_id')->default(1)->change();
});
Schema::table('external_impacts', function (Blueprint $table) {
$table->unsignedBigInteger('status_id')->default(1)->change();
$table->unsignedBigInteger('priority_id')->default(1)->change();
});
Schema::table('general_templates', function (Blueprint $table) {
$table->unsignedBigInteger('status_id')->default(1)->change();
$table->unsignedBigInteger('priority_id')->default(1)->change();
});
Schema::table('processing_activities', function (Blueprint $table) {
$table->unsignedBigInteger('status_id')->default(1)->change();
$table->unsignedBigInteger('priority_id')->default(1)->change();
});
Schema::table('regulations', function (Blueprint $table) {
$table->unsignedBigInteger('status_id')->default(1)->change();
$table->unsignedBigInteger('priority_id')->default(1)->change();
});
Schema::table('tasks', function (Blueprint $table) {
$table->unsignedBigInteger('status_id')->default(1)->change();
$table->unsignedBigInteger('priority_id')->default(1)->change();
});
Schema::table('technical_organisational_measures', function (Blueprint $table) {
$table->unsignedBigInteger('status_id')->default(1)->change();
$table->unsignedBigInteger('priority_id')->default(1)->change();
});
}
David
Please or to participate in this conversation.