所以我想為一個相當高級的 Rails 專案切換資料庫 - 我可以連接到資料庫等,并且 rails db:prepare 作業沒有錯誤。然而 rails db:schema:load 導致
Mysql2::Error: Cannot delete or update a parent row: a foreign key constraint fails
The problem is, it's not telling me a lot more. It gives these lines in addition:
/../db/schema.rb:25:in `block in <main>'
/../db/schema.rb:13:in `<main>'
/../bin/rails:5:in `<top (required)>'
/../bin/spring:10:in `block in <top (required)>'
/../bin/spring:7:in `<top (required)>'
第 13 行是代碼的開始(前幾行的注釋),第 25 行是這樣的:
create_table "active_storage_blobs", charset: "utf8mb4", force: :cascade do |t|
我如何追蹤這里出了什么問題?順便說一句 --trace 選項沒有幫助
uj5u.com熱心網友回復:
供參考:問題是 GEM 上的可標記行為,或者更具體地說,是我放入初始化程式以啟用特殊字符的行:
ActsAsTaggableOn.force_binary_collation = true
對此進行評論 - 一切正常!:)
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/376649.html
