summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorRoger Meier <r.meier@siemens.com>2019-04-30 22:06:08 +0200
committerRoger Meier <r.meier@siemens.com>2019-06-25 21:17:19 +0200
commit946ffc67b711b39512a789213779d2736fcc0049 (patch)
tree661cfd4c18767c9972ca7775e7c8e4d1f1586544 /db
parent76889a9956e76e300edc8993048c3cd5c3a24da0 (diff)
downloadgitlab-ce-946ffc67b711b39512a789213779d2736fcc0049.tar.gz
refactor: remove Sentry from application settings
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/remove_sentry_from_application_settings.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/db/post_migrate/remove_sentry_from_application_settings.rb b/db/post_migrate/remove_sentry_from_application_settings.rb
new file mode 100644
index 00000000000..c9fee63ad23
--- /dev/null
+++ b/db/post_migrate/remove_sentry_from_application_settings.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class RemoveSentryFromApplicationSettings < ActiveRecord::Migration[5.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ SENTRY_ENABLED_COLUMNS = [
+ :sentry_enabled,
+ :clientside_sentry_enabled
+ ].freeze
+
+ SENTRY_DSN_COLUMNS = [
+ :sentry_dsn,
+ :clientside_sentry_dsn
+ ].freeze
+
+ def up
+ (SENTRY_ENABLED_COLUMNS + SENTRY_DSN_COLUMNS).each do |column|
+ remove_column(:application_settings, column) if column_exists?(:application_settings, column)
+ end
+ end
+
+ def down
+ SENTRY_ENABLED_COLUMNS.each do |column|
+ add_column_with_default(:application_settings, column, :boolean, default: false, allow_null: false) unless column_exists?(:application_settings, column)
+ end
+
+ SENTRY_DSN_COLUMNS.each do |column|
+ add_column(:application_settings, column, :string) unless column_exists?(:application_settings, column)
+ end
+ end
+end