Sure that tax_rate is not part of a foreign key?
If yes, save your db, recreate it (php artisan migrate:refresh), retest
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello, I want to change the columns datatype from integer to decimal and have written a simple migration:
Schema::table('products', function (Blueprint $table) {
$table->decimal('tax_rate', 6, 2)->change();
});
The migration runs smoothly when executing php artisan migrate. When I run my tests with php artisan test it fails with:
SQLSTATE[HY000]: General error: 1 foreign key mismatch - "order_slots" referencing "products" (SQL: INSERT INTO products (id, sku, name, active, tax_rate, created_at, updated_at) SELECT id, sku, name, active, tax_rate, created_at, updated_at FROM __temp__products)
Why is this happening and how can I solve this? I am using SQLlite locally for the test environment and when I google it, I stumble across some who might have the same issue, but I can not see any solution to this?
Can anybody help?
Please or to participate in this conversation.