# Live Schema Proposal (DESIGN ONLY)

**Do not run migrations.** This document is a proposal for Brad’s review before any DB change.

Phase 1 stores demo approval state in PHP session only.

**Phase 2A interim (no migration):** purpose + status JSON under `App/secure/live/approvals/` (web-denied). See `MIGRATION_023_LIVE_APPROVALS_NOT_EXECUTED.md`.

## Proposed tables (future)

### `live_business_approvals`

| Column | Type | Notes |
|--------|------|-------|
| id | BIGINT PK | |
| business_id | BIGINT | FK → Foundation business |
| user_id | BIGINT | Verified user who submitted |
| purpose_text | TEXT | |
| purpose_hash | CHAR(64) | Normalized hash for change detection |
| status | ENUM('pending','approved','denied','superseded') | |
| moderator_source | ENUM('none','ai','human') | Future |
| moderator_note | TEXT NULL | |
| approved_at | DATETIME NULL | |
| created_at | DATETIME | |
| updated_at | DATETIME | |

Unique active approval per business (partial unique / status constraint — TBD).

### `live_sessions`

| Column | Type | Notes |
|--------|------|-------|
| id | BIGINT PK | |
| business_id | BIGINT | |
| created_by_user_id | BIGINT | |
| title | VARCHAR(160) | |
| mode | ENUM('now','scheduled') | |
| scheduled_at | DATETIME NULL | |
| status | ENUM('draft','scheduled','live','ended','cancelled') | |
| business_video_id | BIGINT NULL | Set when recording saved |
| created_at / updated_at | DATETIME | |

### `live_business_videos`

| Column | Type | Notes |
|--------|------|-------|
| id | BIGINT PK | Public id may be opaque string alias |
| business_id | BIGINT | |
| session_id | BIGINT NULL | |
| storage_path | VARCHAR(512) | Under `/App/uploads/…` only |
| visibility | ENUM('private','business','public') | |
| title | VARCHAR(160) NULL | |
| duration_seconds | INT NULL | |
| created_at / updated_at / deleted_at | DATETIME | |

### Reference tables (not duplicate media)

- `live_video_listing_links (video_id, listing_id)`
- `live_video_gallery_links (video_id, business_id, sort_order)`

## Migration policy

- No Phase 1 migration scripts executed.
- Prefer App2/Foundation migration numbering when Brad authorizes.
- WomanWise / Responses Phase 2 schemas are out of scope — do not collide.
