class AddRpush

NOTE TO THE CURIOUS.

Congratulations on being a diligent developer and vetting the migrations added to your project!

You’re probably thinking “This migration is huge!”. It is, but that doesn’t mean it’ll take a long time to run, or that the reason for it being this size is because of lousy developers.

Rpush used to be known as Rapns. In an effort to reduce clutter in db/migrate for new users of Rpush, what you see below is a concatenation of the migrations added to Rapns over its lifetime.

The reason for concatenating old migrations - instead of producing a new one that attempts to recreate their accumulative state - is that I don’t want to introduce any bugs by writing a new migration.

So while this looks like a scary amount of code, it is in fact the safest approach. The constituent parts of this migration have been executed many times, by many people!

Public Class Methods

down() click to toggle source
# File lib/generators/templates/add_rpush.rb, line 34
def self.down
  migrations.reverse.each do |m|
    begin
      m.down
    rescue ActiveRecord::StatementInvalid => e
      p e
    end
  end
end
migrations() click to toggle source
# File lib/generators/templates/add_rpush.rb, line 23
def self.migrations
  [CreateRapnsNotifications, CreateRapnsFeedback,
   AddAlertIsJsonToRapnsNotifications, AddAppToRapns,
   CreateRapnsApps, AddGcm, AddWpns, AddAdm, RenameRapnsToRpush,
   AddFailAfterToRpushNotifications]
end
up() click to toggle source
# File lib/generators/templates/add_rpush.rb, line 30
def self.up
  migrations.map(&:up)
end