Create a gist now

Instantly share code, notes, and snippets.

@peter /db.rake
Created Jun 11, 2009

What would you like to do?
namespace :db do
# NOTE: In Rails 3 there will be a db:setup task but it only works if ActiveRecord::Base.schema_format == :ruby
# See
# The following patch fixes db:schema:load to work with schema_format :sql:
desc 'Recreate the database, load the schema, and initialize with the seed data'
task :super_setup => [ 'db:drop', 'db:create' ] do
system("cat db/development_structure.sql db/development_data.sql | script/dbconsole")
seed_file = File.join(Rails.root, 'db', 'seeds.rb')
load(seed_file) if File.exist?(seed_file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment