Class: AddRpush::CreateRapnsFeedback

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

Class Method Summary collapse

Class Method Details

.downObject


92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/generators/templates/add_rpush.rb', line 92

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


82
83
84
85
86
87
88
89
90
# File 'lib/generators/templates/add_rpush.rb', line 82

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