In a Rails 3.2.3 application, I have a need to allow an administrator to create a database and populate it with tables from schema.rb.
Just executing the code in schema.rb is ideal. Basically, I am looking for a way to do:
rake db:setup
without using “rake”.
I have several things I’d also like to do, such as back up a database, and I’m wondering if there’s a Rails DSL I can work with or if I just need to write the SQL and run it through ActiveRecord::Base.connection.execute.
Thanks for any help you can offer.
You can try to run it from your app: