Skip to content

Commit 6030f65

Browse files
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.
1 parent 92689c5 commit 6030f65

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

db/sqlc/accounts.sql.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

db/sqlc/queries/accounts.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ WHERE id = $1;
6262

6363
-- name: ListAllAccounts :many
6464
SELECT *
65-
FROM accounts;
65+
FROM accounts
66+
ORDER BY id;
6667

6768
-- name: ListAccountPayments :many
6869
SELECT *

0 commit comments

Comments
 (0)