Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit c32ac014
authored
Jul 30, 2019
by
bparan
Committed by
Sushant
Jul 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(mssql): save number bigger than 2147483647 as bigint (#11252)
1 parent
d2f33830
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletions
lib/dialects/mssql/query.js
test/integration/dialects/mssql/regressions.test.js
lib/dialects/mssql/query.js
View file @
c32ac01
...
...
@@ -19,7 +19,11 @@ class Query extends AbstractQuery {
paramType
.
type
=
TYPES
.
NVarChar
;
if
(
typeof
value
===
'number'
)
{
if
(
Number
.
isInteger
(
value
))
{
paramType
.
type
=
TYPES
.
Int
;
if
(
value
>=
-
2147483648
&&
value
<=
2147483647
)
{
paramType
.
type
=
TYPES
.
Int
;
}
else
{
paramType
.
type
=
TYPES
.
BigInt
;
}
}
else
{
paramType
.
type
=
TYPES
.
Numeric
;
//Default to a reasonable numeric precision/scale pending more sophisticated logic
...
...
test/integration/dialects/mssql/regressions.test.js
View file @
c32ac01
...
...
@@ -108,4 +108,28 @@ if (dialect.match(/^mssql/)) {
});
});
});
it
(
'saves value bigger than 2147483647, #11245'
,
function
()
{
const
BigIntTable
=
this
.
sequelize
.
define
(
'BigIntTable'
,
{
business_id
:
{
type
:
Sequelize
.
BIGINT
,
allowNull
:
false
}
},
{
freezeTableName
:
true
});
const
bigIntValue
=
2147483648
;
return
BigIntTable
.
sync
({
force
:
true
})
.
then
(()
=>
{
return
BigIntTable
.
create
({
business_id
:
bigIntValue
});
})
.
then
(()
=>
BigIntTable
.
findOne
())
.
then
(
record
=>
{
expect
(
Number
(
record
.
business_id
)).
to
.
equals
(
bigIntValue
);
});
});
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment