Class: CreateFlipperTables

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/flipper/templates/migration.rb

Class Method Summary collapse

Class Method Details

.downObject



18
19
20
21
# File 'lib/generators/flipper/templates/migration.rb', line 18

def self.down
  drop_table :flipper_gates
  drop_table :flipper_features
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/generators/flipper/templates/migration.rb', line 2

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