Class: AddParole
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- AddParole
- Defined in:
- lib/generators/parole/templates/migration.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
16 17 18 |
# File 'lib/generators/parole/templates/migration.rb', line 16 def self.down drop_table :comments end |
.up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/generators/parole/templates/migration.rb', line 2 def self.up create_table :comments do |t| t.references :commentable, polymorphic: true t.references :commenter, polymorphic: true t.string :role t.text :comment t. end add_index :comments, [:commentable_type, :commentable_id, :role] add_index :comments, [:commentable_type, :commentable_id] end |