#43: resetting Rails schema_migrations table

I just ran a failing migration, and in a fit of panic, deleted all the rows from my schema migrations table. That's a pretty dumb thing to do.

maybe there's a better way...

From the console...

Dir.open('db/migrate').each do |fname| i = fname.split('_').first.to_i next if i == 0 ActiveRecord::Base.connection.execute("INSERT INTO schema_migrations (version) VALUES(#{i})") end

Think you've got a better solution? Help 148c663fd665c53518538e093ce3c2ab_small kueda out by posting your solution