Class: ActiveRecord::Generators::UpgradeGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object


11
12
13
# File 'lib/generators/active_record/upgrade_generator.rb', line 11

def self.next_migration_number(path)
  ActiveRecord::Generators::Base.next_migration_number(path)
end

Instance Method Details

#copy_migrations_and_modelObject


15
16
17
18
19
20
# File 'lib/generators/active_record/upgrade_generator.rb', line 15

def copy_migrations_and_model
  if merit_actions_exists? && target_data_column_doesnt_exist?
    migration_template 'add_target_data_to_merit_actions.rb',
                       'db/migrate/add_target_data_to_merit_actions.rb'
  end
end

#migration_versionObject


22
23
24
# File 'lib/generators/active_record/upgrade_generator.rb', line 22

def migration_version
  "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
end