CodeChain-io / CodeChain-io/codechain-indexer
Make the AggsUTXOs table migration script insert rows that have 0 quantity value
- Lenguaje dominante
- TypeScript
- Estrellas
- 21
- Forks
- 15
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
El archivo de migración que contiene el AggsUTXOs INSERT mostrado es el punto de partida; inspecciona cómo la cláusula WHERE y la agregación manejan los datos con cantidad cero. Actualiza la migración para que se inserte la fila relevante de AggsUTXOs con cantidad cero y, después, verifícalo con datos que coincidan con el caso reportado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- sql, typescript
- Área
- databases
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100