Class: CreateCourierTables

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

Class Method Summary collapse

Class Method Details

.downObject



33
34
35
# File 'lib/generators/templates/migration.rb', line 33

def self.down
  # drop_table :gritter_notices
end

.upObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/generators/templates/migration.rb', line 3

def self.up
  create_table :courier_owner_setting, :force => true do |t|
    t.integer  :owner_id,                           :null => false
    t.string   :owner_type,                         :null => false
    t.text     :settings,                           :null => false
    t.timestamps
  end

  add_index :courier_owner_setting, [:owner_id, :owner_type], :unique=>true

  # create_table :courier_templates, :force => true do |t|
  #   t.string   :key,                         :null => false, :unique=>true
  #   t.text     :settings,                    :null => false
  #   t.timestamps
  # end

  create_table :courier_messages, :force => true do |t|
    t.integer   :owner_id,                           :null => false
    t.string    :owner_type,                         :null => false
    t.string    :template,                           :null => false
    t.string    :service,                            :null => false
    t.string    :state,                              :null => false
    t.text      :options,                            :null => false
    t.timestamp :delivered_at
    t.timestamps
  end

  add_index :courier_messages, [:service, :state]
end