Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-07-25 21:43:52 +0300
committerMayra Cabrera <mcabrera@gitlab.com>2019-07-25 21:43:52 +0300
commit64f3324096e759b599682ef7ce5bdee75c9701b2 (patch)
treed365bc6bfb29c7a7bd209963c961c99c7a348606 /db/migrate/20190725012225_change_outbound_local_requests_whitelist_default.rb
parent2179c7cd4280f58d32c0cd601d4bab612f106c47 (diff)
Add default for outbound_local_requests_whitelist
It needs to default to an empty array logically.
Diffstat (limited to 'db/migrate/20190725012225_change_outbound_local_requests_whitelist_default.rb')
-rw-r--r--db/migrate/20190725012225_change_outbound_local_requests_whitelist_default.rb30
1 files changed, 30 insertions, 0 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