summaryrefslogtreecommitdiff
path: root/db/post_migrate/20170408033905_remove_old_cache_directories.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate/20170408033905_remove_old_cache_directories.rb')
-rw-r--r--db/post_migrate/20170408033905_remove_old_cache_directories.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/db/post_migrate/20170408033905_remove_old_cache_directories.rb b/db/post_migrate/20170408033905_remove_old_cache_directories.rb
new file mode 100644
index 00000000000..b23b52896b9
--- /dev/null
+++ b/db/post_migrate/20170408033905_remove_old_cache_directories.rb
@@ -0,0 +1,23 @@
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+# Remove all files from old custom carrierwave's cache directories.
+# See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9466
+
+class RemoveOldCacheDirectories < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ # FileUploader cache.
+ FileUtils.rm_rf(Dir[Rails.root.join('public', 'uploads', 'tmp', '*')])
+ end
+
+ def down
+ # Old cache is not supposed to be recoverable.
+ # So the down method is empty.
+ end
+end