fix(GRO-981): restore journal entries and add DESC to indexes

- _journal.json: restore idx 28 (0028_sms_reminders), add idx 29
  (0029_db_indexes_constraints), renumber 0030_messaging to idx 30
  (was missing 0028 and 0029 entries — they were silently skipped)
- schema.ts: add .desc() to conversations.lastMessageAt and
  messages.createdAt indexes per spec
- 0030_messaging.sql: add DESC to both generated index statements

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-05-04 02:16:25 +00:00
committed by Flea Flicker [agent]
parent 5e103a378c
commit 2e24c371c3
3 changed files with 21 additions and 4 deletions
+5 -2
View File
@@ -448,7 +448,7 @@ export const conversations = pgTable(
(t) => [
index("idx_conversations_business_id_last_message_at").on(
t.businessId,
t.lastMessageAt
t.lastMessageAt.desc()
),
unique("uq_conversations_business_client_number").on(
t.businessId,
@@ -479,7 +479,10 @@ export const messages = pgTable(
readByClientAt: timestamp("read_by_client_at"),
},
(t) => [
index("idx_messages_conversation_id_created_at").on(t.conversationId, t.createdAt),
index("idx_messages_conversation_id_created_at").on(
t.conversationId,
t.createdAt.desc()
),
unique("uq_messages_provider_message_id").on(t.providerMessageId),
]
);