From 8b3624af74fc2f5cc1096b927696574d924e3936 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Sun, 19 Nov 2023 17:14:27 +0100 Subject: [PATCH] Properly convert last_active during migration of UserTable --- src/murmur/database/UserTable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/murmur/database/UserTable.cpp b/src/murmur/database/UserTable.cpp index 866a2fd8f42..50e9ff43c67 100644 --- a/src/murmur/database/UserTable.cpp +++ b/src/murmur/database/UserTable.cpp @@ -697,6 +697,7 @@ namespace server { try { if (fromSchemeVersion < 8) { // Before v8 there was no last_disconnect column + std::string lastActiveConversion = mdb::utils::dateToEpoch("last_active", m_backend); m_sql << "INSERT INTO \"" << NAME << "\" (" << column::server_id << ", " << column::user_id << ", " << column::user_name << ", " << column::password_hash << ", " << column::salt << ", " @@ -704,8 +705,7 @@ namespace server { << ", " << column::last_active << ") SELECT server_id, user_id, name, pw, salt, kdfiterations, " << ::mdb::utils::nonNullOf("lastchannel").otherwise("0") << ", texture, " - // TODO: convert date into epoch time - << ::mdb::utils::nonNullOf("last_active").otherwise("0") << " FROM \"users" + << ::mdb::utils::nonNullOf(lastActiveConversion).otherwise("0") << " FROM \"users" << ::mdb::Database::OLD_TABLE_SUFFIX << "\""; } else if (fromSchemeVersion < 10) { // In v10, we renamed columns "name" -> "user_name", "pw" -> "password_hash",