Commit 92b08bb
fix(s3): add upgrade migration for composite (drawingId, fileId) PK
Prior versions of this branch shipped the new S3File composite primary
key by editing the original `20260408060000_add_s3_files` migration in
place. That works for fresh deployments but is invisible to any
deployment that already applied the original `id`-only PK migration —
Prisma decides what to apply by migration name, so the new shape never
reaches the database and runtime upserts crash with
"The column `drawingId` does not exist in the current database."
Restore the original migration to its pre-bundle shape and add a
follow-up migration that drops + recreates S3File with the new shape.
Both fresh and upgrade paths converge on the composite PK. Existing
S3 objects are untouched; public-bucket deployments are unaffected.
Private-bucket deployments will see /api/files/:drawingId/:fileId 404
for legacy rows until those drawings are re-saved (the save flow
upserts on every base64 dataURL); operators with valuable legacy rows
can rebuild manually before deploying.
Change-Id: I9c06c7a46247050521a1d5013ec37eeebeb86247
Co-developed-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a615ca8 commit 92b08bb
2 files changed
Lines changed: 34 additions & 9 deletions
File tree
- backend/prisma/migrations
- 20260408060000_add_s3_files
- 20260506130000_s3file_composite_pk
Lines changed: 2 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | 2 | | |
7 | | - | |
8 | | - | |
| 3 | + | |
9 | 4 | | |
10 | 5 | | |
11 | 6 | | |
12 | | - | |
13 | | - | |
| 7 | + | |
14 | 8 | | |
15 | 9 | | |
16 | 10 | | |
17 | | - | |
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments