Rowing dependency is not fulfilled, but causes work

I tried to run rake db:test:clone_structure , but it was not able to restore the database. I finally looked at the task:

 task :clone_structure => [ "db:structure:dump", "db:test:load_structure" ] 

When I run the trace, I noticed that db:test:load_structure not running:

 $ rake db:test:clone_structure --trace ** Invoke db:test:clone_structure (first_time) ** Invoke db:structure:dump (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:structure:dump ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge ** Execute db:test:clone_structure 

Now when I change the clone_structure task to call load_structure ...

 task :clone_structure => [ "db:structure:dump", "db:test:load_structure" ] do db_namespace["test:load_structure"].invoke end 

... everything suddenly works!

 $ rake db:test:prepare --trace ** Invoke db:test:clone_structure (first_time) ** Invoke db:structure:dump (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:structure:dump ** Invoke db:test:purge (first_time) ** Invoke environment ** Execute db:test:purge ** Execute db:test:clone_structure ** Invoke db:test:load_structure (first_time) ** Invoke db:test:purge ** Execute db:test:load_structure ** Invoke db:structure:load (first_time) ** Invoke environment ** Invoke db:load_config (first_time) ** Execute db:load_config ** Execute db:structure:load 

What could be causing this behavior? I am using Rails 3.2.14 and Rake 10.1.0.

UPDATED: I upgraded Rails to 3.2.13 from 3.2.11 and this is still a problem.

UPDATED SECOND: I upgraded Rails to 3.2.14 and Rake to 10.1.0, and this is still a problem

+7
source share
2 answers

After sticking the stack trace in one of the tasks that I knew caused, I found a problem. This has nothing to do with ActiveRecord or Rake, and everything related to activerecord-oracle_enhanced-adapter , which I also use.

Basically, pearl redefines the db:test:clone_structure as follows:

 redefine_task :clone_structure => [ "db:structure:dump", "db:test:purge" ] 

Note that it does not reference the db:test:load_structure .

I submitted an issue and a pull request to the project, so I hope it will be resolved in the near future.

0
source

I would say that you are almost there. As far as I know, a rake convention for this would be ...

 task :clone_structure => [ "db:structure:dump", "db:test:load_structure" ] do Rake::Task["clone_structure"].invoke end 

Otherwise, I prefer ...

 task :clone_structure do Rake::Task["db:structure:dump"].invoke Rake::Task["db:test:load_structure"].invoke end 
+1
source

All Articles