From c156030ef965bed019def3993ee21d214fe2f2ba Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Mon, 17 Jul 2017 15:23:59 +0200 Subject: Add a background migration to rename `uploads` in the uploads table --- ...9_enqueue_migrate_system_uploads_to_new_folder.rb | 20 ++++++++++++++++++++ db/schema.rb | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 db/post_migrate/20170717150329_enqueue_migrate_system_uploads_to_new_folder.rb (limited to 'db') diff --git a/db/post_migrate/20170717150329_enqueue_migrate_system_uploads_to_new_folder.rb b/db/post_migrate/20170717150329_enqueue_migrate_system_uploads_to_new_folder.rb new file mode 100644 index 00000000000..87069dce006 --- /dev/null +++ b/db/post_migrate/20170717150329_enqueue_migrate_system_uploads_to_new_folder.rb @@ -0,0 +1,20 @@ +class EnqueueMigrateSystemUploadsToNewFolder < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + OLD_FOLDER = 'uploads/system/' + NEW_FOLDER = 'uploads/-/system/' + + disable_ddl_transaction! + + def up + BackgroundMigrationWorker.perform_async('MigrateSystemUploadsToNewFolder', + [OLD_FOLDER, NEW_FOLDER]) + end + + def down + BackgroundMigrationWorker.perform_async('MigrateSystemUploadsToNewFolder', + [NEW_FOLDER, OLD_FOLDER]) + end +end diff --git a/db/schema.rb b/db/schema.rb index 0195d73db39..284b2068166 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170717111152) do +ActiveRecord::Schema.define(version: 20170717150329) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" -- cgit v1.2.1