Method: AddRpush::RenameRapnsToRpush.up

Defined in:
lib/generators/templates/add_rpush.rb

.upObject



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/generators/templates/add_rpush.rb', line 320

def self.up
  rename_table :rapns_notifications, :rpush_notifications
  rename_table :rapns_apps, :rpush_apps
  rename_table :rapns_feedback, :rpush_feedback

  if ActiveRecord.version >= Gem::Version.new('5.1')
    if index_name_exists?(:rpush_notifications, :index_rapns_notifications_multi)
      rename_index :rpush_notifications, :index_rapns_notifications_multi, :index_rpush_notifications_multi
    end
  else
    if index_name_exists?(:rpush_notifications, :index_rapns_notifications_multi, true)
      rename_index :rpush_notifications, :index_rapns_notifications_multi, :index_rpush_notifications_multi
    end
  end

  if ActiveRecord.version >= Gem::Version.new('5.1')
    if index_name_exists?(:rpush_feedback, :index_rapns_feedback_on_device_token)
      rename_index :rpush_feedback, :index_rapns_feedback_on_device_token, :index_rpush_feedback_on_device_token
    end
  else
    if index_name_exists?(:rpush_feedback, :index_rapns_feedback_on_device_token, true)
      rename_index :rpush_feedback, :index_rapns_feedback_on_device_token, :index_rpush_feedback_on_device_token
    end
  end

  update_type(RenameRapnsToRpush::Rpush::Notification, 'Rapns::Apns::Notification', 'Rpush::Apns::Notification')
  update_type(RenameRapnsToRpush::Rpush::Notification, 'Rapns::Gcm::Notification', 'Rpush::Gcm::Notification')
  update_type(RenameRapnsToRpush::Rpush::Notification, 'Rapns::Adm::Notification', 'Rpush::Adm::Notification')
  update_type(RenameRapnsToRpush::Rpush::Notification, 'Rapns::Wpns::Notification', 'Rpush::Wpns::Notification')

  update_type(RenameRapnsToRpush::Rpush::App, 'Rapns::Apns::App', 'Rpush::Apns::App')
  update_type(RenameRapnsToRpush::Rpush::App, 'Rapns::Gcm::App', 'Rpush::Gcm::App')
  update_type(RenameRapnsToRpush::Rpush::App, 'Rapns::Adm::App', 'Rpush::Adm::App')
  update_type(RenameRapnsToRpush::Rpush::App, 'Rapns::Wpns::App', 'Rpush::Wpns::App')
end