Class: CreateFeatureTag

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/pin_flags/install/templates/create_feature_tag.rb

Instance Method Summary collapse

Instance Method Details

#downObject



13
14
15
16
17
18
# File 'lib/generators/pin_flags/install/templates/create_feature_tag.rb', line 13

def down
  if table_exists?(:pin_flags_feature_tags)
    remove_index :pin_flags_feature_tags, :name if index_exists?(:pin_flags_feature_tags, :name)
    drop_table :pin_flags_feature_tags
  end
end

#upObject



2
3
4
5
6
7
8
9
10
11
# File 'lib/generators/pin_flags/install/templates/create_feature_tag.rb', line 2

def up
  create_table :pin_flags_feature_tags do |t|
    t.string :name, null: false
    t.boolean :enabled, default: true, null: false

    t.timestamps
  end

  add_index :pin_flags_feature_tags, :name, unique: true
end