5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/pronto/rails_schema.rb', line 5
def run(patches, _)
return [] unless patches
migration_patches = patches
.select { |patch| detect_added_migration_file(patch) }
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(migration_patches, '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(migration_patches, 'structure.sql') unless changes_detected?(structure_patch)
end
[]
end
|