-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1254 remove attempts fks #1453
1254 remove attempts fks #1453
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1453 +/- ##
==========================================
+ Coverage 87.50% 87.58% +0.07%
==========================================
Files 214 214
Lines 6346 6370 +24
==========================================
+ Hits 5553 5579 +26
+ Misses 793 791 -2 ☔ View full report in Codecov by Sentry. |
* Added additional functionality to replace lost delete cascade behaviour.
41a9d1a
to
aa365af
Compare
324c498
to
c731580
Compare
c731580
to
8c6dbee
Compare
Please note: Should this PR be reactivated, there are some code changes that need to be made. The biggest one is to remove all the plumbing added for Mox and use https://hex.pm/packages/mock instead. There are also some changes required when pattern matching against response from |
|
||
case result do | ||
{:ok, %{user: deleted_user}} -> {:ok, deleted_user} | ||
{:error, _, changeset} -> {:error, changeset} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Match against all the elements of the Ecto.Multi
error response tuple:
{:error, _failed_operation, changeset, _changes_so_far} -> {:error, changeset}
|
||
case result do | ||
{:ok, %{attempt: modified_attempt}} -> {:ok, modified_attempt} | ||
{:error, _, changeset} -> {:error, changeset} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Match against all the elements of the Ecto.Multi
error response tuple:
{:error, _failed_operation, changeset, _changes_so_far} -> {:error, changeset}
|
||
case result do | ||
{:ok, %{attempts: deleted_attempts}} -> {:ok, deleted_attempts} | ||
{:error, _, changeset} -> {:error, changeset} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Match against all the elements of the Ecto.Multi
error response tuple:
{:error, _failed_operation, changeset, _changes_so_far} -> {:error, changeset}
@rorymckinley , should this still be in "draft mode" or is it ready for review and merge? |
Notes for the reviewer
Removes the FK constraint between
attempt_runs
&attempts
as well as the FK betweenlog_lines
andattempts
. I added functionality toAttempts
to replicate theON DELETE CASCADE
behaviour lost as a result of removing the FK.I also simplified the tests in
AccountsTest
andQueueTest
as much of what they were testing is now encapsulated in he methods added toAttempts
and so the detailed tests now live inAttemptsTest
(sorry, makes for a bit of a messy diff - happy to talk through the changes).Note: I could not test the rollback behaviour for
Attempts.delete_for_user
as I could not find a way to trigger a rollback from a test. Open to any suggestions as to how I can improve the situation.I added mocking so that I could test the response when there is an error.
Related issue
Fixes #
Review checklist