Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a9401aed
Commit
a9401aed
authored
Apr 22, 2021
by
Stan Hu
Committed by
Mayra Cabrera
Apr 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set Web hook schema defaults to intended default values
parent
a4a77904
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
0 deletions
+57
-0
changelogs/unreleased/sh-fix-webhook-defaults.yml
changelogs/unreleased/sh-fix-webhook-defaults.yml
+5
-0
db/migrate/20210420012444_change_web_hook_events_default.rb
db/migrate/20210420012444_change_web_hook_events_default.rb
+15
-0
db/schema_migrations/20210420012444
db/schema_migrations/20210420012444
+1
-0
spec/migrations/change_web_hook_events_default_spec.rb
spec/migrations/change_web_hook_events_default_spec.rb
+36
-0
No files found.
changelogs/unreleased/sh-fix-webhook-defaults.yml
0 → 100644
View file @
a9401aed
---
title
:
Set Web hook defaults to intended default values
merge_request
:
59814
author
:
type
:
fixed
db/migrate/20210420012444_change_web_hook_events_default.rb
0 → 100644
View file @
a9401aed
# frozen_string_literal: true
class
ChangeWebHookEventsDefault
<
ActiveRecord
::
Migration
[
6.0
]
def
up
change_column_default
:web_hooks
,
:push_events
,
true
change_column_default
:web_hooks
,
:issues_events
,
false
change_column_default
:web_hooks
,
:merge_requests_events
,
false
change_column_default
:web_hooks
,
:tag_push_events
,
false
end
# This is a NOP because this migration is supposed to restore the
# intended schema, not revert it.
def
down
end
end
db/schema_migrations/20210420012444
0 → 100644
View file @
a9401aed
f0bf8c79c1981ecd95c933f37ec5b0187ee6321792d96db26d863b192843c5ab
\ No newline at end of file
spec/migrations/change_web_hook_events_default_spec.rb
0 → 100644
View file @
a9401aed
# frozen_string_literal: true
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'migrate'
,
'20210420012444_change_web_hook_events_default.rb'
)
RSpec
.
describe
ChangeWebHookEventsDefault
do
let
(
:web_hooks
)
{
table
(
:web_hooks
)
}
let
(
:projects
)
{
table
(
:projects
)
}
let
(
:groups
)
{
table
(
:namespaces
)
}
let
(
:group
)
{
groups
.
create!
(
name:
'gitlab'
,
path:
'gitlab-org'
)
}
let
(
:project
)
{
projects
.
create!
(
name:
'gitlab'
,
path:
'gitlab'
,
namespace_id:
group
.
id
)
}
let
(
:hook
)
{
web_hooks
.
create!
(
project_id:
project
.
id
,
type:
'ProjectHook'
)
}
let
(
:group_hook
)
{
web_hooks
.
create!
(
group_id:
group
.
id
,
type:
'GroupHook'
)
}
before
do
# Simulate the wrong schema
%w(push_events issues_events merge_requests_events tag_push_events)
.
each
do
|
column
|
ActiveRecord
::
Base
.
connection
.
execute
"ALTER TABLE web_hooks ALTER COLUMN
#{
column
}
DROP DEFAULT"
end
end
it
'sets default values'
do
migrate!
expect
(
hook
.
push_events
).
to
be
true
expect
(
hook
.
issues_events
).
to
be
false
expect
(
hook
.
merge_requests_events
).
to
be
false
expect
(
hook
.
tag_push_events
).
to
be
false
expect
(
group_hook
.
push_events
).
to
be
true
expect
(
group_hook
.
issues_events
).
to
be
false
expect
(
group_hook
.
merge_requests_events
).
to
be
false
expect
(
group_hook
.
tag_push_events
).
to
be
false
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment