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 2f92e212
authored
Mar 29, 2019
by
Gabe Gorelick
Committed by
Sushant
Mar 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(mysql): boolean TINYINT support (#10660)
1 parent
de39cff8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletions
lib/data-types.js
test/integration/data-types.test.js
lib/data-types.js
View file @
2f92e21
...
...
@@ -147,7 +147,7 @@ NUMBER.prototype.validate = function(value) {
return
true
;
};
NUMBER
.
prototype
.
_stringify
=
function
_stringify
(
number
)
{
if
(
typeof
number
===
'number'
||
number
===
null
||
number
===
undefined
)
{
if
(
typeof
number
===
'number'
||
typeof
number
===
'boolean'
||
number
===
null
||
number
===
undefined
)
{
return
number
;
}
...
...
test/integration/data-types.test.js
View file @
2f92e21
...
...
@@ -228,6 +228,43 @@ describe(Support.getTestDialectTeaser('DataTypes'), () => {
});
});
if
(
dialect
===
'mysql'
)
{
it
(
'should handle TINYINT booleans'
,
function
()
{
const
User
=
this
.
sequelize
.
define
(
'user'
,
{
id
:
{
type
:
Sequelize
.
TINYINT
,
primaryKey
:
true
},
isRegistered
:
Sequelize
.
TINYINT
});
return
User
.
sync
({
force
:
true
}).
then
(()
=>
{
return
User
.
create
({
id
:
1
,
isRegistered
:
true
});
}).
then
(
registeredUser
=>
{
expect
(
registeredUser
.
isRegistered
).
to
.
equal
(
true
);
return
User
.
findOne
({
where
:
{
id
:
1
,
isRegistered
:
true
}
});
}).
then
(
registeredUser
=>
{
expect
(
registeredUser
).
to
.
be
.
ok
;
expect
(
registeredUser
.
isRegistered
).
to
.
equal
(
1
);
return
User
.
create
({
id
:
2
,
isRegistered
:
false
});
}).
then
(
unregisteredUser
=>
{
expect
(
unregisteredUser
.
isRegistered
).
to
.
equal
(
false
);
return
User
.
findOne
({
where
:
{
id
:
2
,
isRegistered
:
false
}
});
}).
then
(
unregisteredUser
=>
{
expect
(
unregisteredUser
).
to
.
be
.
ok
;
expect
(
unregisteredUser
.
isRegistered
).
to
.
equal
(
0
);
});
});
}
it
(
'calls parse and stringify for DOUBLE'
,
()
=>
{
const
Type
=
new
Sequelize
.
DOUBLE
();
...
...
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