Comparison

tools/migration/prosody-migrator.lua @ 10004:e057e8318130

migrator: Add support for archives (fixes #651)
author Kim Alvefur <zash@zash.se>
date Sun, 05 May 2019 21:31:15 +0200
parent 10003:4d702f0c6273
child 11728:826d57c16d1c
comparison
equal deleted inserted replaced
10003:4d702f0c6273 10004:e057e8318130
172 for user in users(origin, host) do 172 for user in users(origin, host) do
173 if typ == "keyval" then 173 if typ == "keyval" then
174 local data, err = origin:get(user); 174 local data, err = origin:get(user);
175 assert(not err, err); 175 assert(not err, err);
176 assert(destination:set(user, data)); 176 assert(destination:set(user, data));
177 elseif typ == "archive" then
178 local iter, err = origin:find(user);
179 assert(iter, err);
180 for id, item, when, with in iter do
181 assert(destination:append(user, id, item, when, with));
182 end
177 else 183 else
178 error("Don't know how to migrate data of type '"..typ.."'."); 184 error("Don't know how to migrate data of type '"..typ.."'.");
179 end 185 end
180 end 186 end
181 end 187 end