changeset 4398:a16b689525d7

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
author Kim Alvefur <zash@zash.se>
date Tue, 26 Jan 2021 17:18:44 +0100
parents 6e0aa163298f
children 846b7af5588c
files mod_migrate/mod_migrate.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);