Files
Naser Mansour 7f35297025 Mark all libra tasks Done — confirmed live in production ~1 year
Naser confirmed all remaining QA Review / Draft rows (97 subtasks, 16
parent rollups) are done in substance: the site has been in production
for roughly a year. Overrides the conservative QA-Review/Draft mapping
from the prior takeover commit (0f9d12c) at his explicit instruction.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-27 22:04:04 +03:00

31 lines
1.6 KiB
Markdown

---
id: 11-1
title: 11-1 Database Schema & Model Updates
status: Done
date: 2026-09-27
parent: 11
---
## Description
As a developer, I want to extend the consultation system to support guest bookings, So that consultations can be created for both registered clients and anonymous guests. The existing foreign key consultations_user_id_foreign cascades on delete. With nullable user_id: - Guest consultations won't be affected by user deletions (they have no user) - Client consultations still cascade delete when user is deleted. Full implementation history: docs/stories/story-11.1-database-schema-model-updates.md
## Acceptance Criteria
- [ ] `user_id` column changed to nullable on `consultations` table
- [ ] `guest_name` column added (varchar 255, nullable)
- [ ] `guest_email` column added (varchar 255, nullable)
- [ ] `guest_phone` column added (varchar 50, nullable)
- [ ] Index added on `guest_email` for 1-per-day lookup performance
- [ ] Migration is reversible without data loss
- [ ] Existing consultations with `user_id` unaffected
- [ ] `Consultation` model updated with new fillable fields
- [ ] `isGuest()` helper method returns true when `user_id` is null
- [ ] `getClientName()` helper returns guest_name or user->full_name
- [ ] `getClientEmail()` helper returns guest_email or user->email
- [ ] `getClientPhone()` helper returns guest_phone or user->phone
- [ ] Model validation ensures either user_id OR guest fields are present
- [ ] `ConsultationFactory` updated with `guest()` state
- [ ] Guest state generates fake guest_name, guest_email, guest_phone
- [ ] Guest state sets user_id to null