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
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 15:08:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-20 15:08:51 +0300
commit8c4198cbe631278e87fee04157d23494fbb80cdb (patch)
treed35cf498af480389796fd9e5cb4bcc903aea60f3 /db
parent1ac794623a8be5dee111716a44dd04ff708f3541 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200212014653_rename_security_dashboard_feature_flag_to_instance_security_dashboard.rb25
-rw-r--r--db/post_migrate/20200214034836_remove_security_dashboard_feature_flag.rb25
-rw-r--r--db/schema.rb2
3 files changed, 51 insertions, 1 deletions
diff --git a/db/migrate/20200212014653_rename_security_dashboard_feature_flag_to_instance_security_dashboard.rb b/db/migrate/20200212014653_rename_security_dashboard_feature_flag_to_instance_security_dashboard.rb
new file mode 100644
index 00000000000..8d37f6c1dd4
--- /dev/null
+++ b/db/migrate/20200212014653_rename_security_dashboard_feature_flag_to_instance_security_dashboard.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class RenameSecurityDashboardFeatureFlagToInstanceSecurityDashboard < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ class FeatureGate < ApplicationRecord
+ self.table_name = 'feature_gates'
+ end
+
+ def up
+ security_dashboard_feature = FeatureGate.find_by(feature_key: :security_dashboard, key: :boolean)
+
+ if security_dashboard_feature.present?
+ FeatureGate.safe_find_or_create_by!(
+ feature_key: :instance_security_dashboard,
+ key: :boolean,
+ value: security_dashboard_feature.value
+ )
+ end
+ end
+
+ def down
+ FeatureGate.find_by(feature_key: :instance_security_dashboard, key: :boolean)&.delete
+ end
+end
diff --git a/db/post_migrate/20200214034836_remove_security_dashboard_feature_flag.rb b/db/post_migrate/20200214034836_remove_security_dashboard_feature_flag.rb
new file mode 100644
index 00000000000..79723619533
--- /dev/null
+++ b/db/post_migrate/20200214034836_remove_security_dashboard_feature_flag.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class RemoveSecurityDashboardFeatureFlag < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ class FeatureGate < ApplicationRecord
+ self.table_name = 'feature_gates'
+ end
+
+ def up
+ FeatureGate.find_by(feature_key: :security_dashboard, key: :boolean)&.delete
+ end
+
+ def down
+ instance_security_dashboard_feature = FeatureGate.find_by(feature_key: :instance_security_dashboard, key: :boolean)
+
+ if instance_security_dashboard_feature.present?
+ FeatureGate.safe_find_or_create_by!(
+ feature_key: :security_dashboard,
+ key: instance_security_dashboard_feature.key,
+ value: instance_security_dashboard_feature.value
+ )
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 0796eea9bbe..8d95e0b4700 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: 2020_02_13_220211) do
+ActiveRecord::Schema.define(version: 2020_02_14_034836) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"