fix(guides) : make ordering predictable
CI / Verify (push) Successful in 1m23s
CI / Build immutable images and deploy (push) Successful in 1m49s

This commit is contained in:
2026-09-09 23:40:30 +07:00 Unverified
parent 289c17808f
commit 00f59e6e85
4 changed files with 25 additions and 5 deletions
+8
View File
@@ -0,0 +1,8 @@
WITH ranked_guides AS (
SELECT "id", (row_number() OVER (ORDER BY "created_at", "id") * 10)::integer AS "sort_order"
FROM "guides"."guide"
)
UPDATE "guides"."guide" AS "guide"
SET "sort_order" = ranked_guides."sort_order"
FROM ranked_guides
WHERE "guide"."id" = ranked_guides."id";