Set Web hook schema defaults to intended default values
Somehow older GitLab database schemas may not have the right default values for the Web hook event types. We ran into this on GitLab.com years ago but thought it was localized to our instance. Some other customers have reported similar issues. We now set the default values to the schema to ensure consistency.
Relates to #30627 (closed), #326187
Migrate log
== 20210420012444 ChangeWebHookEventsDefault: migrating =======================
-- change_column_default(:web_hooks, :push_events, true)
-> 0.0043s
-- change_column_default(:web_hooks, :issues_events, false)
-> 0.0023s
-- change_column_default(:web_hooks, :merge_requests_events, false)
-> 0.0025s
-- change_column_default(:web_hooks, :tag_push_events, false)
-> 0.0026s
== 20210420012444 ChangeWebHookEventsDefault: migrated (0.0118s) ==============
Raw SQL
2021-04-20_22:27:31.18795 postgresql : 2021-04-20 15:27:31.187 PDT [9351] LOG: statement: ALTER TABLE "web_hooks" ALTER COLUMN "push_events" SET DEFAULT TRUE /*application:test*/
2021-04-20_22:27:31.19312 postgresql : 2021-04-20 15:27:31.193 PDT [9351] LOG: statement: ALTER TABLE "web_hooks" ALTER COLUMN "issues_events" SET DEFAULT FALSE /*application:test*/
2021-04-20_22:27:31.19756 postgresql : 2021-04-20 15:27:31.197 PDT [9351] LOG: statement: ALTER TABLE "web_hooks" ALTER COLUMN "merge_requests_events" SET DEFAULT FALSE /*application:test*/
2021-04-20_22:27:31.20178 postgresql : 2021-04-20 15:27:31.201 PDT [9351] LOG: statement: ALTER TABLE "web_hooks" ALTER COLUMN "tag_push_events" SET DEFAULT FALSE /*application:test*/
Database Lab
This is an essentially a NOP on GitLab.com:
exec ALTER TABLE "web_hooks" ALTER COLUMN "push_events" SET DEFAULT TRUE;
Session: 3578
The query has been executed. Duration: 0.096 s
exec ALTER TABLE "web_hooks" ALTER COLUMN "issues_events" SET DEFAULT FALSE ;
Session: 3578
The query has been executed. Duration: 0.000 s
Edited by Ben Bodenmiller