From b807a7d731f390bce7cbe165b78200f4a0acc073 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Fri, 2 Feb 2018 12:02:31 +0100 Subject: [PATCH] add migration --- ...02111106_remove_project_labels_group_id.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 db/post_migrate/20180202111106_remove_project_labels_group_id.rb diff --git a/db/post_migrate/20180202111106_remove_project_labels_group_id.rb b/db/post_migrate/20180202111106_remove_project_labels_group_id.rb new file mode 100644 index 00000000000..db7fd0d167d --- /dev/null +++ b/db/post_migrate/20180202111106_remove_project_labels_group_id.rb @@ -0,0 +1,19 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class RemoveProjectLabelsGroupId < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + update_column_in_batches(:labels, :group_id, nil) do |table, query| + query.where(table[:type].eq('ProjectLabel').and(table[:group_id].not_eq(nil))) + end + end + + def down + end +end