Skip to content

Draft: Add migration deleting AbuseReport records from notes

Kerri Miller requested to merge 444222-delete-abuse_report_notes-records into master

What does this MR do and why?

Adds migration deleting AbuseReport records from notes

AbuseReport records by design lack a value for their namespace_id field. This makes it impossible to shard the notes table by namespace. However, AbuseReports were only inserted into this table via code behind a feature flag, which was never default enabled, and there are no existing records of this type in the .com databases. groupanti-abuse team is confident that this data is nonexistent, but before we attempt to shard the notes table, we should take a beat and attempt to delete any records that MIGHT be in this state. Meanwhile, they will move ahead with a parallel effort to create a new abuse_reports_notes table to improve the data structure.

Database

Up

  be rails db:migrate:up:main VERSION=20240604205241
main: == [advisory_lock_connection] object_id: 125600, pg_backend_pid: 37953
main: == 20240604205241 DeleteAbuseReportRecordsFromNotes: migrating ================
main: == 20240604205241 DeleteAbuseReportRecordsFromNotes: migrated (0.0377s) =======

main: == [advisory_lock_connection] object_id: 125600, pg_backend_pid: 37953

Down

  be rails db:migrate:down:main VERSION=20240604205241
main: == [advisory_lock_connection] object_id: 125600, pg_backend_pid: 38166
main: == 20240604205241 DeleteAbuseReportRecordsFromNotes: reverting ================
main: == 20240604205241 DeleteAbuseReportRecordsFromNotes: reverted (0.0052s) =======

main: == [advisory_lock_connection] object_id: 125600, pg_backend_pid: 38166

Related to #444222

Edited by Kerri Miller

Merge request reports