ceramicnetwork / ceramicnetwork/js-ceramic

`ModelInstanceDocument doc.replace`, there are some fields that are not updated in db table

Open
#2,499 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
423
Forks
126
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
``` javascript
const doc = await ModelInstanceDocument.create(ceramic, CONTENT0, midMetadata)
await doc.replace(CONTENT1)
```
but in postgress ,the db table only updates 2 fields(last_anchored_at&updated_at) when doc updated, CONTENT1 data is not updated to table,maybe other fields should be updated as well

https://github.com/ceramicnetwork/js-ceramic/blame/33e3c0969c0161d5dc17b55501775385241066be/packages/core/src/indexing/postgres/postgres-index-api.ts#L57

**Screenshots**
If applicable, add screenshots to help explain your problem.
![image](https://user-images.githubusercontent.com/29918052/196404550-c6c096dc-c237-48d1-b15b-ff43566f7246.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in packages/core/src/indexing/postgres/postgres-index-api.ts around line 57 and reproduce the ModelInstanceDocument.create and doc.replace sequence shown in the issue. Compare the database row before and after replacement to determine which document fields remain unchanged; done means the expected CONTENT1 data and relevant updated fields are persisted in PostgreSQL.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, typescript
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.