diff options
author | Stan Hu <stanhu@gmail.com> | 2018-02-02 18:14:53 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2018-02-14 23:15:52 +0300 |
commit | 0898e59cd07797acdfdb6924468a198b6971cfda (patch) | |
tree | 07beb7ae8db8267110b049327eba6618fba7e7e5 /db | |
parent | a5c8f3fe8b18521dfa3a6c606f993435da192ebd (diff) |
Merge branch '42696-gitlab-import-leaves-group_id-on-projectlabel' into 'master'
Resolve "GitLab import leaves `group_id` on ProjectLabel"
Closes #42696
See merge request gitlab-org/gitlab-ce!16877
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20180202111106_remove_project_labels_group_id.rb | 19 | ||||
-rw-r--r-- | db/schema.rb | 2 |
2 files changed, 20 insertions, 1 deletions
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 diff --git a/db/schema.rb b/db/schema.rb index b8a29d8c046..f0d94974f41 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: 20180113220114) do +ActiveRecord::Schema.define(version: 20180202111106) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" |