summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2017-11-15 02:36:25 -0800
committerMichael Kozono <mkozono@gmail.com>2017-12-01 15:26:41 -0800
commitdd8680a7ae4be279ae1d90f0889317a1e6ee0d95 (patch)
treea97ee3dbfe656c3799cfe295e3f585b45d182a72 /db
parentd530085685105e2d7cd6d87ba866756683f0488d (diff)
downloadgitlab-ce-dd8680a7ae4be279ae1d90f0889317a1e6ee0d95.tar.gz
Drop temporary tracking table when finished
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20171103140253_track_untracked_uploads.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/db/post_migrate/20171103140253_track_untracked_uploads.rb b/db/post_migrate/20171103140253_track_untracked_uploads.rb
index 09ff21b103f..7a34abc85ee 100644
--- a/db/post_migrate/20171103140253_track_untracked_uploads.rb
+++ b/db/post_migrate/20171103140253_track_untracked_uploads.rb
@@ -10,6 +10,18 @@ class TrackUntrackedUploads < ActiveRecord::Migration
MIGRATION = 'PrepareUntrackedUploads'
def up
+ ensure_temporary_tracking_table_exists
+
+ BackgroundMigrationWorker.perform_async(MIGRATION)
+ end
+
+ def down
+ if table_exists?(:untracked_files_for_uploads)
+ drop_table :untracked_files_for_uploads
+ end
+ end
+
+ def ensure_temporary_tracking_table_exists
unless table_exists?(:untracked_files_for_uploads)
create_table :untracked_files_for_uploads do |t|
t.string :path, limit: 600, null: false
@@ -25,13 +37,5 @@ class TrackUntrackedUploads < ActiveRecord::Migration
unless index_exists?(:untracked_files_for_uploads, :tracked)
add_index :untracked_files_for_uploads, :tracked
end
-
- BackgroundMigrationWorker.perform_async(MIGRATION)
- end
-
- def down
- if table_exists?(:untracked_files_for_uploads)
- drop_table :untracked_files_for_uploads
- end
end
end