export async function messageEpoch(prisma, chatId) { const [row] = await prisma.$queryRawUnsafe( 'SELECT COALESCE(SUM(epoch), 0)::bigint AS epoch FROM public.chat_message_epochs WHERE chat_id = $1::uuid', chatId, ); return row.epoch; }