Skip to content
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

change: delete on cascade responses when associated user is deleted #5126

Merged

Conversation

jfcalvo
Copy link
Member

@jfcalvo jfcalvo commented Jun 28, 2024

Description

This PR adds the following changes:

  • Change Responses SqlAlchemy ORM model to delete responses on cascade when a user is deleted.
  • Add a migration for responses doing the following:
    • Removing all the responses rows with user_id equal to NULL so the foreign key constraint can be modified.
    • Change user_id constraint to delete on cascade responses when a user is deleted.
    • Change user_id to be non nullable.

Closes #5109

Type of change

  • Improvement (change adding some improvement to an existing functionality)

How Has This Been Tested

  • Manually tested on PostgreSQL and SQLite.
  • It should be tested on an environment with responses with user_id equal to NULL.

Checklist

  • I added relevant documentation
  • follows the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • I confirm My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

…associated to a user when the user is deleted
@jfcalvo jfcalvo requested a review from frascuchon June 28, 2024 08:28
Copy link

codecov bot commented Jun 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.93%. Comparing base (5b6c015) to head (2e96e37).
Report is 49 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5126   +/-   ##
========================================
  Coverage    91.93%   91.93%           
========================================
  Files          135      135           
  Lines         5818     5818           
========================================
  Hits          5349     5349           
  Misses         469      469           
Flag Coverage Δ
argilla-server 91.93% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@frascuchon frascuchon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@frascuchon frascuchon self-requested a review June 28, 2024 12:02
@jfcalvo jfcalvo merged commit 60d9340 into develop Jun 28, 2024
6 checks passed
@jfcalvo jfcalvo deleted the change/migrate-responses-to-be-deleted-when-users-are-deleted branch June 28, 2024 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Remove responses when a user is deleted
2 participants