Add gem flipper-active_record to store flipper data

- Creates the migration for flipper: `flipper_features` and `flipper_gates`
This commit is contained in:
Jean-Baptiste Bellet
2021-04-01 11:18:20 +02:00
parent 7cf96d1484
commit ad71f925be
4 changed files with 50 additions and 7 deletions

View File

@@ -114,6 +114,7 @@ gem 'ofn-qz', github: 'openfoodfoundation/ofn-qz', branch: 'ofn-rails-4'
gem 'good_migrations'
gem 'flipper'
gem 'flipper-active_record'
gem 'flipper-ui'
group :production, :staging do

View File

@@ -234,6 +234,9 @@ GEM
figaro (1.2.0)
thor (>= 0.14.0, < 2)
flipper (0.20.4)
flipper-active_record (0.20.4)
activerecord (>= 5.0, < 7)
flipper (~> 0.20.4)
flipper-ui (0.20.4)
erubi (>= 1.0.0, < 2.0.0)
flipper (~> 0.20.4)
@@ -649,6 +652,7 @@ DEPENDENCIES
ffaker
figaro
flipper
flipper-active_record
flipper-ui
fog-aws (>= 0.6.0)
foundation-icons-sass-rails

View File

@@ -0,0 +1,22 @@
class CreateFlipperTables < ActiveRecord::Migration[5.0]
def self.up
create_table :flipper_features do |t|
t.string :key, null: false
t.timestamps null: false
end
add_index :flipper_features, :key, unique: true
create_table :flipper_gates do |t|
t.string :feature_key, null: false
t.string :key, null: false
t.string :value
t.timestamps null: false
end
add_index :flipper_gates, [:feature_key, :key, :value], unique: true
end
def self.down
drop_table :flipper_gates
drop_table :flipper_features
end
end

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20210407170804) do
ActiveRecord::Schema.define(version: 20210326094519) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -250,6 +250,22 @@ ActiveRecord::Schema.define(version: 20210407170804) do
t.index ["sender_id"], name: "index_exchanges_on_sender_id", using: :btree
end
create_table "flipper_features", force: :cascade do |t|
t.string "key", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["key"], name: "index_flipper_features_on_key", unique: true, using: :btree
end
create_table "flipper_gates", force: :cascade do |t|
t.string "feature_key", null: false
t.string "key", null: false
t.string "value"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["feature_key", "key", "value"], name: "index_flipper_gates_on_feature_key_and_key_and_value", unique: true, using: :btree
end
create_table "inventory_items", force: :cascade do |t|
t.integer "enterprise_id", null: false
t.integer "variant_id", null: false
@@ -769,15 +785,15 @@ ActiveRecord::Schema.define(version: 20210407170804) do
end
create_table "spree_shipments", force: :cascade do |t|
t.string "tracking", limit: 255
t.string "number", limit: 255
t.decimal "cost", precision: 10, scale: 2, default: "0.0", null: false
t.string "tracking", limit: 255
t.string "number", limit: 255
t.decimal "cost", precision: 10, scale: 2, default: "0.0", null: false
t.datetime "shipped_at"
t.integer "order_id"
t.integer "address_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "state", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "state", limit: 255
t.integer "stock_location_id"
t.decimal "included_tax_total", precision: 10, scale: 2, default: "0.0", null: false
t.decimal "additional_tax_total", precision: 10, scale: 2, default: "0.0", null: false