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 175da2d0
authored
Apr 08, 2019
by
javiertury
Committed by
Sushant
Apr 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(mariadb): named timezone support (#10705)
1 parent
d6daaf1b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
lib/dialects/mariadb/connection-manager.js
test/integration/timezone.test.js
lib/dialects/mariadb/connection-manager.js
View file @
175da2d
...
...
@@ -54,13 +54,18 @@ class ConnectionManager extends AbstractConnectionManager {
* @private
*/
connect
(
config
)
{
// Named timezone is not supported in mariadb, convert to offset
let
tzOffset
=
this
.
sequelize
.
options
.
timezone
;
tzOffset
=
/
\/
/
.
test
(
tzOffset
)
?
momentTz
.
tz
(
tzOffset
).
format
(
'Z'
)
:
tzOffset
;
const
connectionConfig
=
{
host
:
config
.
host
,
port
:
config
.
port
,
user
:
config
.
username
,
password
:
config
.
password
,
database
:
config
.
database
,
timezone
:
t
his
.
sequelize
.
options
.
timezone
,
timezone
:
t
zOffset
,
typeCast
:
ConnectionManager
.
_typecast
.
bind
(
this
),
bigNumberStrings
:
false
,
supportBigNumbers
:
true
,
...
...
@@ -73,10 +78,6 @@ class ConnectionManager extends AbstractConnectionManager {
if
(
!
this
.
sequelize
.
config
.
keepDefaultTimezone
)
{
// set timezone for this connection
// but named timezone are not directly supported in mariadb, so get its offset first
let
tzOffset
=
this
.
sequelize
.
options
.
timezone
;
tzOffset
=
/
\/
/
.
test
(
tzOffset
)
?
momentTz
.
tz
(
tzOffset
).
format
(
'Z'
)
:
tzOffset
;
if
(
connectionConfig
.
initSql
)
{
if
(
!
Array
.
isArray
(
connectionConfig
.
initSql
))
{
...
...
test/integration/timezone.test.js
View file @
175da2d
...
...
@@ -38,7 +38,7 @@ if (dialect !== 'sqlite') {
});
});
if
(
dialect
===
'mysql'
)
{
if
(
dialect
===
'mysql'
||
dialect
===
'mariadb'
)
{
it
(
'handles existing timestamps'
,
function
()
{
const
NormalUser
=
this
.
sequelize
.
define
(
'user'
,
{}),
TimezonedUser
=
this
.
sequelizeWithTimezone
.
define
(
'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