AOSSIE-Org / AOSSIE-Org/BabyNest
BUG:Missing Foreign Key Relationship with profile_id Causing Unlinked Records
- Vorherrschende Sprache
- JavaScript
- Sterne
- 56
- Forks
- 124
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
### Is there an existing issue for this?
- [x] I have searched the existing issues
### What happened?
## 📌 Issue Overview
Several tables do not contain a foreign key referencing the `profile` table.
Because of this, created records are not bound to any user/profile, resulting in orphan data and inability to correctly query user-specific records.
Create a profile
2. Insert records in any of the following tables:
- appointments
- tasks
- blood_pressure_logs
- discharge_logs
- weekly_weight
- weekly_medicine
- weekly_symptoms
3. Try to fetch records by user/profile
4. Notice that there is no reliable way to associate entries with a specific profile
## 🎯 Expected Behavior
Every record should be linked to a profile through a `profile_id` foreign key, ensuring:
- proper relational integrity
- user-specific data retrieval
- automatic cleanup when a profile is deleted
## 🚨 Actual Behavior
Records are stored without any relationship to the profile,
leading to:
- orphan database rows
- incorrect or mixed user data
- data inconsistency
## 💡 Suggested Fix
Add a `profile_id INTEGER NOT NULL` column with a foreign key constraint:
```sql
ALTER TABLE
ADD COLUMN profile_id INTEGER NOT NULL REFERENCES profile(id) ON DELETE CASCADE;
- [x] I agree to follow this project's Code of Conduct
- [x] I want to work on this issue
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.