不要怂,就是干,撸起袖子干!

Commit 2aa5a031 by Nick Mitchinson

Hacky solution for inserting arrays of dates in postgres

1 parent 0121225f
Showing with 6 additions and 0 deletions
...@@ -109,8 +109,14 @@ SqlString.arrayToList = function(array, timeZone, dialect, field) { ...@@ -109,8 +109,14 @@ SqlString.arrayToList = function(array, timeZone, dialect, field) {
} }
var ret = 'ARRAY[' + valstr + ']' var ret = 'ARRAY[' + valstr + ']'
if (!!field && !!field.type) { if (!!field && !!field.type) {
// 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, '') ret += '::' + field.type.replace(/\(\d+\)/g, '')
} }
}
return ret return ret
} else { } else {
if (array.map) { if (array.map) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!