Class: Rsodx::Cli::Commands::Generators::Migration
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- Rsodx::Cli::Commands::Generators::Migration
- Defined in:
- lib/rsodx/cli/commands/generators/migration.rb
Instance Method Summary collapse
Instance Method Details
#call(name:) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rsodx/cli/commands/generators/migration.rb', line 13 def call(name:) = Time.now.utc.strftime("%Y%m%d%H%M%S") file_name = File.join("db/migrations", "#{}_#{snake_case(name)}.rb") puts "📦 Creating migration: #{file_name}" FileUtils.mkdir_p("db/migrations") File.write(file_name, MIGRATION_TEMPLATE) puts "✅ Done" rescue => e abort "❌ Failed to generate migration: #{e.}" end |