Skip to content

Commit bf21a32

Browse files
majectyjoojis
authored andcommitted
Fix AggsUTXO migration query
Used UTXOs should not aggregated.
1 parent 02e9026 commit bf21a32

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/migrations/20191115032739-add-aggs-utxo-table.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ module.exports = {
9090
`);
9191

9292
await queryInterface.sequelize.query(`
93-
INSERT INTO "AggsUTXOs"("assetType", "address", "totalAssetQuantity", "utxoQuantity", "createdAt", "updatedAt") SELECT "assetType", "address", SUM("quantity") as "totalAssetQuantity", COUNT(*) as "utxoQuantity", NOW(), NOW() FROM "UTXOs" GROUP BY "assetType", "address"
93+
INSERT INTO "AggsUTXOs"("assetType", "address", "totalAssetQuantity", "utxoQuantity", "createdAt", "updatedAt")
94+
SELECT "assetType", "address", SUM("quantity") as "totalAssetQuantity", COUNT(*) as "utxoQuantity", NOW(), NOW()
95+
FROM "UTXOs" WHERE "usedBlockNumber" IS NULL GROUP BY "assetType", "address"
9496
`);
9597
},
9698

0 commit comments

Comments
 (0)