Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelogs/unreleased/use-1-for-mysql-default-timestamp.yml5
-rw-r--r--config/initializers/active_record_mysql_timestamp.rb3
2 files changed, 7 insertions, 1 deletions
diff --git a/changelogs/unreleased/use-1-for-mysql-default-timestamp.yml b/changelogs/unreleased/use-1-for-mysql-default-timestamp.yml
new file mode 100644
index 00000000000..80a982ebf99
--- /dev/null
+++ b/changelogs/unreleased/use-1-for-mysql-default-timestamp.yml
@@ -0,0 +1,5 @@
+---
+title: Use now() as default timestamp for MySQL
+merge_request: 14383
+author:
+type: fixed
diff --git a/config/initializers/active_record_mysql_timestamp.rb b/config/initializers/active_record_mysql_timestamp.rb
index af74c4ff6fb..b0e53b38978 100644
--- a/config/initializers/active_record_mysql_timestamp.rb
+++ b/config/initializers/active_record_mysql_timestamp.rb
@@ -17,7 +17,8 @@ if Gitlab::Database.mysql?
if options[:null] != false
sql << ' NULL'
elsif options[:column].default.nil?
- sql << ' DEFAULT 0'
+ # See: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14383
+ sql << ' DEFAULT now()'
end
end