Class: ChalkDustCreateTables

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

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/chalk_dust/rails/generators/templates/migration.rb', line 2

def change
  create_table :connections, :force => true do |t|
    t.integer :subscriber_id
    t.string  :subscriber_type
    t.integer :publisher_id
    t.string  :publisher_type
    t.timestamps
  end

  add_index :connections, [:publisher_id, :publisher_type]

  create_table :activity_items, :force => true do |t|
    t.integer :performer_id
    t.string  :performer_type
    t.string  :event
    t.integer :target_id
    t.string  :target_type
    t.integer :owner_id
    t.string  :owner_type
    t.timestamps
  end

  add_index :activity_items, [:owner_id, :owner_type, :created_at]
end