CodeChain-io / CodeChain-io/codechain-indexer

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

Offen
#357 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
21
Forks
15
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.