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 46abbe88
authored
Jan 05, 2015
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] fix case with order: sequelize.literal(), closes #2838
1 parent
4dd3f181
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
1 deletions
changelog.md
lib/dialects/abstract/query-generator.js
test/model/findAll/order.test.js
changelog.md
View file @
46abbe8
# Next
-
[
BUG
]
Fixed issue with
`order: sequelize.literal('string')`
# 2.0.0-rc6
-
[
BUG
]
Fixed issue with including by association reference and where
...
...
lib/dialects/abstract/query-generator.js
View file @
46abbe8
...
...
@@ -1231,7 +1231,7 @@ module.exports = (function() {
mainQueryOrder
.
push
(
this
.
quote
(
t
,
model
));
}.
bind
(
this
));
}
else
{
mainQueryOrder
.
push
(
options
.
order
);
mainQueryOrder
.
push
(
this
.
quote
(
options
.
order
,
model
)
);
}
if
(
mainQueryOrder
.
length
)
{
...
...
test/model/findAll/order.test.js
0 → 100644
View file @
46abbe8
'use strict'
;
var
chai
=
require
(
'chai'
)
,
Sequelize
=
require
(
'../../../index'
)
,
expect
=
chai
.
expect
,
Support
=
require
(
__dirname
+
'/../../support'
)
,
DataTypes
=
require
(
__dirname
+
'/../../../lib/data-types'
)
,
dialect
=
Support
.
getTestDialect
()
,
config
=
require
(
__dirname
+
'/../../config/config'
)
,
datetime
=
require
(
'chai-datetime'
)
,
_
=
require
(
'lodash'
)
,
moment
=
require
(
'moment'
)
,
async
=
require
(
'async'
)
,
current
=
Support
.
sequelize
;
chai
.
use
(
datetime
);
chai
.
config
.
includeStack
=
true
;
describe
(
Support
.
getTestDialectTeaser
(
'Model'
),
function
()
{
describe
(
'findAll'
,
function
()
{
describe
(
'order'
,
function
()
{
describe
(
'Sequelize.literal()'
,
function
()
{
beforeEach
(
function
()
{
this
.
User
=
this
.
sequelize
.
define
(
'User'
,
{
email
:
DataTypes
.
STRING
});
return
this
.
User
.
sync
({
force
:
true
}).
bind
(
this
).
then
(
function
()
{
return
this
.
User
.
create
({
email
:
'test@sequelizejs.com'
});
});
});
it
(
'should work with order: literal()'
,
function
()
{
return
this
.
User
.
findAll
({
order
:
this
.
sequelize
.
literal
(
'email IS NOT NULL'
)
}).
then
(
function
(
users
)
{
expect
(
users
.
length
).
to
.
equal
(
1
);
users
.
forEach
(
function
(
user
)
{
expect
(
user
.
get
(
'email'
)).
to
.
be
.
ok
;
});
});
});
it
(
'should work with order: [literal()]'
,
function
()
{
return
this
.
User
.
findAll
({
order
:
[
this
.
sequelize
.
literal
(
'email IS NOT NULL'
)]
}).
then
(
function
(
users
)
{
expect
(
users
.
length
).
to
.
equal
(
1
);
users
.
forEach
(
function
(
user
)
{
expect
(
user
.
get
(
'email'
)).
to
.
be
.
ok
;
});
});
});
it
(
'should work with order: [[literal()]]'
,
function
()
{
return
this
.
User
.
findAll
({
order
:
[
[
this
.
sequelize
.
literal
(
'email IS NOT NULL'
)]
]
}).
then
(
function
(
users
)
{
expect
(
users
.
length
).
to
.
equal
(
1
);
users
.
forEach
(
function
(
user
)
{
expect
(
user
.
get
(
'email'
)).
to
.
be
.
ok
;
});
});
});
});
});
});
});
\ No newline at end of file
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