Class: IfreeSmsCreateMessages

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

Class Method Summary collapse

Class Method Details

.downObject



27
28
29
# File 'lib/generators/ifree_sms/templates/migrate/create_messages.rb', line 27

def self.down
  drop_table :ifree_sms_messages
end

.upObject



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/generators/ifree_sms/templates/migrate/create_messages.rb', line 2

def self.up
  create_table :ifree_sms_messages do |t|
    # Messageable
    t.string  :messageable_type, :limit => 40
    t.integer :messageable_id
    
    # Sms info
    t.integer  :sms_id
    t.integer  :phone, :limit => 8
    t.integer  :service_number
    t.string   :sms_text
    t.datetime :now
    
    t.integer :status_id, :limit => 1, :default => 1
  
    t.timestamps
  end

  add_index :ifree_sms_messages, [:messageable_type, :messageable_id]
  add_index :ifree_sms_messages, :sms_id
  add_index :ifree_sms_messages, :phone
  add_index :ifree_sms_messages, :service_number
  add_index :ifree_sms_messages, :status_id
end