Class: CreateSimpleSwitchTables

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

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/generators/templates/migration.rb', line 2

def change
  create_table :simple_switch_features do |t|
    t.string :name, null: false, index: true
    t.string :description, limit: 500

    t.timestamps null: false
  end

  create_table :simple_switch_environments do |t|
    t.string :name, null: false, index: true

    t.timestamps null: false
  end

  create_table :simple_switch_states do |t|
    t.boolean :status,         default: false
    t.belongs_to :feature,     index: true
    t.belongs_to :environment, index: true

    t.timestamps null: false
  end
end