Skip to content

Commit 3d8746e

Browse files
committed
rollback message_id
1 parent dd38c46 commit 3d8746e

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

scripts/db.sql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ CREATE TABLE IF NOT EXISTS raw_chat_log
131131
(
132132
chat_id BIGINT NOT NULL,
133133
user_id BIGINT NOT NULL,
134-
msg_id BIGINT,
135134
message VARCHAR(30000),
136135
raw_update JSON NOT NULL,
137136
date TIMESTAMP DEFAULT NOW() NOT NULL,

src/main/kotlin/dev/storozhenko/familybot/feature/logging/RawUpdateLogger.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ class RawUpdateLogger(private val rawChatLogRepository: RawChatLogRepository) {
3434
?.let { Instant.ofEpochSecond(it) }
3535
?: Instant.now()
3636

37-
val messageId = rawMessage.messageId.toLong()
3837

39-
rawChatLogRepository.add(update.toChat(), update.toUser(), text, messageId, fileId, update.toJson(), date)
38+
rawChatLogRepository.add(update.toChat(), update.toUser(), text, fileId, update.toJson(), date)
4039
}
4140
}

src/main/kotlin/dev/storozhenko/familybot/feature/logging/repos/RawChatLogRepository.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ class RawChatLogRepository(private val template: JdbcTemplate) {
2121
)
2222
}
2323

24-
fun add(chat: Chat, user: User, message: String?, messageId: Long, fileId: String?, rawUpdate: String, date: Instant) {
24+
fun add(chat: Chat, user: User, message: String?, fileId: String?, rawUpdate: String, date: Instant) {
2525
template.update(
26-
"INSERT INTO raw_chat_log (chat_id, user_id, msg_id, message, raw_update, date, file_id) VALUES (?, ?, ?, ?, ?::JSON, ?, ?)",
26+
"INSERT INTO raw_chat_log (chat_id, user_id, message, raw_update, date, file_id) VALUES (?, ?, ?, ?::JSON, ?, ?)",
2727
chat.id,
2828
user.id,
29-
messageId,
3029
message,
3130
rawUpdate,
3231
Timestamp.from(date),

0 commit comments

Comments
 (0)