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 b495d5ed
authored
Apr 16, 2020
by
McGrady Chen
Committed by
GitHub
Apr 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(mssql) insert record failure because of BOOLEAN column type (#12090)
1 parent
5d51e696
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
lib/dialects/mssql/query.js
test/integration/dialects/mssql/regressions.test.js
lib/dialects/mssql/query.js
View file @
b495d5e
...
@@ -36,6 +36,8 @@ class Query extends AbstractQuery {
...
@@ -36,6 +36,8 @@ class Query extends AbstractQuery {
//Default to a reasonable numeric precision/scale pending more sophisticated logic
//Default to a reasonable numeric precision/scale pending more sophisticated logic
paramType
.
typeOptions
=
{
precision
:
30
,
scale
:
getScale
(
value
)
};
paramType
.
typeOptions
=
{
precision
:
30
,
scale
:
getScale
(
value
)
};
}
}
}
else
if
(
typeof
value
===
'boolean'
)
{
paramType
.
type
=
TYPES
.
Bit
;
}
}
if
(
Buffer
.
isBuffer
(
value
))
{
if
(
Buffer
.
isBuffer
(
value
))
{
paramType
.
type
=
TYPES
.
VarBinary
;
paramType
.
type
=
TYPES
.
VarBinary
;
...
...
test/integration/dialects/mssql/regressions.test.js
View file @
b495d5e
...
@@ -132,4 +132,28 @@ if (dialect.match(/^mssql/)) {
...
@@ -132,4 +132,28 @@ if (dialect.match(/^mssql/)) {
expect
(
Number
(
record
.
business_id
)).
to
.
equals
(
bigIntValue
);
expect
(
Number
(
record
.
business_id
)).
to
.
equals
(
bigIntValue
);
});
});
});
});
it
(
'saves boolean is true, #12090'
,
function
()
{
const
BooleanTable
=
this
.
sequelize
.
define
(
'BooleanTable'
,
{
status
:
{
type
:
Sequelize
.
BOOLEAN
,
allowNull
:
false
}
},
{
freezeTableName
:
true
});
const
value
=
true
;
return
BooleanTable
.
sync
({
force
:
true
})
.
then
(()
=>
{
return
BooleanTable
.
create
({
status
:
value
});
})
.
then
(()
=>
BooleanTable
.
findOne
())
.
then
(
record
=>
{
expect
(
record
.
status
).
to
.
equals
(
value
);
});
});
}
}
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