db: order ListAllAccounts result by account id.

In preparation for the migration from kvdb to SQL, we update the results
of the ListAllAccounts query. After the migration has been implemented,
we will test that the result off all accounts in the SQL database
is the same as the result of the fetching all accounts in the kvdb.

By ordering the SQL query's result by account id, we ensure that all
accounts are returned in the same order as they are returned by the
kvdb.
This commit is contained in:
Viktor Tigerström 2025-05-15 17:03:22 +02:00
parent 92689c546c
commit 6030f650fd
No known key found for this signature in database
GPG key ID: B984570980684DCC
2 changed files with 3 additions and 1 deletions

View file

@ -261,6 +261,7 @@ func (q *Queries) ListAccountPayments(ctx context.Context, accountID int64) ([]A
const listAllAccounts = `-- name: ListAllAccounts :many
SELECT id, alias, label, type, initial_balance_msat, current_balance_msat, last_updated, expiration
FROM accounts
ORDER BY id
`
func (q *Queries) ListAllAccounts(ctx context.Context) ([]Account, error) {

View file

@ -62,7 +62,8 @@ WHERE id = $1;
-- name: ListAllAccounts :many
SELECT *
FROM accounts;
FROM accounts
ORDER BY id;
-- name: ListAccountPayments :many
SELECT *