You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The MySql (5.7) Query is different between Laravel 8.79.0 and 9.x (beta-1), by 8.x it will include 'and posts.deleted_at is null' at the end of the query, while it's gone by 9.x.
class User extends Authenticatable
{
//publicfunctionposts()
{
return$this->hasMany(Post::class);
}
}
class Post extends Model
{
use \Illuminate\Database\Eloquent\SoftDeletes;
//
}
class ExampleTest extends TestCase
{
publicfunctiontest()
{
$user = new \App\Models\User;
// Expected (Laravel 8) : 'select * from `posts` where `posts`.`user_id` is null and `posts`.`user_id` is not null and `posts`.`deleted_at` is null'// Actual (Laravel 9) : 'select * from `posts` where `posts`.`user_id` is null and `posts`.`user_id` is not null'$this->assertSame('select * from `posts` where `posts`.`user_id` is null and `posts`.`user_id` is not null and `posts`.`deleted_at` is null', $user->posts()->toSql());
}
}
The text was updated successfully, but these errors were encountered:
Description:
The MySql (5.7) Query is different between Laravel 8.79.0 and 9.x (beta-1), by 8.x it will include 'and posts.deleted_at is null' at the end of the query, while it's gone by 9.x.
The text was updated successfully, but these errors were encountered: