CodeChain-io / CodeChain-io/codechain-indexer

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

Đang mở
#357 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
21
Fork
15
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Tệp migration chứa AggsUTXOs INSERT được nêu là điểm bắt đầu; hãy kiểm tra cách mệnh đề WHERE và phép tổng hợp xử lý dữ liệu có số lượng bằng 0. Cập nhật migration để chèn hàng AggsUTXOs có số lượng bằng 0 tương ứng, sau đó xác minh bằng dữ liệu khớp với trường hợp được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
sql, typescript
Lĩnh vực
databases
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.