Class: CreateBookmarksTable

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

Class Method Summary collapse

Class Method Details

.downObject



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

def self.down
  drop_table :bookmarks
end

.upObject



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

def self.up
  create_table :bookmarks do |t|
    t.references :bookmarkable, :polymorphic => true
    t.references :bookmark_maker, :polymorphic => true
    t.text :description
    t.timestamps
  end

  add_index :bookmarks, :bookmarkable_type
  add_index :bookmarks, :bookmarkable_id

  add_index :bookmarks, :bookmark_maker_type
  add_index :bookmarks, :bookmark_maker_id

end