mod_migrate: Allow migrating data not attached to any user / nil user
Certain data more related to the server itself is stored with user = nil
--- a/mod_migrate/mod_migrate.lua Tue Jan 26 17:17:36 2021 +0100
+++ b/mod_migrate/mod_migrate.lua Tue Jan 26 17:18:44 2021 +0100
@@ -28,6 +28,7 @@
local function migrate_user(username)
module:log("info", "Migrating %s data for %s", source_store, username);
+ if username == "" then username = nil; end
local data, err = storage:get(username);
if not data and err then
module:log("error", "Could not read data: %s", err);
@@ -42,6 +43,7 @@
if store_type == "archive" then
function migrate_user(username)
module:log("info", "Migrating %s archive items for %s", source_store, username);
+ if username == "" then username = nil; end
local count, errs = 0, 0;
for id, item, when, with in storage:find(username) do
local ok, err = target:append(username, id, item, when, with);