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 3ba08e67
authored
May 29, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(model/attributes): fix mapping back serial values from postgres inserts with aliased fields
1 parent
7f43820e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletions
lib/dialects/postgres/query.js
test/model/attributes.test.js
lib/dialects/postgres/query.js
View file @
3ba08e6
...
...
@@ -151,7 +151,11 @@ module.exports = (function() {
if
(
!!
self
.
callee
.
Model
&&
!!
self
.
callee
.
Model
.
rawAttributes
&&
!!
self
.
callee
.
Model
.
rawAttributes
[
key
]
&&
!!
self
.
callee
.
Model
.
rawAttributes
[
key
].
type
&&
self
.
callee
.
Model
.
rawAttributes
[
key
].
type
.
toString
()
===
DataTypes
.
HSTORE
.
toString
())
{
record
=
hstore
.
parse
(
record
);
}
self
.
callee
.
dataValues
[
key
]
=
record
;
var
attr
=
Utils
.
_
.
find
(
self
.
callee
.
Model
.
rawAttributes
,
function
(
attribute
)
{
return
attribute
.
fieldName
===
key
||
attribute
.
field
===
key
;
});
self
.
callee
.
dataValues
[
attr
&&
attr
.
fieldName
||
key
]
=
record
;
}
}
}
...
...
test/model/attributes.test.js
View file @
3ba08e6
...
...
@@ -148,6 +148,15 @@ describe(Support.getTestDialectTeaser("Model"), function () {
});
});
it
(
'should make the aliased auto incremented primary key available after create'
,
function
()
{
var
self
=
this
;
return
this
.
User
.
create
({
name
:
'Barfoo'
}).
then
(
function
(
user
)
{
expect
(
user
.
get
(
'id'
)).
to
.
be
.
ok
;
});
});
it
(
'should work with where on includes for find'
,
function
()
{
var
self
=
this
;
...
...
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