Class: CreateMessages

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/templates/20120104151700_create_messages.rb

Class Method Summary collapse

Class Method Details

.downObject



18
19
20
# File 'lib/generators/templates/20120104151700_create_messages.rb', line 18

def self.down
  drop_table :messages
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/generators/templates/20120104151700_create_messages.rb', line 2

def self.up
  create_table :messages do |t|
    t.string :message_content
    t.string :state
    t.integer :processing_attempt_count, :default => 0
    t.datetime :processing_started_at
    t.datetime :completed_at
    t.integer :failure_count, :default => 0
    t.datetime :failed_at
    t.text :last_exception
    t.timestamps
  end

  add_index :messages, [:state, :failed_at]
end