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 1749f6ad
authored
Jun 18, 2013
by
Seth Samuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Keep milliseconds in timestamps for postgres
1 parent
06eac066
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
lib/dao.js
lib/utils.js
lib/dao.js
View file @
1749f6a
...
@@ -138,7 +138,7 @@ module.exports = (function() {
...
@@ -138,7 +138,7 @@ module.exports = (function() {
}
}
if
(
this
.
__options
.
timestamps
&&
this
.
dataValues
.
hasOwnProperty
(
updatedAtAttr
))
{
if
(
this
.
__options
.
timestamps
&&
this
.
dataValues
.
hasOwnProperty
(
updatedAtAttr
))
{
this
.
dataValues
[
updatedAtAttr
]
=
values
[
updatedAtAttr
]
=
Utils
.
now
()
this
.
dataValues
[
updatedAtAttr
]
=
values
[
updatedAtAttr
]
=
Utils
.
now
(
this
.
sequelize
.
options
.
dialect
)
}
}
var
errors
=
this
.
validate
()
var
errors
=
this
.
validate
()
...
@@ -369,8 +369,8 @@ module.exports = (function() {
...
@@ -369,8 +369,8 @@ module.exports = (function() {
}
}
if
(
this
.
__options
.
timestamps
)
{
if
(
this
.
__options
.
timestamps
)
{
defaults
[
this
.
__options
.
underscored
?
'created_at'
:
'createdAt'
]
=
Utils
.
now
()
defaults
[
this
.
__options
.
underscored
?
'created_at'
:
'createdAt'
]
=
Utils
.
now
(
this
.
sequelize
.
options
.
dialect
)
defaults
[
this
.
__options
.
underscored
?
'updated_at'
:
'updatedAt'
]
=
Utils
.
now
()
defaults
[
this
.
__options
.
underscored
?
'updated_at'
:
'updatedAt'
]
=
Utils
.
now
(
this
.
sequelize
.
options
.
dialect
)
if
(
this
.
__options
.
paranoid
)
{
if
(
this
.
__options
.
paranoid
)
{
defaults
[
this
.
__options
.
underscored
?
'deleted_at'
:
'deletedAt'
]
=
null
defaults
[
this
.
__options
.
underscored
?
'deleted_at'
:
'deletedAt'
]
=
null
...
...
lib/utils.js
View file @
1749f6a
...
@@ -164,9 +164,9 @@ var Utils = module.exports = {
...
@@ -164,9 +164,9 @@ var Utils = module.exports = {
return
subClass
;
return
subClass
;
},
},
now
:
function
()
{
now
:
function
(
dialect
)
{
var
now
=
new
Date
()
var
now
=
new
Date
()
now
.
setMilliseconds
(
0
)
if
(
dialect
!=
"postgres"
)
now
.
setMilliseconds
(
0
)
return
now
return
now
},
},
...
...
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