Bug: db.js is dead code with conflicting schema (no UNIQUE on leads.email) #120
Labels
No Label
P0 Critical
P1 High
P2 Medium
P3 Low
accessibility
backend
bug
content
data-integrity
enhancement
frontend
infra
integration
owner
owner-input
performance
performance
phase-7
phase-8
security
seo
ui
ux
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: null/Queue-North-Website#120
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
There are TWO database schema definitions:
server/index.js(lines 135-148) — definesleadstable WITHOUT a UNIQUE constraint onemail. This is the one that actually runs.server/db.js— definesleadstable WITH UNIQUE constraint onemail, plus migration logic. Butdb.jsis NEVER imported anywhere. It is dead code.The result: duplicate email submissions are NOT prevented by the database. The 409 Conflict handler in server/index.js (line 541) catches
unique constrainterrors, but this constraint does not exist, so the handler can never fire.Every lead submission with a duplicate email will succeed with a new row in the database.
Fix
Either:
Recommendation: Option A — delete db.js, add the UNIQUE constraint, add a migration path for existing databases.
Files
Severity
High — duplicate leads are being inserted; 409 error handler is dead code