[英]Rake doesn't know how to build task 'db:migrate'
I've created an app using Ruby on Rails and Spree. 我已经使用Ruby on Rails和Spree创建了一个应用程序。
After changing my SQlite database to PostgreSQL I needed to migrate my database. 将SQlite数据库更改为PostgreSQL之后,我需要迁移数据库。 But when I try to run rake db:migrate, rake db:migrate RAILS_ENV=development, bin/rake db:migrate RAILS_ENV=development I get the same error.
但是,当我尝试运行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)
When I run --trace I get the following response 当我运行--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
Does any of you know what the cause of the problem is and what I should do? 你们中有人知道问题的原因是什么,我应该怎么做?
Rakefile Rakefile
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
I added, 我加了
require File.expand_path('../config/application', __FILE__)
and 和
YouApp::Application.load_tasks
to my rake file. 到我的瑞克文件。
Credits go to @nattfodd 积分转到@nattfodd
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.