Class: Pronto::RailsSchema

Inherits:
Runner
  • Object
show all
Defined in:
lib/pronto/rails_schema.rb

Overview

Pronto runner

Instance Method Summary collapse

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pronto/rails_schema.rb', line 8

def run
  return [] unless migration_patches.any?

  if schema_file_present?
    schema_patch = @patches.find { |patch| detect_schema_file(patch.new_file_full_path) }
    return generate_messages_for('schema.rb') unless changes_detected?(schema_patch)
  end

  if structure_file_present?
    structure_patch = @patches.find { |patch| detect_structure_file(patch.new_file_full_path) }
    return generate_messages_for('structure.sql') unless changes_detected?(structure_patch)
  end

  []
end