max / makenotwork
| 1 | -- SyncKit blob storage: tracks uploaded file blobs per app/user. |
| 2 | -- Blobs live in a separate S3 bucket, keyed by content hash for dedup. |
| 3 | |
| 4 | ( |
| 5 | id UUID PRIMARY KEY DEFAULT gen_random_uuid, |
| 6 | app_id UUID NOT NULL REFERENCES sync_apps(id) ON DELETE CASCADE, |
| 7 | user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, |
| 8 | hash TEXT NOT NULL, |
| 9 | s3_key TEXT NOT NULL, |
| 10 | size_bytes BIGINT NOT NULL, |
| 11 | uploaded_at TIMESTAMPTZ NOT NULL DEFAULT NOW, |
| 12 | UNIQUE(app_id, user_id, hash) |
| 13 | ); |
| 14 | |
| 15 | ON sync_blobs(app_id, user_id, hash); |
| 16 |