Fix imported project labels having a group_id
What does this MR do and why?
When a project is imported, we turn associated group labels into project labels. We need to clear the group_id because project labels must not have a group_id value.
Migration Output
main: == 20230217040544 AddTempIndexForInvalidProjectLabels: migrating ==============
main: -- transaction_open?()
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.2475s
main: -- index_exists?(:labels, :id, {:where=>"type = 'ProjectLabel' AND group_id IS NOT NULL", :name=>"tmp_idx_invalid_project_labels", :algorithm=>:concurrently})
main: -> 0.0185s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0004s
main: -- add_index(:labels, :id, {:where=>"type = 'ProjectLabel' AND group_id IS NOT NULL", :name=>"tmp_idx_invalid_project_labels", :algorithm=>:concurrently})
main: -> 0.0061s
main: -- execute("RESET statement_timeout")
main: -> 0.0008s
main: == 20230217040544 AddTempIndexForInvalidProjectLabels: migrated (0.3088s) =====
main: == 20230217054346 FixProjectLabelsWithGroupId: migrating ======================
main: -- transaction_open?()
main: -> 0.0000s
main: -- exec_query("SELECT COUNT(*) AS count FROM \"labels\" WHERE \"labels\".\"type\" = 'ProjectLabel' AND \"labels\".\"group_id\" IS NOT NULL")
main: -> 0.0024s
main: == 20230217054346 FixProjectLabelsWithGroupId: migrated (0.0098s) =============
main: == 20230217070812 RemoveTempIndexForInvalidProjectLabels: migrating ===========
main: -- transaction_open?()
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.0007s
main: -- indexes(:labels)
main: -> 0.0479s
main: -- remove_index(:labels, {:algorithm=>:concurrently, :name=>"tmp_idx_invalid_project_labels"})
main: -> 0.0027s
main: == 20230217070812 RemoveTempIndexForInvalidProjectLabels: migrated (0.0634s) ==
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #291034 (closed)
Edited by Heinrich Lee Yu