Rake不知道如何构建任务'db:migrate'

时间:2018-02-02 15:44:02

标签: ruby-on-rails rake spree

我使用Ruby on Rails和Spree创建了一个应用程序。

将我的SQlite数据库更改为PostgreSQL后,我需要迁移我的数据库。 但是当我尝试运行rake db:migrate时,rake db:migrate RAILS_ENV = development,bin / rake db:migrate RAILS_ENV = development我得到了同样的错误。

rake aborted!
Don't know how to build task 'db:migrate:up' (see --tasks)
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)

当我运行--trace时,我得到以下回复

** Invoke default (first_time)
** Invoke spec (first_time)
** Execute spec
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -I/usr/local/rvm/gems/ruby-2.3.0/gems/rspec-core-3.7.0/lib:/usr/local/rvm/gems/ruby-2.3.0/gems/rspec-support-3.7.0/lib /usr/local/rvm/gems/ruby-2.3.0/gems/rspec-core-3.7.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
Could not load dummy application. Please ensure you have run `bundle exec rake test_app`
** Execute default

你们是否知道问题的原因是什么以及我应该做什么?

Rake文件

require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rspec/core/rake_task'
require 'spree/testing_support/common_rake'


RSpec::Core::RakeTask.new

task default: :spec

desc "Generates a dummy app for testing"
task :test_app do
  ENV['LIB_NAME'] = 'spree/frontend'
  Rake::Task['common:test_app'].invoke
end

1 个答案:

答案 0 :(得分:0)

我补充说,

require File.expand_path('../config/application', __FILE__)

YouApp::Application.load_tasks

到我的rake文件。

积分转到@nattfodd