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

Fix: Ensure Proper Uniqueness Checks and Handle Constraint Violations Gracefully #391

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

Tonyrealzy
Copy link

@Tonyrealzy Tonyrealzy commented Mar 1, 2025

Description

This PR improves the database logic by:

  • Analyzing database constraint violations to understand their causes.
  • Adding proper uniqueness checks to prevent duplicate entries.
  • Handling conflicts gracefully to avoid breaking the application.
  • Ensuring idempotent and unique inserts for better data integrity.

Related Issue (Link to Github issue)

Closes #370

How Has This Been Tested?

  • Manual Testing: Verified functionality by creating and updating records with different test cases.
  • Unit Tests: Ran test suites to ensure database constraints work as expected. Specifically tested:
  1. ./tests/test_organisation
  2. ./tests/test_newsletter
  3. ./tests/test_superadmin

Screenshots

{ACE67915-8F3C-4BC3-951E-0AECDFAD3827} {C5512A0A-ED18-4DB2-8B4D-F694A5B258E2}

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Realzy added 4 commits February 28, 2025 21:46
…ing roles and organisations, including duplicate cases
…min and newsletter. Also wrote test cases for duplicate entries and ensured they render expected results
…to meet the already refactored code demands and also tested to confirm that changes made work perfectly
…queSingleFieldRefactored to CheckForUniqueness
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.

Unique constraint violation bug when inserting records into the org_roles table
2 participants