diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-08-07 21:01:45 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-08-11 19:17:45 +0300 |
commit | 2ea8442ff3398a788b1005a825c1d13f61f91c2d (patch) | |
tree | 56ac4b29d6a81519aa68b2614ba208b757baf3f9 /db | |
parent | 180de2d20127f79773bf661f88cd7556b191d0b9 (diff) |
Move the personal snippet uploads from `system` to `-/system`
Update the markdown unconditionally since the move might have been
done before, but the markdown not updated.
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20170807190736_move_personal_snippet_files_into_correct_folder.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/db/post_migrate/20170807190736_move_personal_snippet_files_into_correct_folder.rb b/db/post_migrate/20170807190736_move_personal_snippet_files_into_correct_folder.rb new file mode 100644 index 00000000000..e3d2446b897 --- /dev/null +++ b/db/post_migrate/20170807190736_move_personal_snippet_files_into_correct_folder.rb @@ -0,0 +1,29 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class MovePersonalSnippetFilesIntoCorrectFolder < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + disable_ddl_transaction! + + DOWNTIME = false + NEW_DIRECTORY = File.join('/uploads', '-', 'system', 'personal_snippet') + OLD_DIRECTORY = File.join('/uploads', 'system', 'personal_snippet') + + def up + return unless file_storage? + + BackgroundMigrationWorker.perform_async('MovePersonalSnippetFiles', + [OLD_DIRECTORY, NEW_DIRECTORY]) + end + + def down + return unless file_storage? + + BackgroundMigrationWorker.perform_async('MovePersonalSnippetFiles', + [NEW_DIRECTORY, OLD_DIRECTORY]) + end + + def file_storage? + CarrierWave::Uploader::Base.storage == CarrierWave::Storage::File + end +end |