ActiveRecord::InvalidForeignKey: Mysql2::Error: Cannot delete or update a parent row: a foreign key constraint fails (`exercism`.`jiki_signups`, CONSTRAINT `fk_rails_68249c268f` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)) (ActiveRecord::InvalidForeignKey)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 20/100
Research direction
The failure is raised from SettingsController#destroy_account when a user is deleted while a row in the jiki_signups table still references them through user_id. Start with the destroy_account action and the User model's associations to see which dependent records are removed and which are not. Done means account deletion no longer hits the foreign key error and the related rows are handled as the maintainers intend, with a test covering that path.
Written by the indexing model from the issue text.
Description
Error
Cannot delete or update a parent row: a foreign key constraint fails (`exercism`.`jiki_signups`, CONSTRAINT `fk_rails_68249c268f` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)) (Mysql2::Error)
Stack trace
mysql2/client.rb:146 in _query
mysql2/client.rb:146 in block in Mysql2::Client#query
mysql2/client.rb:145 in Thread.handle_interrupt
mysql2/client.rb:145 in query
active_record/connection_adapters/mysql2/database_statements.rb:98 in block (2 levels) in ActiveRecord::ConnectionAdapters::Mysql2::DatabaseStatements#raw_execute
active_record/connection_adapters/abstract_adapter.rb:1029 in block in ActiveRecord::ConnectionAdapters::AbstractAdapter#with_raw_connection
active_support/concurrency/null_lock.rb:9 in synchronize
active_record/connection_adapters/abstract_adapter.rb:998 in with_raw_connection
active_record/connection_adapters/mysql2/database_statements.rb:96 in block in ActiveRecord::ConnectionAdapters::Mysql2::DatabaseStatements#raw_execute
active_support/notifications/instrumenter.rb:58 in instrument
Tracking Details
- Project: exercism-rails
- Sentry: ActiveRecord::InvalidForeignKey: Mysql2::Error: Cannot delete or update a parent row: a foreign key constraint fails (
exercism.jiki_signups, CONSTRAINTfk_rails_68249c268fFOREIGN KEY (user_id) REFERENCESusers(id)) (ActiveRecord::InvalidForeignKey) - Culprit: SettingsController#destroy_account
- First seen: Nov 13, 2026
- Dominant language
- Ruby
- Stars
- 554
- Forks
- 172
- Avg merge
- 20h 23m
- Merged PRs (30d)
- 73
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from exercism/website
-
Difficulty 2/5 1-3 hours Newbie friendliness 60/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
All issues in exercism/website
Similar issues
-
開発用DockerイメージにPlaywrightのシステム依存を追加するPossibly taken @momocus claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
sakazuki-org/sakazuki#1453 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
jenkins-infra/jenkins.io#9615 · 1 comment ·
Maintainers usually reply within 1 day
-
fix(ocr): compile the Tesseract-free pipeline with Tokio runtimePossibly taken @Goldziher claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Metric tooltips that contradict how the metric is calculatedPossibly taken @aniadeadu claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
WikiEducationFoundation/WikiEduDashboard#7303 · 1 comment ·
Maintainers usually reply within 1 day
-
WhatsApp Cloud template sync saves a partial template list when one page of the Graph API response failsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 2 days