Commit 80d8200
committed
Fix MySQL 8.2 TRUNCATE failures by correcting connection pool handling
The ReferentialIntegrity helper for MySQL had a bug where db.disconnect
was called before setting FOREIGN_KEY_CHECKS = 0. This caused the SET
command to execute on a different connection than the subsequent TRUNCATE
operations, leading to FK constraint violations.
This bug was exposed more consistently in CI with MySQL 8.2 after adding
indexes to the usage_events tables. The fix removes the db.disconnect
call and properly saves/restores the original FK checks value.
Fixes TRUNCATE errors in:
- spec/request/service_usage_events_spec.rb
- spec/request/app_usage_events_spec.rb
- All tests using isolation: :truncation with MySQL1 parent 05ed08a commit 80d8200
1 file changed
+5
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
32 | | - | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
0 commit comments