Skip to content

Commit

Permalink
Properly convert last_active during migration of UserTable
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzmbrzl committed Nov 19, 2023
1 parent 05abcdd commit 8b3624a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/murmur/database/UserTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,15 +697,15 @@ 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 << ", "
<< column::kdf_iterations << ", " << column::last_channel_id << ", " << column::texture
<< ", " << 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",
Expand Down

0 comments on commit 8b3624a

Please sign in to comment.