Class: RailsPushNotifications::Generators::MigrationsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/rails-push-notifications/migrations_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



22
23
24
25
26
# File 'lib/generators/rails-push-notifications/migrations_generator.rb', line 22

def self.next_migration_number(path)
  @count ||= 0
  @count += 1
  (Time.now.utc.strftime("%Y%m%d%H%M%S").to_i + @count).to_s
end

Instance Method Details

#create_migrationsObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/generators/rails-push-notifications/migrations_generator.rb', line 11

def create_migrations
  templates = [
    'create_rails_push_notifications_apps',
    'create_rails_push_notifications_notifications'
  ]

  templates.each do |file|
    migration_template("#{file}.rb", "db/migrate/#{file}.rb")
  end
end