Skip to content

Create Issues::EmailParticipants::SentNotification model

What does this MR do and why?

This model stores information related to sent email notifications to emails for non-GitLab users that were added as participants It will be used to determine what participant wants to unsubscribe

Migration output

main: == 20230206201923 CreateIssueEmailParticipantSentNotifications: migrating =====
main: -- create_table(:issue_email_participant_sent_notifications)
main: -- quote_column_name(:reply_key)
main:    -> 0.0000s
main:    -> 0.0181s
main: == 20230206201923 CreateIssueEmailParticipantSentNotifications: migrated (0.0198s) 

main: == 20230206201943 AddFkToIssueEmailParticipantSentNotificationsOnNoteable: migrating 
main: -- transaction_open?()
main:    -> 0.0000s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- execute("ALTER TABLE issue_email_participant_sent_notifications\nADD CONSTRAINT fk_53b96e8e09\nFOREIGN KEY (noteable_id)\nREFERENCES issues (id)\n\nON DELETE CASCADE\nNOT VALID;\n")
main:    -> 0.0028s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0003s
main: -- execute("ALTER TABLE issue_email_participant_sent_notifications VALIDATE CONSTRAINT fk_53b96e8e09;")
main:    -> 0.0186s
main: -- execute("RESET statement_timeout")
main:    -> 0.0013s
main: == 20230206201943 AddFkToIssueEmailParticipantSentNotificationsOnNoteable: migrated (0.1034s) 

main: == 20230206202006 AddFkToIssueEmailParticipantSentNotificationsOnRecipient: migrating 
main: -- transaction_open?()
main:    -> 0.0000s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- execute("ALTER TABLE issue_email_participant_sent_notifications\nADD CONSTRAINT fk_75c4c853e1\nFOREIGN KEY (recipient_id)\nREFERENCES issue_email_participants (id)\n\nON DELETE CASCADE\nNOT VALID;\n")
main:    -> 0.0019s
main: -- execute("ALTER TABLE issue_email_participant_sent_notifications VALIDATE CONSTRAINT fk_75c4c853e1;")
main:    -> 0.0014s
main: == 20230206202006 AddFkToIssueEmailParticipantSentNotificationsOnRecipient: migrated (0.0150s) 

main: == 20230206202044 AddIndexIssueEmailParticipantSentNotificationOnRecipient: migrating 
main: -- transaction_open?()
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0013s
main: -- index_exists?(:issue_email_participant_sent_notifications, :recipient_id, {:name=>"idx_issue_email_participant_sent_notifications_on_recipient_id", :algorithm=>:concurrently})
main:    -> 0.0026s
main: -- add_index(:issue_email_participant_sent_notifications, :recipient_id, {:name=>"idx_issue_email_participant_sent_notifications_on_recipient_id", :algorithm=>:concurrently})
main:    -> 0.0013s
main: == 20230206202044 AddIndexIssueEmailParticipantSentNotificationOnRecipient: migrated (0.0179s) 

main: == 20230206202109 AddIndexIssueEmailParticipantSentNotificationOnNoteable: migrating 
main: -- transaction_open?()
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0009s
main: -- index_exists?(:issue_email_participant_sent_notifications, :noteable_id, {:name=>"idx_issue_email_participant_sent_notifications_on_noteable_id", :algorithm=>:concurrently})
main:    -> 0.0031s
main: -- add_index(:issue_email_participant_sent_notifications, :noteable_id, {:name=>"idx_issue_email_participant_sent_notifications_on_noteable_id", :algorithm=>:concurrently})
main:    -> 0.0018s
main: == 20230206202109 AddIndexIssueEmailParticipantSentNotificationOnNoteable: migrated (0.0139s) 

ci: == 20230206201923 CreateIssueEmailParticipantSentNotifications: migrating =====
ci: -- create_table(:issue_email_participant_sent_notifications)
ci: -- quote_column_name(:reply_key)
ci:    -> 0.0000s
ci:    -> 0.0197s
ci: == 20230206201923 CreateIssueEmailParticipantSentNotifications: migrated (0.0726s) 

ci: == 20230206201943 AddFkToIssueEmailParticipantSentNotificationsOnNoteable: migrating 
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- execute("ALTER TABLE issue_email_participant_sent_notifications\nADD CONSTRAINT fk_53b96e8e09\nFOREIGN KEY (noteable_id)\nREFERENCES issues (id)\n\nON DELETE CASCADE\nNOT VALID;\n")
ci:    -> 0.0030s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0004s
ci: -- execute("ALTER TABLE issue_email_participant_sent_notifications VALIDATE CONSTRAINT fk_53b96e8e09;")
ci:    -> 0.0104s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0008s
ci: == 20230206201943 AddFkToIssueEmailParticipantSentNotificationsOnNoteable: migrated (0.0392s) 

ci: == 20230206202006 AddFkToIssueEmailParticipantSentNotificationsOnRecipient: migrating 
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- execute("ALTER TABLE issue_email_participant_sent_notifications\nADD CONSTRAINT fk_75c4c853e1\nFOREIGN KEY (recipient_id)\nREFERENCES issue_email_participants (id)\n\nON DELETE CASCADE\nNOT VALID;\n")
ci:    -> 0.0017s
ci: -- execute("ALTER TABLE issue_email_participant_sent_notifications VALIDATE CONSTRAINT fk_75c4c853e1;")
ci:    -> 0.0016s
ci: == 20230206202006 AddFkToIssueEmailParticipantSentNotificationsOnRecipient: migrated (0.0248s) 

ci: == 20230206202044 AddIndexIssueEmailParticipantSentNotificationOnRecipient: migrating 
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0011s
ci: -- index_exists?(:issue_email_participant_sent_notifications, :recipient_id, {:name=>"idx_issue_email_participant_sent_notifications_on_recipient_id", :algorithm=>:concurrently})
ci:    -> 0.0036s
ci: -- add_index(:issue_email_participant_sent_notifications, :recipient_id, {:name=>"idx_issue_email_participant_sent_notifications_on_recipient_id", :algorithm=>:concurrently})
ci:    -> 0.0015s
ci: == 20230206202044 AddIndexIssueEmailParticipantSentNotificationOnRecipient: migrated (0.0222s) 

ci: == 20230206202109 AddIndexIssueEmailParticipantSentNotificationOnNoteable: migrating 
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0010s
ci: -- index_exists?(:issue_email_participant_sent_notifications, :noteable_id, {:name=>"idx_issue_email_participant_sent_notifications_on_noteable_id", :algorithm=>:concurrently})
ci:    -> 0.0041s
ci: -- add_index(:issue_email_participant_sent_notifications, :noteable_id, {:name=>"idx_issue_email_participant_sent_notifications_on_noteable_id", :algorithm=>:concurrently})
ci:    -> 0.0017s
ci: == 20230206202109 AddIndexIssueEmailParticipantSentNotificationOnNoteable: migrated (0.0222s) 

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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

Related to #383160 (closed)

Edited by Mykhailo Maisdanskyi

Merge request reports