summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB/Schema
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2016-05-14 16:09:38 +0200
committerDavid Lawrence <dkl@mozilla.com>2016-05-14 16:09:38 +0200
commit35df2cd5bc44b1f369ca6d32dfe1c600c1608dc4 (patch)
tree7817fa1c5616ce13268e7aecd6dde23f24ba314c /Bugzilla/DB/Schema
parent627be9de2e720f289f0b151c0057be7af0e84a72 (diff)
downloadbugzilla-35df2cd5bc44b1f369ca6d32dfe1c600c1608dc4.tar.gz
bugzilla-35df2cd5bc44b1f369ca6d32dfe1c600c1608dc4.tar.xz
Bug 232193 - bmo's systems (webheads, database, etc) should use UTC natively for o/s timezone and date storage
Diffstat (limited to 'Bugzilla/DB/Schema')
-rw-r--r--Bugzilla/DB/Schema/Mysql.pm23
1 files changed, 22 insertions, 1 deletions
diff --git a/Bugzilla/DB/Schema/Mysql.pm b/Bugzilla/DB/Schema/Mysql.pm
index b0a40586f..bcc663e83 100644
--- a/Bugzilla/DB/Schema/Mysql.pm
+++ b/Bugzilla/DB/Schema/Mysql.pm
@@ -119,7 +119,7 @@ sub _initialize {
LONGBLOB => 'longblob',
- DATETIME => 'datetime',
+ DATETIME => 'timestamp',
DATE => 'date',
};
@@ -396,4 +396,25 @@ sub get_rename_column_ddl {
return ("ALTER TABLE $table CHANGE COLUMN $old_name $new_name $def");
}
+sub get_type_ddl {
+ my $self = shift;
+ my $type_ddl = $self->SUPER::get_type_ddl(@_);
+
+ # TIMESTAMPS as of 5.6.6 still default to
+ # 'NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'
+ # unless explicitly setup in the table definition. This will change in future releases
+ # and can be disabled by using 'explicit_defaults_for_timestamp = 1' in my.cnf.
+ # So instead, we explicitly setup TIMESTAMP types to not be automatic.
+ if ($type_ddl =~ /^timestamp/i) {
+ if ($type_ddl !~ /NOT NULL/) {
+ $type_ddl .= ' NULL DEFAULT NULL';
+ }
+ if ($type_ddl =~ /NOT NULL/ && $type_ddl !~ /DEFAULT/) {
+ $type_ddl .= ' DEFAULT CURRENT_TIMESTAMP';
+ }
+ }
+
+ return $type_ddl;
+}
+
1;