# Migration — 2026-03-28 — add user metadata fields

## Purpose
Add user-specific metadata fields to support CopyMeThat import:
- `made` — Boolean flag for "I've cooked this"
- `rating` — 1-5 star rating
- `notes` — General recipe notes/comments

## Schema changes
```sql
ALTER TABLE recipes ADD COLUMN made INTEGER DEFAULT 0;  -- SQLite boolean as 0/1
ALTER TABLE recipes ADD COLUMN rating INTEGER;          -- 1-5 or NULL
ALTER TABLE recipes ADD COLUMN notes TEXT;              -- Freeform text
```

## Field specifications
- **made:** INTEGER (0 = false, 1 = true), NOT NULL, default 0
- **rating:** INTEGER (1-5), NULL allowed (no rating yet)
- **notes:** TEXT, NULL allowed (empty = no notes)

## Runtime behavior
- New DBs: `schema.sql` will be updated to include these fields
- Existing DBs: Runtime migration helper will add columns if missing

## Updated paths
- `src/backend/db/schema.sql`
- `src/backend/db/schemaMigrations.ts`
- `src/backend/types/recipe.ts`
- `src/backend/repositories/RecipeRepository.ts`
- `src/frontend/types/recipe.ts`

## Validation rules
- `made`: Must be 0 or 1
- `rating`: If present, must be 1-5
- `notes`: Max length 10,000 characters (reasonable limit)

## Operational note
Run: `npm run migrate` (idempotent, safe for existing DBs)

---

**Migration date:** 2026-03-28  
**Reason:** CopyMeThat import feature support
