Comparison

plugins/mod_storage_sql.lua @ 13845:2558be2daaca 13.0

mod_storage_sql: Retrieve all indices to see if the new one exists Otherwise it warns about it being missing, even if it exists.
author Kim Alvefur <zash@zash.se>
date Fri, 11 Apr 2025 09:45:04 +0200
parent 13838:a93e7310bfcd
child 13852:ce4b4c2863f3
comparison
equal deleted inserted replaced
13843:87dd8639f08f 13845:2558be2daaca
881 if params.driver == "SQLite3" then 881 if params.driver == "SQLite3" then
882 for row in engine:select [[SELECT "name" FROM "sqlite_schema" WHERE "type"='index' AND "tbl_name"='prosody' AND "name"='prosody_index';]] do 882 for row in engine:select [[SELECT "name" FROM "sqlite_schema" WHERE "type"='index' AND "tbl_name"='prosody' AND "name"='prosody_index';]] do
883 indices[row[1]] = true; 883 indices[row[1]] = true;
884 end 884 end
885 elseif params.driver == "PostgreSQL" then 885 elseif params.driver == "PostgreSQL" then
886 for row in engine:select [[SELECT "indexname" FROM "pg_indexes" WHERE "tablename"='prosody' AND "indexname"='prosody_index';]] do 886 for row in engine:select [[SELECT "indexname" FROM "pg_indexes" WHERE "tablename"='prosody';]] do
887 indices[row[1]] = true; 887 indices[row[1]] = true;
888 end 888 end
889 end 889 end
890 end) 890 end)
891 if indices["prosody_index"] then 891 if indices["prosody_index"] then