Missing Unique Constraint on email Field in users Table #65

Closed
opened 2026-03-17 20:54:23 +00:00 by charlie · 0 comments
Owner

Description

The email field in the users table lacks a unique constraint, which allows multiple users to share the same email address. This violates database integrity
rules and could lead to:

  • Data corruption if duplicate emails are inserted.
  • Unintended side effects in application logic (e.g., duplicate login attempts).

Root Cause

The email column is not defined with UNIQUE constraints in the users table creation script.

Current Behavior

  • No validation occurs when inserting duplicate emails.
  • Risk of inconsistent data if the table is modified later.

Proposed Fix

Add UNIQUE constraint to the email column in the users table creation script.
Example (SQL syntax):
add the following at the end of the create block(inside not outside):

constraint uq_users_email unique (email)
## Description The `email` field in the `users` table lacks a **unique constraint**, which allows multiple users to share the same email address. This violates database integrity rules and could lead to: - **Data corruption** if duplicate emails are inserted. - **Unintended side effects** in application logic (e.g., duplicate login attempts). ## Root Cause The `email` column is not defined with `UNIQUE` constraints in the `users` table creation script. ## Current Behavior - No validation occurs when inserting duplicate emails. - Risk of inconsistent data if the table is modified later. ## Proposed Fix **Add `UNIQUE` constraint** to the `email` column in the `users` table creation script. Example (SQL syntax): add the following at the end of the create block(inside *not* outside): ```sql constraint uq_users_email unique (email) ```
charlie added reference fix/add_uq_users_email 2026-03-17 22:09:46 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ULFSII/phoenix_db#65
No description provided.