Sets up our back end to be able to accommodate a new UI that will allow users to validate labels' severity and tags! I'm merging the back end portion now because it includes some changes to the database that will make it easier to write some back end queries, and I have some other tasks I need to do soon that would benefit from these changes!
Changes to the database include:
Adding a new label_history table to keep track of changes to the severity and tags for a label over time.
Replacing the label_tag table with a tags column in the label table. The tags column is an array of strings (TEXT[] in SQL). This simplifies a lot of queries because it removes the need to left join the label_tag table and group by to get the list of tags. Updating the tags is slightly harder, but it is worth the tradeoff.
Adding a user_id column to the label table. This also simplifies a lot of queries. We often want to know something about the labels added by a given user, or grouped by a user. We no longer have to do a circuitous join with the audit_task or mission table to figure out who added each label.
Adds old_severity, new_severity, old_tags, and new_tags columns to the label_validation table, preparing to record the changes that users make through the new Validate UI.
Before/After screenshots (if applicable)
No visual changes!
Things to check before submitting the PR
[x] I've written a descriptive PR title.
[x] I've added/updated comments for large or confusing blocks of code.
[x] I've tested on mobile (only needed for validation page).
Partially addresses #2575 Partially addresses #2859
Sets up our back end to be able to accommodate a new UI that will allow users to validate labels' severity and tags! I'm merging the back end portion now because it includes some changes to the database that will make it easier to write some back end queries, and I have some other tasks I need to do soon that would benefit from these changes!
Changes to the database include:
label_history
table to keep track of changes to the severity and tags for a label over time.label_tag
table with atags
column in thelabel
table. Thetags
column is an array of strings (TEXT[]
in SQL). This simplifies a lot of queries because it removes the need to left join thelabel_tag
table and group by to get the list of tags. Updating the tags is slightly harder, but it is worth the tradeoff.user_id
column to thelabel
table. This also simplifies a lot of queries. We often want to know something about the labels added by a given user, or grouped by a user. We no longer have to do a circuitous join with theaudit_task
ormission
table to figure out who added each label.old_severity
,new_severity
,old_tags
, andnew_tags
columns to thelabel_validation
table, preparing to record the changes that users make through the new Validate UI.Before/After screenshots (if applicable)
No visual changes!
Things to check before submitting the PR