diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-20 12:08:51 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-20 12:08:51 +0000 |
commit | 8c4198cbe631278e87fee04157d23494fbb80cdb (patch) | |
tree | d35cf498af480389796fd9e5cb4bcc903aea60f3 /db | |
parent | 1ac794623a8be5dee111716a44dd04ff708f3541 (diff) | |
download | gitlab-ce-8c4198cbe631278e87fee04157d23494fbb80cdb.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
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" |