diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-11-22 10:23:24 -0800 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-12-01 15:26:41 -0800 |
commit | a9155a94fe29aa67230f2e5ef3d6393345677ce0 (patch) | |
tree | 6a07cc0685303b30875900b9e06673947a698b55 /lib | |
parent | 8def25d9f163cc22f71716d8a22fc5adfe0a762e (diff) | |
download | gitlab-ce-a9155a94fe29aa67230f2e5ef3d6393345677ce0.tar.gz |
Refactor
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/background_migration/prepare_untracked_uploads.rb | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/gitlab/background_migration/prepare_untracked_uploads.rb b/lib/gitlab/background_migration/prepare_untracked_uploads.rb index f5a11658c0b..8333a6218de 100644 --- a/lib/gitlab/background_migration/prepare_untracked_uploads.rb +++ b/lib/gitlab/background_migration/prepare_untracked_uploads.rb @@ -44,16 +44,10 @@ module Gitlab t.string :path, limit: 600, null: false t.boolean :tracked, default: false, null: false t.timestamps_with_timezone null: false + t.index :path, unique: true + t.index :tracked end end - - unless UntrackedFile.connection.index_exists?(:untracked_files_for_uploads, :path) - UntrackedFile.connection.add_index :untracked_files_for_uploads, :path, unique: true - end - - unless UntrackedFile.connection.index_exists?(:untracked_files_for_uploads, :tracked) - UntrackedFile.connection.add_index :untracked_files_for_uploads, :tracked - end end def clear_untracked_file_paths @@ -140,8 +134,7 @@ module Gitlab end def postgresql_pre_9_5? - @postgresql_pre_9_5 ||= postgresql? && - ActiveRecord::Base.connection.select_value('SHOW server_version_num').to_i < 90500 + @postgresql_pre_9_5 ||= postgresql? && Gitlab::Database.version.to_f < 9.5 end def schedule_populate_untracked_uploads_jobs |