Permalink
Browse files

Merge pull request #7140 from seamusabshere/patch-1

Make sure :environment task is executed before db:schema:load or
db:structure:load
  • Loading branch information...
2 parents 447b6a4 + e7e8656 commit f784f218ea30f60c708db26e47eb336e824cdf5d @rafaelfranca rafaelfranca committed Aug 5, 2012
Showing with 7 additions and 2 deletions.
  1. +5 −0 activerecord/CHANGELOG.md
  2. +2 −2 activerecord/lib/active_record/railties/databases.rake
@@ -1,5 +1,10 @@
## Rails 4.0.0 (unreleased) ##
+* Make sure `:environment` task is executed before `db:schema:load` or `db:structure:load`
+ Fixes #4772.
+
+ *Seamus Abshere*
+
* Allow Relation#merge to take a proc.
This was requested by DHH to allow creating of one's own custom
@@ -241,7 +241,7 @@ db_namespace = namespace :db do
end
end
- task :load_if_ruby => 'db:create' do
+ task :load_if_ruby => [:environment, 'db:create'] do
db_namespace["schema:load"].invoke if ActiveRecord::Base.schema_format == :ruby
end
@@ -326,7 +326,7 @@ db_namespace = namespace :db do
end
end
- task :load_if_sql => 'db:create' do
+ task :load_if_sql => [:environment, 'db:create'] do
db_namespace["structure:load"].invoke if ActiveRecord::Base.schema_format == :sql
end
end

0 comments on commit f784f21

Please sign in to comment.