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 5a36157e
authored
Jan 21, 2016
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5274 from sequelize/4958merge
Reroll #4958
2 parents
967b9d08
4d0af10d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
lib/dialects/mssql/data-types.js
test/unit/sql/insert.js
lib/dialects/mssql/data-types.js
View file @
5a36157
...
@@ -99,6 +99,13 @@ module.exports = function (BaseTypes) {
...
@@ -99,6 +99,13 @@ module.exports = function (BaseTypes) {
return
'DATETIME2'
;
return
'DATETIME2'
;
};
};
DATE
.
prototype
.
$stringify
=
function
(
date
,
options
)
{
date
=
this
.
$applyTimezone
(
date
,
options
);
// mssql not allow +timezone datetime format
return
date
.
format
(
'YYYY-MM-DD HH:mm:ss.SSS'
);
};
var
INTEGER
=
BaseTypes
.
INTEGER
.
inherits
(
function
()
{
var
INTEGER
=
BaseTypes
.
INTEGER
.
inherits
(
function
()
{
if
(
!
(
this
instanceof
INTEGER
))
return
new
INTEGER
();
if
(
!
(
this
instanceof
INTEGER
))
return
new
INTEGER
();
BaseTypes
.
INTEGER
.
apply
(
this
,
arguments
);
BaseTypes
.
INTEGER
.
apply
(
this
,
arguments
);
...
...
test/unit/sql/insert.js
View file @
5a36157
...
@@ -36,6 +36,30 @@ describe(Support.getTestDialectTeaser('SQL'), function() {
...
@@ -36,6 +36,30 @@ describe(Support.getTestDialectTeaser('SQL'), function() {
});
});
describe
(
'dates'
,
function
()
{
it
(
'formats the date correctly when inserting'
,
function
()
{
var
timezoneSequelize
=
Support
.
createSequelizeInstance
({
timezone
:
Support
.
getTestDialect
()
===
'sqlite'
?
'+00:00'
:
'CET'
});
var
User
=
timezoneSequelize
.
define
(
'user'
,
{
date
:
{
type
:
DataTypes
.
DATE
}
},{
timestamps
:
false
});
expectsql
(
timezoneSequelize
.
dialect
.
QueryGenerator
.
insertQuery
(
User
.
tableName
,
{
date
:
new
Date
(
Date
.
UTC
(
2015
,
0
,
20
))},
User
.
rawAttributes
,
{}),
{
postgres
:
'INSERT INTO "users" ("date") VALUES (\'2015-01-20 01:00:00.000 +01:00\');'
,
sqlite
:
'INSERT INTO `users` (`date`) VALUES (\'2015-01-20 00:00:00.000 +00:00\');'
,
mssql
:
'INSERT INTO [users] ([date]) VALUES (N\'2015-01-20 01:00:00.000\');'
,
mysql
:
"INSERT INTO `users` (`date`) VALUES ('2015-01-20 01:00:00');"
});
});
});
describe
(
'bulkCreate'
,
function
()
{
describe
(
'bulkCreate'
,
function
()
{
it
(
'bulk create with onDuplicateKeyUpdate'
,
function
()
{
it
(
'bulk create with onDuplicateKeyUpdate'
,
function
()
{
// Skip mssql for now, it seems broken
// Skip mssql for now, it seems broken
...
...
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