Class: CreateTaggings

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

Class Method Summary collapse

Class Method Details

.downObject



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

def self.down
  drop_table :taggings
  remove_index :taggings, :page_id
  remove_index :taggings, :tag_id
end

.upObject



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

def self.up
  create_table :taggings do |t|
    t.integer :page_id
    t.integer :tag_id
    t.timestamps
  end
  add_index :taggings, :page_id
  add_index :taggings, :tag_id
end