Created
June 11, 2009 13:17
-
-
Save peter/127891 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 http://afreshcup.com/2009/05/11/seed-data-in-rails-3 | |
# The following patch fixes db:schema:load to work with schema_format :sql: | |
# https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2789-make-rake-task-dbschemaload-compatible-with-sql-schema-format | |
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) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment