Skip to content
Snippets Groups Projects
Commit 6f599fdb authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

fix database update

parent 8fce1352
No related branches found
No related tags found
No related merge requests found
......@@ -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
```
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment