Last active
July 20, 2017 15:14
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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