Skip to content

Add fields to AbuseReports to facilitate automations

Ethan Urie requested to merge eurie-add-more-fields-to-abuse-reports into master

What does this MR do and why?

Adds fields to the abuse_reports table to facilitate wider automation and uses.

See https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/222 for more details.

Screenshots or screen recordings

Migrate up

main: == 20230214212644 AddFieldsToAbuseReports: migrating ==========================
main: -- transaction_open?()
main:    -> 0.0000s
main: -- add_column(:abuse_reports, :resolved_by_id, :int, {:null=>true})
main:    -> 0.0104s
main: -- add_column(:abuse_reports, :assignee_id, :int, {:null=>true})
main:    -> 0.0019s
main: -- add_column(:abuse_reports, :updated_by_id, :int, {:null=>true})
main:    -> 0.0013s
main: -- add_column(:abuse_reports, :last_edited_by_id, :int, {:null=>true})
main:    -> 0.0006s
main: -- add_column(:abuse_reports, :last_edited_at, :datetime_with_timezone, {:null=>true})
main:    -> 0.0009s
main: -- add_column(:abuse_reports, :mitigation_steps, :text, {:null=>true})
main:    -> 0.0011s
main: -- add_column(:abuse_reports, :evidence, :jsonb, {:null=>true})
main:    -> 0.0027s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- execute("ALTER TABLE abuse_reports\nADD CONSTRAINT check_f3c0947a2d\nCHECK ( char_length(mitigation_steps) <= 1000 )\nNOT VALID;\n")
main:    -> 0.0011s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0003s
main: -- execute("ALTER TABLE abuse_reports VALIDATE CONSTRAINT check_f3c0947a2d;")
main:    -> 0.0010s
main: -- execute("RESET statement_timeout")
main:    -> 0.0003s
main: == 20230214212644 AddFieldsToAbuseReports: migrated (0.2025s) =================

Migrate down

main: == 20230214212644 AddFieldsToAbuseReports: reverting ==========================
main: -- change_table(:abuse_reports)
main:    -> 0.0085s
main: == 20230214212644 AddFieldsToAbuseReports: reverted (0.0122s) =================

How to set up and validate locally

N/A

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Ethan Urie

Merge request reports