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 6bf2a1df
authored
Nov 04, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:sequelize/sequelize
2 parents
1c7db237
67082f0f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletions
lib/sequelize.js
lib/sql-string.js
test/postgres/dao.test.js
lib/sequelize.js
View file @
6bf2a1d
...
...
@@ -177,6 +177,7 @@ module.exports = (function() {
replication
:
this
.
options
.
replication
,
dialectModulePath
:
this
.
options
.
dialectModulePath
,
maxConcurrentQueries
:
this
.
options
.
maxConcurrentQueries
,
keepDefaultTimezone
:
this
.
options
.
keepDefaultTimezone
,
dialectOptions
:
this
.
options
.
dialectOptions
};
...
...
lib/sql-string.js
View file @
6bf2a1d
...
...
@@ -112,7 +112,13 @@ SqlString.arrayToList = function(array, timeZone, dialect, field) {
}
var
ret
=
'ARRAY['
+
valstr
+
']'
;
if
(
!!
field
&&
!!
field
.
type
)
{
ret
+=
'::'
+
field
.
type
.
replace
(
/
\(\d
+
\)
/g
,
''
);
// Need to translate DATETIME to TIMESTAMP WITH TIME ZONE for Postgres here
// There has to be a better solution than this
if
(
dialect
===
"postgres"
)
{
ret
+=
'::'
+
field
.
type
.
replace
(
/
\(\d
+
\)
/g
,
''
).
replace
(
/DATETIME/
,
'TIMESTAMP WITH TIME ZONE'
);
}
else
{
ret
+=
'::'
+
field
.
type
.
replace
(
/
\(\d
+
\)
/g
,
''
);
}
}
return
ret
;
}
else
{
...
...
test/postgres/dao.test.js
View file @
6bf2a1d
...
...
@@ -370,6 +370,26 @@ if (dialect.match(/^postgres/)) {
})
})
describe
(
'timestamps'
,
function
()
{
beforeEach
(
function
(
done
)
{
this
.
User
=
this
.
sequelize
.
define
(
'User'
,
{
dates
:
DataTypes
.
ARRAY
(
DataTypes
.
DATE
)
})
this
.
User
.
sync
({
force
:
true
}).
success
(
function
()
{
done
()
})
})
it
(
'should use postgres "TIMESTAMP WITH TIME ZONE" instead of "DATETIME"'
,
function
(
done
)
{
this
.
User
.
create
({
dates
:
[]
}).
on
(
'sql'
,
function
(
sql
)
{
expect
(
sql
.
indexOf
(
'TIMESTAMP WITH TIME ZONE'
)).
to
.
be
.
greaterThan
(
0
)
done
()
})
})
})
describe
(
'model'
,
function
()
{
it
(
"create handles array correctly"
,
function
(
done
)
{
this
.
User
...
...
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