Skip to content

Instantly share code, notes, and snippets.

@fjfish
Last active July 20, 2017 15:14
Show Gist options
  • Save fjfish/3d574617ec9ab74c68760f936fc16283 to your computer and use it in GitHub Desktop.
Save fjfish/3d574617ec9ab74c68760f936fc16283 to your computer and use it in GitHub Desktop.
Script to check if migrations in the structure.sql file match the ones on the file system
IO.readlines("db/structure.sql").each do |line|
if line["INSERT INTO schema_migrations"]
migration_id = line.split(/'/)[1]
puts "#{migration_id} is missing" if Dir.glob("db/migrate/#{migration_id}_*.rb").empty?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment