Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
majecty opened this issue Nov 22, 2019 · 0 comments

Comments

@majecty
Copy link
Contributor

majecty commented Nov 22, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant