summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid H. Wilkins <dwilkins@conecuh.com>2019-08-04 12:33:37 -0500
committerDavid H. Wilkins <dwilkins@conecuh.com>2019-08-04 12:33:37 -0500
commitafb3c3c1fbfd6252bc00ed030015476013b170dd (patch)
treeb0b74da46407f0fcc15bb10974baad7213187f1b
parentbce8b66d516e906f6131d8a6dcae797def5288b6 (diff)
downloadgitlab-ce-afb3c3c1fbfd6252bc00ed030015476013b170dd.tar.gz
Add missing timezone to legacy artifacts (ci_builds)
- ci_builds.artifacts_expire_at are copied to ci_job_artifacts.expire_at with incorrect timestamps when the database timezone is NOT utc - ci_builds.artifacts_expire_at is `timestamp without time zone` and ci_job_artifacts.expire_at is `timestamp with time zone` on postgresql - Tests fail locally for `rspec ./spec/lib/gitlab/import_export/import_export_spec.rb` without this change
-rw-r--r--lib/gitlab/background_migration/migrate_legacy_artifacts.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/gitlab/background_migration/migrate_legacy_artifacts.rb b/lib/gitlab/background_migration/migrate_legacy_artifacts.rb
index 5cd638083b0..4377ec2987c 100644
--- a/lib/gitlab/background_migration/migrate_legacy_artifacts.rb
+++ b/lib/gitlab/background_migration/migrate_legacy_artifacts.rb
@@ -39,10 +39,10 @@ module Gitlab
SELECT
project_id,
id,
- artifacts_expire_at,
+ artifacts_expire_at #{add_missing_db_timezone},
#{LEGACY_PATH_FILE_LOCATION},
- created_at,
- created_at,
+ created_at #{add_missing_db_timezone},
+ created_at #{add_missing_db_timezone},
artifacts_file,
artifacts_size,
COALESCE(artifacts_file_store, #{FILE_LOCAL_STORE}),
@@ -81,10 +81,10 @@ module Gitlab
SELECT
project_id,
id,
- artifacts_expire_at,
+ artifacts_expire_at #{add_missing_db_timezone},
#{LEGACY_PATH_FILE_LOCATION},
- created_at,
- created_at,
+ created_at #{add_missing_db_timezone},
+ created_at #{add_missing_db_timezone},
artifacts_metadata,
NULL,
COALESCE(artifacts_metadata_store, #{FILE_LOCAL_STORE}),
@@ -121,6 +121,12 @@ module Gitlab
AND artifacts_file <> ''
SQL
end
+
+ def add_missing_db_timezone
+ return '' unless Gitlab::Database.postgresql?
+
+ 'at time zone \'UTC\''
+ end
end
end
end