27 lines
867 B
Markdown
27 lines
867 B
Markdown
# Migration — 2026-03-27 — add `recipes.image_url`
|
|
|
|
## Purpose
|
|
Add first-class recipe image support so API responses can return a stable `image_url` field for UI rendering.
|
|
|
|
## Schema change
|
|
```sql
|
|
ALTER TABLE recipes ADD COLUMN image_url TEXT;
|
|
```
|
|
|
|
## Runtime behavior
|
|
- New DBs: `schema.sql` now creates `recipes.image_url` directly.
|
|
- Existing DBs: runtime migration helper (`applyRuntimeMigrations`) checks `PRAGMA table_info(recipes)` and adds `image_url` only if missing.
|
|
|
|
## Updated paths
|
|
- `src/backend/db/schema.sql`
|
|
- `src/backend/db/schemaMigrations.ts`
|
|
- `src/backend/db/database.ts`
|
|
- `src/backend/db/migrate.ts`
|
|
- `src/backend/db/seed.ts`
|
|
- recipe types/routes/repository/parser updates
|
|
|
|
## Operational note
|
|
Run one of:
|
|
- `npm run migrate` (safe/idempotent for existing DB)
|
|
- `npm run seed` (also applies runtime migration before writing seed data)
|