Class: ActiveColumn::Generators::MigrationGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/active_column/generators/migration_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



10
11
12
# File 'lib/active_column/generators/migration_generator.rb', line 10

def self.banner
  "rails g active_column:migration NAME"
end

.desc(description = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/active_column/generators/migration_generator.rb', line 14

def self.desc(description = nil)
<<EOF
Description:
  Create an empty Cassandra migration file in 'ks/migrate'.  Very similar to Rails database migrations.

Example:
  `rails g active_column:migration CreateFooColumnFamily`
EOF
end

Instance Method Details

#createObject



24
25
26
27
# File 'lib/active_column/generators/migration_generator.rb', line 24

def create
  timestamp = Time.now.utc.strftime("%Y%m%d%H%M%S")
  template 'migration.rb.erb', "ks/migrate/#{timestamp}_#{file_name.underscore}.rb"
end