CodeChain-io / CodeChain-io/codechain-indexer

Make the AggsUTXOs table migration script insert rows that have 0 quantity value

Ouverte
#357 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
21
Forks
15
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

Here is the AggsUTXOs table's migration script.

```
INSERT INTO "AggsUTXOs"("assetType", "address", "totalAssetQuantity", "utxoQuantity", "createdAt", "updatedAt")
SELECT "assetType", "address", SUM("quantity") as "totalAssetQuantity", COUNT(*) as "utxoQuantity", NOW(), NOW()
FROM "UTXOs" WHERE "usedBlockNumber" IS NULL GROUP BY "assetType", "address"
```

To ignore used UTXOs, the migration script filters the used UTXOs using the where clause. If a user sent all assets they have to another user, the quantity column value of the AggsUTXOs table's row will be zero. The migration script above does not insert the row that has the zero value in the quantity column.

This behavior is subtle. And can be ignored.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

The migration file containing the shown AggsUTXOs INSERT is the starting point; inspect how the WHERE clause and aggregation handle zero-quantity data. Update the migration so the relevant zero-quantity AggsUTXOs row is inserted, then verify it with data matching the reported case.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
sql, typescript
Domaine
databases
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.