Class: CreateActivities
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateActivities
- Defined in:
- lib/generators/live_activity/migration/templates/migration.rb
Overview
Migration responsible for creating a table with activities
Class Method Summary collapse
-
.down ⇒ Object
Drop table.
-
.up ⇒ Object
Create table.
Class Method Details
.down ⇒ Object
Drop table
25 26 27 |
# File 'lib/generators/live_activity/migration/templates/migration.rb', line 25 def self.down drop_table :activities end |
.up ⇒ Object
Create table
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/generators/live_activity/migration/templates/migration.rb', line 4 def self.up create_table :activities do |t| t.belongs_to :actor, :polymorphic => true t.belongs_to :act_object, :polymorphic => true t.belongs_to :act_target, :polymorphic => true t.string :verb t.string :reverses t.string :description t.string :options t.string :bond_type t. end add_index :activities, [:verb] add_index :activities, [:actor_id, :actor_type] add_index :activities, [:act_object_id, :act_object_type] add_index :activities, [:act_target_id, :act_target_type] end |