database_cleaner-active_record icon indicating copy to clipboard operation
database_cleaner-active_record copied to clipboard

Avoid accidental replacement of main DB model connections

Open kaorukobo opened this issue 1 year ago • 2 comments

fixes #97

Notes on CI failures

Tests for Rails 7.1 do not pass even at commit aafa5b2

kaorukobo avatar Feb 20 '24 06:02 kaorukobo

After making this PR, I ran into another issue in multiple database usage, which may be related to #24 and #47. ~~I'll put more details in #97, the issue bound to this PR.~~ [EDITED on Mar 3: instead I posted another suggestion to #100, where this PR can be closed if it is approved.]

In short, this patch will:

  • resolves the issue with the use of a :truncation strategy.
  • but be useless with the use of :transaction strategy due to the "another issue" above.

kaorukobo avatar Feb 26 '24 05:02 kaorukobo

@etagwerker I checked if #97 is reproduced with the commit of the PR. The problem still remains.

As per I wrote above and commented here, I would rather suggest dropping support for the connection name in the :db option.

kaorukobo avatar Jul 12 '24 04:07 kaorukobo