Class: DynamicLinks::Generators::AddKgsMigrationGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/dynamic_links/add_kgs_migration_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_migration_fileObject



6
7
8
9
10
11
12
# File 'lib/generators/dynamic_links/add_kgs_migration_generator.rb', line 6

def create_migration_file
  timestamp = Time.now.utc.strftime("%Y%m%d%H%M%S")
  migration_filename = "#{timestamp}_add_available_to_shortened_urls.rb"
  migration_template = File.read(File.join(self.class.source_root, "migration_template.rb"))

  create_file "db/migrate/#{migration_filename}", migration_template
end