Class: CreateBookmarksTable
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateBookmarksTable
- Defined in:
- lib/generators/bookmarker/templates/migration.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
18 19 20 |
# File 'lib/generators/bookmarker/templates/migration.rb', line 18 def self.down drop_table :bookmarks end |
.up ⇒ Object
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. end add_index :bookmarks, :bookmarkable_type add_index :bookmarks, :bookmarkable_id add_index :bookmarks, :bookmark_maker_type add_index :bookmarks, :bookmark_maker_id end |