diff options
author | Kim Alvefur <zash@zash.se> | 2025-03-19 16:13:32 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2025-03-19 16:13:32 +0100 |
commit | eacf72504cec9122f6134e920c08c7c1cb22ecf5 (patch) | |
tree | 4d46b1f588a56dc49c96a2cefd6562b9f6bad683 | |
parent | 3d74ce85841c461d67c54f4dcc8cac6db87ff623 (diff) | |
download | prosody-eacf72504cec9122f6134e920c08c7c1cb22ecf5.tar.gz prosody-eacf72504cec9122f6134e920c08c7c1cb22ecf5.zip |
mod_storage_sql: Fix indentation
Off-by-one in autoindent after `if not success then` since 3ec48555b773
-rw-r--r-- | plugins/mod_storage_sql.lua | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua index ff44adba..5f80fad7 100644 --- a/plugins/mod_storage_sql.lua +++ b/plugins/mod_storage_sql.lua @@ -866,38 +866,38 @@ local function upgrade_table(engine, params, apply_changes) -- luacheck: ignore success,err = engine:transaction(function() return engine:execute(check_encoding_query, params.database, engine.charset, engine.charset.."_bin"); - end); - if not success then - module:log("error", "Failed to check/upgrade database encoding: %s", err or "unknown error"); - return false; - end - else - local indices = {}; - engine:transaction(function () - if params.driver == "SQLite3" then - for row in engine:select [[SELECT "name" FROM "sqlite_schema" WHERE "type"='index' AND "tbl_name"='prosody' AND "name"='prosody_index';]] do - indices[row[1]] = true; - end - elseif params.driver == "PostgreSQL" then - for row in engine:select [[SELECT "indexname" FROM "pg_indexes" WHERE "tablename"='prosody' AND "indexname"='prosody_index';]] do - indices[row[1]] = true; - end + end); + if not success then + module:log("error", "Failed to check/upgrade database encoding: %s", err or "unknown error"); + return false; + end + else + local indices = {}; + engine:transaction(function () + if params.driver == "SQLite3" then + for row in engine:select [[SELECT "name" FROM "sqlite_schema" WHERE "type"='index' AND "tbl_name"='prosody' AND "name"='prosody_index';]] do + indices[row[1]] = true; 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; + elseif params.driver == "PostgreSQL" then + for row in engine:select [[SELECT "indexname" FROM "pg_indexes" WHERE "tablename"='prosody' AND "indexname"='prosody_index';]] do + indices[row[1]] = true; end 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; + end end + end return changes; end |