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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
64f33240
Commit
64f33240
authored
Jul 25, 2019
by
Thong Kuah
Committed by
Mayra Cabrera
Jul 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add default for outbound_local_requests_whitelist
It needs to default to an empty array logically.
parent
2179c7cd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
2 deletions
+53
-2
db/migrate/20190725012225_change_outbound_local_requests_whitelist_default.rb
...12225_change_outbound_local_requests_whitelist_default.rb
+30
-0
db/schema.rb
db/schema.rb
+2
-2
spec/migrations/change_outbound_local_requests_whitelist_default_spec.rb
.../change_outbound_local_requests_whitelist_default_spec.rb
+21
-0
No files found.
db/migrate/20190725012225_change_outbound_local_requests_whitelist_default.rb
0 → 100644
View file @
64f33240
# frozen_string_literal: true
class
ChangeOutboundLocalRequestsWhitelistDefault
<
ActiveRecord
::
Migration
[
5.2
]
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
class
ApplicationSetting
<
ActiveRecord
::
Base
self
.
table_name
=
'application_settings'
end
def
up
default_value
=
[]
change_column_default
(
:application_settings
,
:outbound_local_requests_whitelist
,
default_value
)
ApplicationSetting
.
where
(
outbound_local_requests_whitelist:
nil
)
.
update
(
outbound_local_requests_whitelist:
default_value
)
change_column_null
(
:application_settings
,
:outbound_local_requests_whitelist
,
false
)
end
def
down
change_column_null
(
:application_settings
,
:outbound_local_requests_whitelist
,
true
)
change_column_default
(
:application_settings
,
:outbound_local_requests_whitelist
,
nil
)
end
end
db/schema.rb
View file @
64f33240
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2019_07_
15_142138
)
do
ActiveRecord
::
Schema
.
define
(
version:
2019_07_
25_012225
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"pg_trgm"
...
...
@@ -228,7 +228,7 @@ ActiveRecord::Schema.define(version: 2019_07_15_142138) do
t
.
boolean
"lock_memberships_to_ldap"
,
default:
false
,
null:
false
t
.
boolean
"time_tracking_limit_to_hours"
,
default:
false
,
null:
false
t
.
string
"grafana_url"
,
default:
"/-/grafana"
,
null:
false
t
.
string
"outbound_local_requests_whitelist"
,
limit:
255
,
array:
true
t
.
string
"outbound_local_requests_whitelist"
,
limit:
255
,
default:
[],
null:
false
,
array:
true
t
.
integer
"raw_blob_request_limit"
,
default:
300
,
null:
false
t
.
index
[
"custom_project_templates_group_id"
],
name:
"index_application_settings_on_custom_project_templates_group_id"
t
.
index
[
"file_template_project_id"
],
name:
"index_application_settings_on_file_template_project_id"
...
...
spec/migrations/change_outbound_local_requests_whitelist_default_spec.rb
0 → 100644
View file @
64f33240
# frozen_string_literal: true
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'migrate'
,
'20190725012225_change_outbound_local_requests_whitelist_default.rb'
)
describe
ChangeOutboundLocalRequestsWhitelistDefault
,
:migration
do
let
(
:application_settings
)
{
table
(
:application_settings
)
}
it
'defaults to empty array'
do
setting
=
application_settings
.
create!
setting_with_value
=
application_settings
.
create!
(
outbound_local_requests_whitelist:
'{a,b}'
)
expect
(
application_settings
.
where
(
outbound_local_requests_whitelist:
nil
).
count
).
to
eq
(
1
)
migrate!
expect
(
application_settings
.
where
(
outbound_local_requests_whitelist:
nil
).
count
).
to
eq
(
0
)
expect
(
setting
.
reload
.
outbound_local_requests_whitelist
).
to
eq
([])
expect
(
setting_with_value
.
reload
.
outbound_local_requests_whitelist
).
to
eq
(
%w[a b]
)
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