From d5ef1722292edf05cef39ab94ac2a83bb1767d60 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Sat, 8 Apr 2023 13:52:41 +0800 Subject: [PATCH] update active record --- api/sqlc/queries/chat_message.sql | 2 +- api/sqlc_queries/chat_message.sql.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/sqlc/queries/chat_message.sql b/api/sqlc/queries/chat_message.sql index 770c905e..277401b1 100644 --- a/api/sqlc/queries/chat_message.sql +++ b/api/sqlc/queries/chat_message.sql @@ -113,7 +113,7 @@ WHERE uuid = $1 ; -- name: DeleteChatMessagesBySesionUUID :exec UPDATE chat_message SET is_deleted = true, updated_at = now() -WHERE chat_session_uuid = $1; +WHERE is_deleted = false and chat_session_uuid = $1; -- name: GetChatMessagesCount :one diff --git a/api/sqlc_queries/chat_message.sql.go b/api/sqlc_queries/chat_message.sql.go index f2b24137..a5264d9c 100644 --- a/api/sqlc_queries/chat_message.sql.go +++ b/api/sqlc_queries/chat_message.sql.go @@ -85,7 +85,7 @@ func (q *Queries) DeleteChatMessageByUUID(ctx context.Context, uuid string) erro const deleteChatMessagesBySesionUUID = `-- name: DeleteChatMessagesBySesionUUID :exec UPDATE chat_message SET is_deleted = true, updated_at = now() -WHERE chat_session_uuid = $1 +WHERE is_deleted = false and chat_session_uuid = $1 ` func (q *Queries) DeleteChatMessagesBySesionUUID(ctx context.Context, chatSessionUuid string) error {