changeset 13920:2169be3581ae 13.0

migrator: Allow migrating between different configs of the same driver This was notably a problem with SQL since mod_storage_sql is a single module that connects to different SQL databases. The problem was that since it was already loaded once, the output configuration was not applied and it would have migrated to the origin database. This essentially reloads the module after updating the configuration, which should work with all storage modules as long as everything they need are kept in the 'provider' or driver table.
author Kim Alvefur <zash@zash.se>
date Sun, 03 Aug 2025 15:14:20 +0200
parents f0d854c63c8d
children 33755e085ca5 e6087c733899
files tools/migration/prosody-migrator.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/migration/prosody-migrator.lua	Sun Jul 27 01:08:14 2025 +0200
+++ b/tools/migration/prosody-migrator.lua	Sun Aug 03 15:14:20 2025 +0200
@@ -149,6 +149,7 @@
 
 local cm = require "prosody.core.configmanager";
 local hm = require "prosody.core.hostmanager";
+local mm = require "prosody.core.modulemanager";
 local sm = require "prosody.core.storagemanager";
 local um = require "prosody.core.usermanager";
 
@@ -177,6 +178,7 @@
 
 local function get_driver(host, conf)
 	prepare_config(host, conf);
+	mm.unload(host, "storage_" .. conf.type);
 	return assert(sm.load_driver(host, conf.type));
 end