Add issue_type to Issues
What does this MR do?
Adds issue_type
to Issues
as part of #229543 (closed) and the start of extensible issues (#222954 (comment 365817852)).
- Add index
- Validate types
- Set Project.issues to use where with default type
Add column SQL (https://gitlab.slack.com/archives/CLJMDRD8C/p1595390742078300):
exec ALTER TABLE "issues" ADD "issue_type" smallint DEFAULT 0;
The query has been executed. Duration: 121.000 ms
Add index SQL (https://gitlab.slack.com/archives/CLJMDRD8C/p1595390824079800):
exec CREATE INDEX index_issues_on_issue_type ON public.issues USING btree (issue_type);
The query has been executed. Duration: 11.156 min
Note that the index creation can take >10 minutes.
Migration up/down:
Column:
rake db:migrate:up VERSION=20200721034536
== 20200721034536 AddIssueTypeToIssues: migrating =============================
-- add_column(:issues, :issue_type, :integer, {:limit=>2, :default=>0})
-> 0.0018s
== 20200721034536 AddIssueTypeToIssues: migrated (0.0019s) ====================
rake db:migrate:down VERSION=20200721034536
== 20200721034536 AddIssueTypeToIssues: reverting =============================
-- remove_column(:issues, :issue_type, :integer, {:limit=>2, :default=>0})
-> 0.0014s
== 20200721034536 AddIssueTypeToIssues: reverted (0.0595s) ====================
Index:
rake db:migrate:up VERSION=20200721043502
== 20200721043502 AddIssueTypeIndexToIssues: migrating ========================
-- transaction_open?()
-> 0.0000s
-- index_exists?(:issues, :issue_type, {:algorithm=>:concurrently})
-> 0.0105s
-- add_index(:issues, :issue_type, {:algorithm=>:concurrently})
-> 0.0104s
== 20200721043502 AddIssueTypeIndexToIssues: migrated (0.0214s) ===============
rake db:migrate:down VERSION=20200721043502
== 20200721043502 AddIssueTypeIndexToIssues: reverting ========================
-- transaction_open?()
-> 0.0000s
-- index_exists?(:issues, :issue_type, {:algorithm=>:concurrently})
-> 0.0088s
-- remove_index(:issues, {:algorithm=>:concurrently, :column=>:issue_type})
-> 0.0082s
== 20200721043502 AddIssueTypeIndexToIssues: reverted (0.0174s) ===============
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Closes #222954 (closed)
Edited by Sean Arnold