Skip to content

Instantly share code, notes, and snippets.

@ruby-fu-ninja
ruby-fu-ninja / set_schema_migrations.rb
Last active August 29, 2015 14:25 — forked from n0ts/set_schema_migrations.rb
Set all migrations as up in schema_migrations table
Dir["db/migrate/*"].each do |v|
next if v == "." or v == ".." or v == ".svn"
version = File.basename(v).split('_').first
begin
ActiveRecord::Base.connection.execute("INSERT INTO schema_migrations values ('#{version}')")
rescue => e
p e
exit
end
end