From 062468c5ef50d485517331b0416d99b0a6b9722a Mon Sep 17 00:00:00 2001 From: shum Date: Thu, 22 Oct 2026 03:19:45 +0000 Subject: [PATCH] store: read unpaid invoices in one order --- apps/simplex-store-service/src/StoreService/Store/Invoices.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/simplex-store-service/src/StoreService/Store/Invoices.hs b/apps/simplex-store-service/src/StoreService/Store/Invoices.hs index fcfff1da0e..5c22726358 100644 --- a/apps/simplex-store-service/src/StoreService/Store/Invoices.hs +++ b/apps/simplex-store-service/src/StoreService/Store/Invoices.hs @@ -227,7 +227,8 @@ qUnpaidRefs = <> " FROM @invoices i " <> productJoins <> "WHERE i.status <> 'paid' AND i.created_at >= ? " - <> "ORDER BY i.created_at" + -- created_at is whole seconds; the id breaks ties the same way on SQLite and Postgres + <> "ORDER BY i.created_at, i.invoice_id" qCodeHashExists :: Query qCodeHashExists = mkQuery "SELECT 1 FROM @badge_codes WHERE code_hash = ? LIMIT 1"