Add database migration for content_hash -> cid rename

- Add DO block to migrate existing columns:
  - cache_items.content_hash -> cid
  - item_types.content_hash -> cid
  - l2_shares.content_hash -> cid
  - storage_pins.content_hash -> cid
  - run_cache.output_hash -> output_cid
- Fix duplicate key bug in upload response

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-12 08:18:23 +00:00
parent 92d26b2b72
commit faa54b2e85
2 changed files with 21 additions and 2 deletions

View File

@@ -221,8 +221,8 @@ async def upload_content(
raise HTTPException(400, error)
return {
"cid": ipfs_cid,
"cid": cid, # Legacy, for backwards compatibility
"cid": ipfs_cid or cid,
"content_hash": cid, # Legacy, for backwards compatibility
"filename": file.filename,
"size": len(content),
"uploaded": True,