Class: DatabaseConsistency::Writers::Autofix::MigrationBase

Inherits:
Base
  • Object
show all
Includes:
Helpers::Migration
Defined in:
lib/database_consistency/writers/autofix/migration_base.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Base

#report

Instance Method Summary collapse

Methods included from Helpers::Migration

#migration_configuration, #migration_path, #migration_path_pattern

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from DatabaseConsistency::Writers::Autofix::Base

Instance Method Details

#attributesObject



19
20
21
# File 'lib/database_consistency/writers/autofix/migration_base.rb', line 19

def attributes
  {}
end

#fix!Object



9
10
11
12
13
14
15
16
17
# File 'lib/database_consistency/writers/autofix/migration_base.rb', line 9

def fix!
  file_path = migration_path(migration_name)

  if Dir[migration_path_pattern(migration_name)].any?
    p "Skipping migration #{migration_name} because it already exists"
  else
    File.write(file_path, migration)
  end
end