Próbowałem uruchomić rake db:test:clone_structure
, ale nadal nie można odbudować bazy danych. W końcu spojrzał na samego zadania:Zależność Rake nie jest wykonywana, ale wywołuje działa
task :clone_structure => [ "db:structure:dump", "db:test:load_structure" ]
Kiedy biegnę ślad, Zauważyłem, że db:test:load_structure
nie jest uzyskiwanie wykonywane:
$ 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
Teraz, kiedy zmienić zadanie clone_structure
do powołaćload_structure
...
task :clone_structure => [ "db:structure:dump", "db:test:load_structure" ] do
db_namespace["test:load_structure"].invoke
end
... nagle wszystko działa!
$ 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
Co może być przyczyną tego zachowania? Używam Rails 3.2.14 i Rake 10.1.0.
ZAKTUALIZOWANO: Uaktualniłem Railsy do wersji 3.2.13 z wersji 3.2.11 i nadal jest to problem.
AKTUALIZACJA DRUGI: uaktualnieniu Rails do 3.2.14 i grabie do 10.1.0 i nadal jest problem
Czy twoja struktura.sql zostanie utworzona bez problemów, gdy uruchomisz "rake db: test: clone_structure"? Czy widzisz jakieś problemy z tym? –
Czy możesz spróbować uruchomić 'RAILS_ENV = test rake db: test: prepare --trace'? Czasami widziałem, że 'RAILS_ENV' musi być ustawiony na wykonywanie pewnych zadań. – Subhas
@yuri: db: test: clone_structure wygląda na to, że działa idealnie. Rzucę trochę debugowania, żeby się upewnić. – abeger