diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-31 14:34:02 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-31 14:34:02 +0000 |
commit | 568508c7d549a3f498a72db824c9d97f4ba0e098 (patch) | |
tree | 9729a63f6b86f5196b3d43de97e1aa3a3a33cab0 /lib | |
parent | bfb5107ae720232a15060ee55feba213ee7dd097 (diff) | |
parent | 1796936abc8873c1fcc38061fe3d8b44acda3ffe (diff) | |
download | gitlab-ce-568508c7d549a3f498a72db824c9d97f4ba0e098.tar.gz |
Merge branch '39561-seed_fu-fails-to-load-gitlab-test' into 'master'
Handle large values on `MergeRequestDiffCommit` dates
Closes #39561
See merge request gitlab-org/gitlab-ce!15093
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/database.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb index 357f16936c6..43a00d6cedb 100644 --- a/lib/gitlab/database.rb +++ b/lib/gitlab/database.rb @@ -4,6 +4,10 @@ module Gitlab # https://www.postgresql.org/docs/9.2/static/datatype-numeric.html # http://dev.mysql.com/doc/refman/5.7/en/integer-types.html MAX_INT_VALUE = 2147483647 + # The max value between MySQL's TIMESTAMP and PostgreSQL's timestampz: + # https://www.postgresql.org/docs/9.1/static/datatype-datetime.html + # https://dev.mysql.com/doc/refman/5.7/en/datetime.html + MAX_TIMESTAMP_VALUE = Time.at((1 << 31) - 1).freeze def self.config ActiveRecord::Base.configurations[Rails.env] @@ -120,6 +124,10 @@ module Gitlab EOF end + def self.sanitize_timestamp(timestamp) + MAX_TIMESTAMP_VALUE > timestamp ? timestamp : MAX_TIMESTAMP_VALUE.dup + end + # pool_size - The size of the DB pool. # host - An optional host name to use instead of the default one. def self.create_connection_pool(pool_size, host = nil) |