Skip to content

Upgrade Rails to 5.1.4 and Scrivito to 1.11.0 #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Oct 29, 2017
Merged

Conversation

yasulab
Copy link
Member

@yasulab yasulab commented Oct 29, 2017

This PR upgrades Rails, Scrivito, and other related gems to the latest versions:

@yasulab yasulab changed the title Upgrade Rails and Scrivito gems to the latest [WIP] Upgrade Rails and Scrivito gems to the latest Oct 29, 2017
@yasulab yasulab changed the title [WIP] Upgrade Rails and Scrivito gems to the latest Upgrade Rails and Scrivito gems to the latest Oct 29, 2017
@yasulab
Copy link
Member Author

yasulab commented Oct 29, 2017

@nalabjp すみません 💦 だいたい Rails 5.1 に更新できたかなと思ったのですが、このテストが落ちる原因だけがよくわからなくてちょっと手が止まっちゃっています ><

Failures:
  1) Statistics::Aggregation.run should change `EventHistory.count` from 0 to 2
     Failure/Error: Dojo.delete_all
     ActiveRecord::InvalidForeignKey:
       SQLite3::ConstraintException: FOREIGN KEY constraint failed: DELETE FROM "dojos"
     # ./spec/lib/statistics/aggregation_spec.rb:14:in `block (2 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # SQLite3::ConstraintException:
     #   FOREIGN KEY constraint failed
     #   ./spec/lib/statistics/aggregation_spec.rb:14:in `block (2 levels) in <top (required)>'

cf. https://travis-ci.org/coderdojo-japan/coderdojo.jp/builds/294500786#L664-L676

もし何かアイデアがあればアドバイスもらえるとめっちゃ助かります 🙏 💦 (手元ではテストが全て通っているので、DB周りで何か見逃してるのかなぁと考えています🤔💭)

@yasulab
Copy link
Member Author

yasulab commented Oct 29, 2017

んー、db:drop && db:create しても手元のテストが通ってしまう不思議... 😓

$ bundle exec rspec spec/

...............................................

Finished in 13.05 seconds (files took 5.87 seconds to load)
47 examples, 0 failures

@yasulab yasulab force-pushed the upgrade-rails-to-51 branch from b605976 to 45971bf Compare October 29, 2017 16:56
@nalabjp
Copy link
Member

nalabjp commented Oct 29, 2017

@yasulab

SQLite3::ConstraintException: FOREIGN KEY constraint failed: DELETE FROM "dojos"

あぁ、ゴメンナサイ、Modelの実装のような気が。

t.references :dojo, foreign_key: true, index: true, null: false

t.references :dojo, foreign_key: true, index: true, null: false

この2箇所でFOREIGN KEY制約をかけているので、
has_one :dojo_event_service
has_many :event_histories

ここにdependent: :destroyを追加しないといけないのかな?🤔(未確認)

@yasulab
Copy link
Member Author

yasulab commented Oct 29, 2017

オォ! ありがとうございます! 😸 とりあえず feature branch に push して Travis CI 走らせてみます 💨

See the following discussion for details.
#163 (comment)
@yasulab
Copy link
Member Author

yasulab commented Oct 29, 2017

Hmm, テストが同じところで落ちているところを見ると、別の何かが原因っぽいですねぇ🤔💭
https://travis-ci.org/coderdojo-japan/coderdojo.jp/builds/294510105#L666-L678

@nalabjp
Copy link
Member

nalabjp commented Oct 29, 2017

あ、Dojo.delete_allで呼んでるからSQLを直接発行していてARのdependentが効いていないのか。
Dojo.destory_allにするとどうでしょうか?

@yasulab
Copy link
Member Author

yasulab commented Oct 29, 2017

試してみます! 💨

@yasulab
Copy link
Member Author

yasulab commented Oct 29, 2017

アドバイスありがとうございます! 😸 無事にテスト通りました✅ ✨
無事にテスト通ったので、こちらのPRマージしますね 🔧 💨

@yasulab yasulab merged commit cb560ad into master Oct 29, 2017
@yasulab yasulab deleted the upgrade-rails-to-51 branch October 29, 2017 17:37
@nalabjp nalabjp mentioned this pull request Oct 29, 2017
1 task
@yasulab yasulab mentioned this pull request Dec 19, 2018
4 tasks
@yasulab yasulab changed the title Upgrade Rails and Scrivito gems to the latest Upgrade Rails to 5.1.4 and Scrivito to 1.11.0 Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants