mod_storage_sql: Drop legacy index without confirmation to ease upgrades

Deleting one index should be safe enough to do without requiring a
explicitly upgrading during downtime. People had trouble with this.
This commit is contained in:
Kim Alvefur 2025-03-23 12:15:16 +01:00
parent 6959547703
commit b9d4cc24df

View file

@ -885,16 +885,12 @@ local function upgrade_table(engine, params, apply_changes) -- luacheck: ignore
end
end)
if indices["prosody_index"] then
if apply_changes then
local success = engine:transaction(function ()
return assert(engine:execute([[DROP INDEX "prosody_index";]]));
end);
if not success then
module:log("error", "Failed to delete obsolete index \"prosody_index\"");
return false;
end
else
changes = true;
local success = engine:transaction(function ()
return assert(engine:execute([[DROP INDEX "prosody_index";]]));
end);
if not success then
module:log("error", "Failed to delete obsolete index \"prosody_index\"");
return false;
end
end
end