Help us understand the problem. What is going on with this article?

Errno::ENOENT: No such file or directory @ rb_sysopenの対処法

備忘録
テスト用のDBを作ろうとして、rake db:migrateを実行したら以下のようなエラーが起きた。
原因は、spec配下にdbのディレクトリーがなくschemaが無かったために下記のエラーが生じていた。
ちなみに、migrateは成功しているので無視しても平気。
でも、エラーを無視するのは気持ち悪いのでschemaファイルを作って再度、drop,create,migrateを実施した。
(僕の場合は、dbディレクトリーを丸ごとコピーしてspec配下にペーストした。)

結論としては、以下のエラーが起きたらschemaを作成し、再度rake db:migrateをしてあげる事により解消できる。

rake aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - /Users/kaye/Desktop/work/sample_app/spec/dummy/db/schema.rb
/Users/kaye/.rvm/gems/ruby-2.3.0@ukokkei/gems/activerecord-4.2.11.1/lib/active_record/railties/databases.rake:229:in `initialize'
/Users/kaye/.rvm/gems/ruby-2.3.0@sample/gems/activerecord-4.2.11.1/lib/active_record/railties/databases.rake:229:in `open'
/Users/kaye/.rvm/gems/ruby-2.3.0@sample/gems/activerecord-4.2.11.1/lib/active_record/railties/databases.rake:229:in `block (3 levels) in <top (required)>'
/Users/kaye/.rvm/gems/ruby-2.3.0@sample/gems/activerecord-4.2.11.1/lib/active_record/railties/databases.rake:52:in `block (2 levels) in <top (required)>'
/Users/kaye/.rvm/gems/ruby-2.3.0@sample/gems/activerecord-4.2.11.1/lib/active_record/railties/databases.rake:45:in `block (2 levels) in <top (required)>'
/Users/kaye/.rvm/gems/ruby-2.3.0@sample/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/Users/kaye/.rvm/gems/ruby-2.3.0@sample/bin/ruby_executable_hooks:24:in `eval'
/Users/kaye/.rvm/gems/ruby-2.3.0@sample/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => app:db:schema:dump
(See full trace by running task with --trace)

keye
会社で働いていますが、軽いタスクならフリーランスとして受けれるので仕事の依頼はメールを通じてご連絡していただける嬉しいです。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした