Class: CreateRapnsFeedback

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/templates/create_rapns_feedback.rb

Class Method Summary collapse

Class Method Details

.downObject


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/templates/create_rapns_feedback.rb', line 12

def self.down
  if ActiveRecord.version >= Gem::Version.new('5.1')
    if index_name_exists?(:rapns_feedback, :index_rapns_feedback_on_device_token)
      remove_index :rapns_feedback, name: :index_rapns_feedback_on_device_token
    end
  else
    if index_name_exists?(:rapns_feedback, :index_rapns_feedback_on_device_token, true)
      remove_index :rapns_feedback, name: :index_rapns_feedback_on_device_token
    end
  end

  drop_table :rapns_feedback
end

.upObject


2
3
4
5
6
7
8
9
10
# File 'lib/generators/templates/create_rapns_feedback.rb', line 2

def self.up
  create_table :rapns_feedback do |t|
    t.string    :device_token,          null: false, limit: 64
    t.timestamp :failed_at,             null: false
    t.timestamps
  end

  add_index :rapns_feedback, :device_token
end