-
Notifications
You must be signed in to change notification settings - Fork 1
[P1] Add database constraints and indexes for core data integrity #286
Copy link
Copy link
Open
Labels
area:dataDatabase schema, migrations, and data integrityDatabase schema, migrations, and data integrityarea:stabilityReliability and runtime stabilityReliability and runtime stabilitypriority:P1High: should be resolved before production launchHigh: should be resolved before production launchproduction-readinessProduction readiness audit itemProduction readiness audit itemtype:hardeningSecurity/stability hardening taskSecurity/stability hardening task
Metadata
Metadata
Assignees
Labels
area:dataDatabase schema, migrations, and data integrityDatabase schema, migrations, and data integrityarea:stabilityReliability and runtime stabilityReliability and runtime stabilitypriority:P1High: should be resolved before production launchHigh: should be resolved before production launchproduction-readinessProduction readiness audit itemProduction readiness audit itemtype:hardeningSecurity/stability hardening taskSecurity/stability hardening task
Type
Fields
Give feedbackNo fields configured for issues without a type.
Problem
Several database invariants are enforced only in application code or not enforced at all. The schema allows duplicate users/places/social identities and nullable fields that business logic appears to require.
Why this is not production ready
Application-only uniqueness checks are race-prone. Missing database constraints allow duplicate accounts, ambiguous login behavior, corrupt schedules, and data that crashes service logic later.
Evidence
user.email,user.name, and social identity fields have no unique constraints inV1__init.sql.PlaceRepository.findByPlaceNameassumes place names can identify a place, butplace.place_namehas no unique constraint.friend_shipstoresrequester_idandreceiver_idas scalar IDs instead of proper JPA relationships in the entity, while SQL has foreign keys.UserAuthService.signUpchecks duplicate email/name before save, but concurrent requests can still race without DB constraints.Required work
Acceptance criteria