Skip to content

Instantly share code, notes, and snippets.

@maxim
Created April 12, 2009 07:23
Show Gist options
  • Save maxim/93908 to your computer and use it in GitHub Desktop.
Save maxim/93908 to your computer and use it in GitHub Desktop.
desc "Load SQL structure into database"
task(:load => :environment) do
conf = ActiveRecord::Base.configurations
puts "Loading sql structure..."
if system("psql #{conf[RAILS_ENV]["database"]} #{conf[RAILS_ENV]["username"]} < db/#{RAILS_ENV}_structure.sql")
puts "Done"
else
puts "Boom! Something went wrong."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment