Class: CreateMessages

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/kitestrings/message_templates/message_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
# File 'lib/generators/kitestrings/message_templates/message_migration.rb', line 2

def change
  create_table :messages do |t|
    t.references :user
    t.string :template
    t.string :context_type
    t.integer :context_id
    t.string :link
    t.string :subject
    t.datetime :clicked_at
    t.datetime :sent_at
    t.text :options

    t.timestamps
  end

  add_index :messages, :user_id
  add_index :messages, [:context_type, :context_id]
end