Bug: Subscribers email field does not enforce uniqueness at database level
- Dominant language
- Python
- Stars
- 2k
- Forks
- 984
- Avg merge
- 2h 54m
- Merged PRs (30d)
- 14
Description
### Description
The `Subscribers` model does not enforce a database-level uniqueness constraint on the `email` field.
Although the subscription API checks for existing emails at the application layer, the absence of a uniqueness constraint at the database level can still result in duplicate subscriber records.
### Why this is an issue
Application-level checks alone are not sufficient to guarantee data integrity, especially in cases of:
- Concurrent requests
- Race conditions
- Direct database inserts
- Admin panel usage
This can lead to duplicate entries for the same email address.
### Affected code
```python
class Subscribers(TimeStampedModel):
email = models.EmailField(max_length=70)
Contributor guide
Research direction
Start by locating the Subscribers model and the subscription API's existing email check. Add and validate a database-level uniqueness constraint for email, confirming that duplicate subscriber records are rejected even when application-level checks are bypassed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100