summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-01-02 12:33:42 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-01-02 12:33:42 +0000
commit81dcd8ed8f71968215c7e776da482e83823c8b74 (patch)
treefdc1ab89e688b4bf2812007b8c84cf2b539bc850 /config
parent91864a92b9821f43c4551f96c6af8dff49bbedaa (diff)
parentd2ebc9b931d12cb2cb120d6f7c940744bc1be39c (diff)
downloadgitlab-ce-81dcd8ed8f71968215c7e776da482e83823c8b74.tar.gz
Merge branch '39289-local-schema-rb-automatically-reverts-datetime-to-datetime_with_timezone-after-migrations' into 'master'
Prevent schema.rb reverting from datetime_with_timezone to datetime Closes #39289 See merge request gitlab-org/gitlab-ce!14956
Diffstat (limited to 'config')
-rw-r--r--config/initializers/active_record_data_types.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/config/initializers/active_record_data_types.rb b/config/initializers/active_record_data_types.rb
index fef591c397d..0359e14b232 100644
--- a/config/initializers/active_record_data_types.rb
+++ b/config/initializers/active_record_data_types.rb
@@ -79,3 +79,8 @@ elsif Gitlab::Database.mysql?
NATIVE_DATABASE_TYPES[:datetime_with_timezone] = { name: 'timestamp' }
end
end
+
+# Ensure `datetime_with_timezone` columns are correctly written to schema.rb
+if (ActiveRecord::Base.connection.active? rescue false)
+ ActiveRecord::Base.connection.send :reload_type_map
+end