Method: AddRpush::RenameRapnsToRpush.down

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

.downObject



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/generators/templates/add_rpush.rb', line 356

def self.down
  update_type(RenameRapnsToRpush::Rpush::Notification, 'Rpush::Apns::Notification', 'Rapns::Apns::Notification')
  update_type(RenameRapnsToRpush::Rpush::Notification, 'Rpush::Gcm::Notification', 'Rapns::Gcm::Notification')
  update_type(RenameRapnsToRpush::Rpush::Notification, 'Rpush::Adm::Notification', 'Rapns::Adm::Notification')
  update_type(RenameRapnsToRpush::Rpush::Notification, 'Rpush::Wpns::Notification', 'Rapns::Wpns::Notification')

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

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

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

  rename_table :rpush_notifications, :rapns_notifications
  rename_table :rpush_apps, :rapns_apps
  rename_table :rpush_feedback, :rapns_feedback
end