Class: EasyML::Generators::Migration::MigrationGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/easy_ml/railtie/generators/migration/migration_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object

Specify the next migration number



18
19
20
21
22
23
24
25
26
# File 'lib/easy_ml/railtie/generators/migration/migration_generator.rb', line 18

def self.next_migration_number(dirname)
  if ActiveRecord.version < Gem::Version.new("7")
    Time.now.utc.strftime("%Y%m%d%H%M%S")
  elsif ActiveRecord.timestamped_migrations
    Time.now.utc.strftime("%Y%m%d%H%M%S")
  else
    format("%.3d", (current_migration_number(dirname) + 1))
  end
end

Instance Method Details

#create_migration_filesObject

Generate the migration files using the templates



29
30
31
# File 'lib/easy_ml/railtie/generators/migration/migration_generator.rb', line 29

def create_migration_files
  create_easy_ml_models_migration
end