diff --git a/README.md b/README.md index 3f6b03cbf75a6fbc3ccdd2d7aec4de791e71a1dc..90eae605975438d1dff2a89bd2309bcdd8723890 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ time npx tsx src/scripts/cesium-plus-import.ts To start pubsub collector to IPFS and database indexer ```sh +docker compose up -d npx tsx src/indexer/start.ts ``` diff --git a/src/indexer/database.ts b/src/indexer/database.ts index d8e3d33953f817f9a251ca613605f3748cc1cef2..39c81eaef4ad93331d990f9fd0b3280518ccf58d 100644 --- a/src/indexer/database.ts +++ b/src/indexer/database.ts @@ -54,18 +54,23 @@ export async function setLatestIndexedCID(cid: CID) { } // cesium plus profile query and param builder +// completely overwrites previous data const cesiumPlusProfile: QueryBuilder = { query: `INSERT INTO profiles(index_request_cid, time, pubkey, data_cid, title, description, avatar, geoloc, city, socials) VALUES ($1, $2, $3, $4, $5, $6, $7, point($8, $9), $10, $11) ON CONFLICT (pubkey) DO UPDATE SET - title = COALESCE(EXCLUDED.title, profiles.title), - description = COALESCE(EXCLUDED.description, profiles.description), - avatar = COALESCE(EXCLUDED.avatar, profiles.avatar), - geoloc = COALESCE(EXCLUDED.geoloc, profiles.geoloc), - city = COALESCE(EXCLUDED.city, profiles.city), - socials = COALESCE(EXCLUDED.socials, profiles.socials); + index_request_cid = EXCLUDED.index_request_cid, + time = EXCLUDED.time, + pubkey = EXCLUDED.pubkey, + data_cid = EXCLUDED.data_cid, + title = EXCLUDED.title, + description = EXCLUDED.description, + avatar = EXCLUDED.avatar, + geoloc = EXCLUDED.geoloc, + city = EXCLUDED.city, + socials = EXCLUDED.socials; `, paramBuilder: (irCID: CID, ir: IndexRequest, dataCID: CID, data: CplusProfile) => [ // $1 index_request_cid