Skip to content

Add notification settings for mwps

What does this MR do?

Add Notification settings #244840 (closed)

Migration Output

$ bin/rails dbconsole                                                                                                                                                                                           
psql (11.8)                                                                                                                                                                                                                                   
Type "help" for help.                                                                                                                                                                                                                         
                                                                                                                       
gitlabhq_development=# \d notification_settings                                                                        
                                              Table "public.notification_settings"   
         Column         |            Type             | Collation | Nullable |                      Default                       
------------------------+-----------------------------+-----------+----------+---------------------------------------------------
 id                     | integer                     |           | not null | nextval('notification_settings_id_seq'::regclass)
 user_id                | integer                     |           | not null |       
 source_id              | integer                     |           |          |       
[... some of this table cut for brevity ...]
 fixed_pipeline         | boolean                     |           |          |               
 moved_project          | boolean                     |           | not null | true
Indexes:
    "notification_settings_pkey" PRIMARY KEY, btree (id)
    "index_notifications_on_user_id_and_source_id_and_source_type" UNIQUE, btree (user_id, source_id, source_type)
    "index_notification_settings_on_source_id_and_source_type" btree (source_id, source_type)
    "index_notification_settings_on_user_id" btree (user_id)
Foreign-key constraints:
    "fk_0c95e91db7" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE

gitlabhq_development=# \q
$ bin/rails db:migrate
WARNING: sha_attribute :verification_checksum is invalid since the table doesn't exist - you may need to run database migrations
== 20200725093417 AddMergeWhenPipelineSucceedsToNotificationSettings: migrating 
-- add_column(:notification_settings, :merge_when_pipeline_succeeds, :boolean)
   -> 0.0036s
== 20200725093417 AddMergeWhenPipelineSucceedsToNotificationSettings: migrated (0.0036s) 

$ bin/rails dbconsole
psql (11.8)
Type "help" for help.

gitlabhq_development=# \d notification_settings                                                                         
                                                 Table "public.notification_settings"
            Column            |            Type             | Collation | Nullable |                      Default                       
------------------------------+-----------------------------+-----------+----------+---------------------------------------------------
 id                           | integer                     |           | not null | nextval('notification_settings_id_seq'::regclass)
 user_id                      | integer                     |           | not null | 
 source_id                    | integer                     |           |          | 
[... some of this table cut for brevity ...]
 fixed_pipeline               | boolean                     |           |          | 
 moved_project                | boolean                     |           | not null | true
 merge_when_pipeline_succeeds | boolean                     |           |          | 
Indexes:
    "notification_settings_pkey" PRIMARY KEY, btree (id)
    "index_notifications_on_user_id_and_source_id_and_source_type" UNIQUE, btree (user_id, source_id, source_type)
    "index_notification_settings_on_source_id_and_source_type" btree (source_id, source_type)
    "index_notification_settings_on_user_id" btree (user_id)
Foreign-key constraints:
    "fk_0c95e91db7" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE

gitlabhq_development=# \q
$ bin/rails db:migrate:down VERSION=20200725093417
WARNING: sha_attribute :verification_checksum is invalid since the table doesn't exist - you may need to run database migrations
== 20200725093417 AddMergeWhenPipelineSucceedsToNotificationSettings: reverting 
-- remove_column(:notification_settings, :merge_when_pipeline_succeeds, :boolean)
   -> 0.0025s
== 20200725093417 AddMergeWhenPipelineSucceedsToNotificationSettings: reverted (0.0055s) 

$ bin/rails dbconsole
psql (11.8)
Type "help" for help.

gitlabhq_development=# \d notification_settings                                                                         
                                              Table "public.notification_settings"
         Column         |            Type             | Collation | Nullable |                      Default                       
------------------------+-----------------------------+-----------+----------+---------------------------------------------------
 id                     | integer                     |           | not null | nextval('notification_settings_id_seq'::regclass)
 user_id                | integer                     |           | not null | 
 source_id              | integer                     |           |          | 
[... some of this table cut for brevity ...]
 fixed_pipeline         | boolean                     |           |          | 
 moved_project          | boolean                     |           | not null | true
Indexes:
    "notification_settings_pkey" PRIMARY KEY, btree (id)
    "index_notifications_on_user_id_and_source_id_and_source_type" UNIQUE, btree (user_id, source_id, source_type)
    "index_notification_settings_on_source_id_and_source_type" btree (source_id, source_type)
    "index_notification_settings_on_user_id" btree (user_id)
Foreign-key constraints:
    "fk_0c95e91db7" FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE

gitlabhq_development=# \q
$ 

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [NA] Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Ravishankar Gnanaprakasam

Merge request reports