From 287ba0d6b17ed51a56308c7a163288d7619075dd Mon Sep 17 00:00:00 2001 From: gilesb Date: Thu, 8 Jan 2026 23:37:44 +0000 Subject: [PATCH] Add ipfs_cid to all asset SELECT queries The ipfs_cid column was being stored but not retrieved in queries, causing the UI to show "Not on IPFS" even when the data exists. Co-Authored-By: Claude Opus 4.5 --- db.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db.py b/db.py index 886cbc7..9131dc5 100644 --- a/db.py +++ b/db.py @@ -185,7 +185,7 @@ async def get_asset(name: str) -> Optional[dict]: """Get asset by name.""" async with get_connection() as conn: row = await conn.fetchrow( - """SELECT name, content_hash, asset_type, tags, metadata, url, + """SELECT name, content_hash, ipfs_cid, asset_type, tags, metadata, url, provenance, description, origin, owner, created_at, updated_at FROM assets WHERE name = $1""", name @@ -199,7 +199,7 @@ async def get_asset_by_hash(content_hash: str) -> Optional[dict]: """Get asset by content hash.""" async with get_connection() as conn: row = await conn.fetchrow( - """SELECT name, content_hash, asset_type, tags, metadata, url, + """SELECT name, content_hash, ipfs_cid, asset_type, tags, metadata, url, provenance, description, origin, owner, created_at, updated_at FROM assets WHERE content_hash = $1""", content_hash @@ -213,7 +213,7 @@ async def get_all_assets() -> dict[str, dict]: """Get all assets as a dict indexed by name.""" async with get_connection() as conn: rows = await conn.fetch( - """SELECT name, content_hash, asset_type, tags, metadata, url, + """SELECT name, content_hash, ipfs_cid, asset_type, tags, metadata, url, provenance, description, origin, owner, created_at, updated_at FROM assets ORDER BY created_at DESC""" ) @@ -225,7 +225,7 @@ async def get_assets_paginated(limit: int = 100, offset: int = 0) -> tuple[list[ async with get_connection() as conn: total = await conn.fetchval("SELECT COUNT(*) FROM assets") rows = await conn.fetch( - """SELECT name, content_hash, asset_type, tags, metadata, url, + """SELECT name, content_hash, ipfs_cid, asset_type, tags, metadata, url, provenance, description, origin, owner, created_at, updated_at FROM assets ORDER BY created_at DESC LIMIT $1 OFFSET $2""", limit, offset @@ -237,7 +237,7 @@ async def get_assets_by_owner(owner: str) -> dict[str, dict]: """Get all assets owned by a user.""" async with get_connection() as conn: rows = await conn.fetch( - """SELECT name, content_hash, asset_type, tags, metadata, url, + """SELECT name, content_hash, ipfs_cid, asset_type, tags, metadata, url, provenance, description, origin, owner, created_at, updated_at FROM assets WHERE owner = $1 ORDER BY created_at DESC""", owner