Class: AddRpush

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

Overview

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!

Defined Under Namespace

Classes: AddAdm, AddAlertIsJsonToRapnsNotifications, AddAppToRapns, AddFailAfterToRpushNotifications, AddGcm, AddWpns, CreateRapnsApps, CreateRapnsFeedback, CreateRapnsNotifications, RenameRapnsToRpush

Class Method Summary collapse

Class Method Details

.downObject


34
35
36
37
38
39
40
41
42
# 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

.migrationsObject


23
24
25
26
27
28
# File 'lib/generators/templates/add_rpush.rb', line 23

def self.migrations
  [CreateRapnsNotifications, CreateRapnsFeedback,
   AddAlertIsJsonToRapnsNotifications, AddAppToRapns,
   CreateRapnsApps, AddGcm, AddWpns, AddAdm, RenameRapnsToRpush,
   AddFailAfterToRpushNotifications]
end

.upObject


30
31
32
# File 'lib/generators/templates/add_rpush.rb', line 30

def self.up
  migrations.map(&:up)
end