bug: eloquent sync(), syncWithPivotValues(), syncWithoutDetaching() return auto convert to int or bigint #48933
Unanswered
Plong-Wasin
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Shouldn't class B extends Model
{
use HasFactory;
+ protected $keyType = 'string';
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Version
10.30.1
PHP Version
8.2.10
Database Driver & Version
Microsoft SQL Server 2022 (RTM-CU8) (KB5029666) - 16.0.4075.1 (X64) Aug 23 2023 14:04:50 Copyright (C) 2022 Microsoft Corporation Developer Edition (64-bit) on Linux (Ubuntu 20.04.6 LTS)
Description
first bug
this bug return wrong value it convert to bigint but keytype is string
second bug
if in db store string and run sync, syncWithPivotValues, syncWithoutDetaching and set detaching = false it return error
Illuminate\Database\QueryException SQLSTATE[22018]: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Conversion failed when converting the nvarchar value 'a' to data type int. (Connection: sqlsrv, SQL: update [ab] set [qty] = 2 where [ab].[a_id] = 1 and [b_id] in (1)).
Sorry i not good in english.
Steps To Reproduce
Beta Was this translation helpful? Give feedback.
All reactions