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 a4156ebc
authored
Feb 25, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
order by subquery logic should also work in cases of {model: Model} instead of just Model
1 parent
e2b5dc7d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
lib/dialects/abstract/query-generator.js
test/dao-factory/findAll.test.js
lib/dialects/abstract/query-generator.js
View file @
a4156eb
...
...
@@ -780,7 +780,7 @@ module.exports = (function() {
if
(
Array
.
isArray
(
options
.
order
))
{
options
.
order
.
forEach
(
function
(
t
)
{
if
(
subQuery
&&
!
(
t
[
0
]
instanceof
daoFactory
))
{
if
(
subQuery
&&
!
(
t
[
0
]
instanceof
daoFactory
)
&&
!
(
t
[
0
].
model
instanceof
daoFactory
)
)
{
subQueryOrder
.
push
(
this
.
quote
(
t
,
factory
))
}
mainQueryOrder
.
push
(
this
.
quote
(
t
,
factory
))
...
...
test/dao-factory/findAll.test.js
View file @
a4156eb
...
...
@@ -1039,7 +1039,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
callback
()
})
},
function
()
{
done
()})
})
,
})
it
(
'sorts by 2nd degree association'
,
function
(
done
)
{
var
self
=
this
...
...
@@ -1084,6 +1084,29 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
},
function
()
{
done
()})
})
it
(
'sorts by 2nd degree association with alias while using limit'
,
function
(
done
)
{
var
self
=
this
async
.
forEach
([
[
'ASC'
,
'Europe'
,
'France'
,
'Fred'
],
[
'DESC'
,
'Europe'
,
'England'
,
'Kim'
]
],
function
(
params
,
callback
)
{
self
.
Continent
.
findAll
({
include
:
[
{
model
:
self
.
Country
,
include
:
[
self
.
Person
,
{
model
:
self
.
Person
,
as
:
'Residents'
}
]
}
],
order
:
[
[
{
model
:
self
.
Country
},
{
model
:
self
.
Person
,
as
:
'Residents'
},
'lastName'
,
params
[
0
]
]
],
limit
:
3
}).
done
(
function
(
err
,
continents
)
{
expect
(
err
).
not
.
to
.
be
.
ok
expect
(
continents
).
to
.
exist
expect
(
continents
[
0
]).
to
.
exist
expect
(
continents
[
0
].
name
).
to
.
equal
(
params
[
1
])
expect
(
continents
[
0
].
countries
).
to
.
exist
expect
(
continents
[
0
].
countries
[
0
]).
to
.
exist
expect
(
continents
[
0
].
countries
[
0
].
name
).
to
.
equal
(
params
[
2
])
expect
(
continents
[
0
].
countries
[
0
].
residents
).
to
.
exist
expect
(
continents
[
0
].
countries
[
0
].
residents
[
0
]).
to
.
exist
expect
(
continents
[
0
].
countries
[
0
].
residents
[
0
].
name
).
to
.
equal
(
params
[
3
])
callback
()
})
},
function
()
{
done
()})
})
}),
describe
(
'ManyToMany'
,
function
()
{
...
...
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