Add non-null constraint to notes table for noteable_type column
What does this MR do and why?
We've discovered some notes
records with NULL
noteable_type
!140488 (comment 1750493801). No such record should exist and there has been an application validation in place:
# https://gitlab.com/gitlab-org/gitlab/-/blob/27513d11416b387b632a34f6101494d07e527640/app/models/note.rb#L110
validates :noteable_type, presence: true
This MR adds a non-null constraint to the notes
table for the noteable_type
column. Because we need to remove the invalid records first, this MR introduces the constraint marked as INVALID
.
In addition, I am preparing to create a new index asynchronously to locate the invalid records for .com
(to be synchronously created in !143928 (merged).) The index will be used to backup and remove the invalid notes records later.
Edited by euko