so I want to switch the database for a reasonably advanced Rails project - I can connect to the DB etc and rails db:prepare worked without errors. However rails db:schema:load resulted in
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)>'
Line 13 is the start of the code (comments in the lines before), and line 25 has this:
create_table "active_storage_blobs", charset: "utf8mb4", force: :cascade do |t|
How do I trace what is wrong here? BTW the --trace option didn't help
CodePudding user response:
For reference: The problem was the acts-as-taggable-on GEM, or more specifically, the line I put into the initializer to enable special characters:
ActsAsTaggableOn.force_binary_collation = true
Commenting this out - and everything works! :)