Module: Card::FileCardCreator::AbstractFileCard::MigrationFile

Included in:
Card::FileCardCreator::AbstractFileCard
Defined in:
lib/card/tasks/card/file_card_creator/abstract_file_card/migration_file.rb

Overview

Module that provides #create_migration_file method for classes that inherit from AbstractFileCard. It uses the decko generator to create the migration.

Instance Method Summary collapse

Instance Method Details

#create_migration_fileObject



8
9
10
11
12
13
14
15
# File 'lib/card/tasks/card/file_card_creator/abstract_file_card/migration_file.rb', line 8

def create_migration_file
  puts "creating migration file...".yellow
  migration_out = `#{migrate_command}`
  return if migration_out.include?("conflict")

  migration_file_name = migration_out[/db.*/]
  write_at migration_file_name, 5, indented_migration_content # 5 is line no.
end