From 60576da88c2080e1529caff670cf0cb64c1bedcc Mon Sep 17 00:00:00 2001 From: Jason Goodman Date: Mon, 1 Jul 2019 18:44:16 +0000 Subject: Add Migration for Strategies Column on operations_feature_flag_scopes --- .../add-strategies-column-to-scopes-table.yml | 5 +++++ ..._add_strategies_to_operations_feature_flag_scopes.rb | 17 +++++++++++++++++ db/schema.rb | 3 ++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/add-strategies-column-to-scopes-table.yml create mode 100644 db/migrate/20190628145246_add_strategies_to_operations_feature_flag_scopes.rb diff --git a/changelogs/unreleased/add-strategies-column-to-scopes-table.yml b/changelogs/unreleased/add-strategies-column-to-scopes-table.yml new file mode 100644 index 00000000000..0bb87fca014 --- /dev/null +++ b/changelogs/unreleased/add-strategies-column-to-scopes-table.yml @@ -0,0 +1,5 @@ +--- +title: Add strategies column to operations_feature_flag_scopes table +merge_request: 29808 +author: +type: other diff --git a/db/migrate/20190628145246_add_strategies_to_operations_feature_flag_scopes.rb b/db/migrate/20190628145246_add_strategies_to_operations_feature_flag_scopes.rb new file mode 100644 index 00000000000..ed1f16ee69a --- /dev/null +++ b/db/migrate/20190628145246_add_strategies_to_operations_feature_flag_scopes.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddStrategiesToOperationsFeatureFlagScopes < ActiveRecord::Migration[5.1] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column_with_default :operations_feature_flag_scopes, :strategies, :jsonb, default: [{ name: "default", parameters: {} }] + end + + def down + remove_column(:operations_feature_flag_scopes, :strategies) + end +end diff --git a/db/schema.rb b/db/schema.rb index 50fee850f9f..8876be1cb34 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: 20190627051902) do +ActiveRecord::Schema.define(version: 20190628145246) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -2263,6 +2263,7 @@ ActiveRecord::Schema.define(version: 20190627051902) do t.datetime_with_timezone "updated_at", null: false t.boolean "active", null: false t.string "environment_scope", default: "*", null: false + t.jsonb "strategies", default: [{"name"=>"default", "parameters"=>{}}], null: false t.index ["feature_flag_id", "environment_scope"], name: "index_feature_flag_scopes_on_flag_id_and_environment_scope", unique: true, using: :btree end -- cgit v1.2.1