|
50 | 50 | FROM
|
51 | 51 | aibridge_token_usagesWHERE interception_id= @interception_id::uuid
|
52 | 52 | ORDER BY
|
53 |
| -created_atDESC, |
54 |
| -idDESC; |
| 53 | +created_atASC, |
| 54 | +idASC; |
55 | 55 |
|
56 | 56 | -- name: GetAIBridgeUserPromptsByInterceptionID :many
|
57 | 57 | SELECT
|
|
61 | 61 | WHERE
|
62 | 62 | interception_id= @interception_id::uuid
|
63 | 63 | ORDER BY
|
64 |
| -created_atDESC, |
65 |
| -idDESC; |
| 64 | +created_atASC, |
| 65 | +idASC; |
66 | 66 |
|
67 | 67 | -- name: GetAIBridgeToolUsagesByInterceptionID :many
|
68 | 68 | SELECT
|
|
72 | 72 | WHERE
|
73 | 73 | interception_id= @interception_id::uuid
|
74 | 74 | ORDER BY
|
75 |
| -created_atDESC, |
76 |
| -idDESC; |
| 75 | +created_atASC, |
| 76 | +idASC; |
77 | 77 |
|
78 | 78 | -- name: ListAIBridgeInterceptions :many
|
79 | 79 | SELECT
|
@@ -111,6 +111,9 @@ WHERE
|
111 | 111 | -- The pagination cursor is the last ID of the previous page.
|
112 | 112 | -- The query is ordered by the started_at field, so select all
|
113 | 113 | -- rows before the cursor and before the after_id UUID.
|
| 114 | +-- This uses a less than operator because we're sorting DESC. The |
| 115 | +-- "after_id" terminology comes from our pagination parser in |
| 116 | +-- coderd. |
114 | 117 | (aibridge_interceptions.started_at,aibridge_interceptions.id)< (
|
115 | 118 | (SELECT started_atFROM aibridge_interceptionsWHERE id= @after_id),
|
116 | 119 | @after_id::uuid
|
|