summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-07-25 18:43:52 +0000
committerMayra Cabrera <mcabrera@gitlab.com>2019-07-25 18:43:52 +0000
commit64f3324096e759b599682ef7ce5bdee75c9701b2 (patch)
treed365bc6bfb29c7a7bd209963c961c99c7a348606 /db
parent2179c7cd4280f58d32c0cd601d4bab612f106c47 (diff)
downloadgitlab-ce-64f3324096e759b599682ef7ce5bdee75c9701b2.tar.gz
Add default for outbound_local_requests_whitelist
It needs to default to an empty array logically.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20190725012225_change_outbound_local_requests_whitelist_default.rb30
-rw-r--r--db/schema.rb4
2 files changed, 32 insertions, 2 deletions
diff --git a/db/migrate/20190725012225_change_outbound_local_requests_whitelist_default.rb b/db/migrate/20190725012225_change_outbound_local_requests_whitelist_default.rb
new file mode 100644
index 00000000000..21b00e0b7d9
--- /dev/null
+++ b/db/migrate/20190725012225_change_outbound_local_requests_whitelist_default.rb
@@ -0,0 +1,30 @@
+# 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
diff --git a/db/schema.rb b/db/schema.rb
index 2ec8fcce8f8..dbfc5959d9d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -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"