Closed
Description
Laravel Version
11.6.0
PHP Version
8.3.6
Database Driver & Version
SQLite 3.45.1
Description
In Laravel 11, running tests in memory using SQLite I receive this error when trying to drop a column that have a foreign key on it. That wasn't a problem before when using doctrine/dbal
(#48864).
Steps To Reproduce
- Create a new Laravel project.
- Add a new migration that drop the
user_id
column on thesessions
table like so:
Schema::table('sessions', function (Blueprint $table) {
$table->dropColumn('user_id');
});
- Setup PHPUnit for testing with the connection set to SQLite and the database set to :memory:.
- Add
use RefreshDatabase;
in the defaultTestCase
class - Run the test
test_the_application_returns_a_successful_response
. - You should receive the following error:
There was 1 error:
1) Tests\Feature\ExampleTest::test_the_application_returns_a_successful_response
Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1 error in index sessions_user_id_index after drop column: no such column: user_id (Connection: sqlite, SQL: alter table "sessions" drop column "user_id")