Class: CreateTags

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

Class Method Summary collapse

Class Method Details

.downObject



12
13
14
15
16
# File 'lib/generators/tkh_content/create_or_update_migrations/templates/create_tags.rb', line 12

def self.down
  drop_table :tags
  remove_index :tags, :name
  Tag.drop_translation_table!
end

.upObject



3
4
5
6
7
8
9
10
# File 'lib/generators/tkh_content/create_or_update_migrations/templates/create_tags.rb', line 3

def self.up
  create_table :tags do |t|
    t.string :name
    t.timestamps
  end
  add_index :tags, :name
  Tag.create_translation_table! :name => :string
end