Skip to content

Instantly share code, notes, and snippets.

@ruby-fu-ninja
Forked from n0ts/set_schema_migrations.rb
Last active August 29, 2015 14:25
Show Gist options
  • Save ruby-fu-ninja/bb52c3c473a18e8961a0 to your computer and use it in GitHub Desktop.
Save ruby-fu-ninja/bb52c3c473a18e8961a0 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment