Class: RpushMigrationGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/rpush_migration_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



5
6
7
8
9
10
# File 'lib/generators/rpush_migration_generator.rb', line 5

def self.next_migration_number(path)
  @time ||= Time.now.utc
  @calls ||= -1
  @calls += 1
  (@time + @calls.seconds).strftime("%Y%m%d%H%M%S")
end

Instance Method Details

#copy_migrationObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/generators/rpush_migration_generator.rb', line 12

def copy_migration
  if has_migration?('create_rapns_notifications')
    add_rpush_migration('create_rapns_feedback')
    add_rpush_migration('add_alert_is_json_to_rapns_notifications')
    add_rpush_migration('add_app_to_rapns')
    add_rpush_migration('create_rapns_apps')
    add_rpush_migration('add_gcm')
    add_rpush_migration('add_wpns')
    add_rpush_migration('add_adm')
    add_rpush_migration('rename_rapns_to_rpush')
    add_rpush_migration('add_fail_after_to_rpush_notifications')
  else
    add_rpush_migration('add_rpush')
  end

  add_rpush_migration('rpush_2_0_0_updates')
  add_rpush_migration('rpush_2_1_0_updates')
end