aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_storage_sql.lua
Commit message (Collapse)AuthorAgeFilesLines
* mod_storage_sql: Fix column name in index check for PostgreSQLKim Alvefur2023-06-171-1/+1
| | | | Forgot to change the column name in 9a7523ea45cb
* mod_storage_sql: Adjust indentation to align with surrounding codeKim Alvefur2023-06-171-3/+3
|
* mod_storage_sql: Only remove old index if it existsKim Alvefur2023-06-171-9/+11
| | | | Avoids an error if the upgrade is performed twice..
* mod_storage_sql: Be more specific when checking for old index in SQLite3Kim Alvefur2023-06-171-1/+1
| | | | | Prevents false positives in the odd case where something other than an index with this name might exist.
* mod_storage_sql: Improve check for old table index on PostgreSQLKim Alvefur2023-06-161-1/+1
| | | | The "pg_indexes" view is much simpler to inspect than "pg_class"
* mod_storage_sql: Enable UPSERT with PostgreSQLKim Alvefur2023-06-161-1/+1
| | | | Tested. Works.
* mod_storage_sql: Add some TODO comments for future UPSERT workKim Alvefur2023-06-111-0/+2
|
* mod_storage_sql: Do not keep track of quota when no quota is setKim Alvefur2023-06-111-20/+29
| | | | | | | | | No point in doing this expensive O(n) query if the result is not used for anything. Will still cache the total item count if an explicit query for this is performed, then try to keep it updated with new items added. Will likely forget eventually tho.
* mod_storage_sql: Add setting to tune SQLite3 performance vs safetyKim Alvefur2023-06-111-0/+38
| | | | | Notably the default journal_mode of DELETE is somewhat slow, some users might want to catch up to the amazing performance of internal storage.
* mod_storage_sql: Record all SQLite3 compile options for potential useKim Alvefur2023-06-101-4/+6
| | | | | Knowing what features are available could be useful for future experiments. For example, with the JSON module or full text search.
* mod_storage_sql: Compose a keyval+ store out of keyval and map store methodsKim Alvefur2023-06-101-0/+17
| | | | | | | Removes the need for the shim in storagemanager. The methods only really access the 'store' property of the first (self) argument, so this is safe.
* mod_storage_sql: Add UPSERT supportKim Alvefur2023-06-101-7/+41
| | | | | | | Currently limited to SQLite3 for lack of testing on other databases. Adds a migration to replace the non-UNIQUE prosody_index, renaming it prosody_unique_index since ALTER INDEX does not seem to be portable.
* plugins: Prefix module imports with prosody namespaceKim Alvefur2023-03-241-13/+13
|
* mod_storage_sql: Remove module status on unknown 'debug' levelKim Alvefur2023-01-311-1/+0
| | | | | Expected this to be translated to 'core', but it logs an error instead. See previous commit.
* mod_storage_sql: Silence luacheck warningKim Alvefur2023-01-301-1/+1
|
* mod_storage_sql: Record connection to database as module statusKim Alvefur2023-01-301-0/+6
| | | | | | Allows retrieving this in e.g. a health reporting module Thanks pfak
* mod_storage_sql: Support SQLite3 without LuaDBIKim Alvefur2023-01-191-1/+8
|
* Merge 0.12->trunkKim Alvefur2023-01-061-14/+12
|\
| * mod_storage_sql: Fix #1639Kim Alvefur2023-01-011-14/+12
| | | | | | | | Patch by Peter Kieser
* | Merge 0.12->trunkKim Alvefur2022-12-291-1/+0
|\|
| * mod_storage_sql: Don't avoid initialization under prosodyctl (fix #1787)Kim Alvefur2022-12-291-1/+0
| | | | | | | | | | | | | | | | | | Fixes `prosodyctl adduser` etc. Prior to d580e6a57cbb the line did nothing. Sometimes storage in the prosodyctl context does cause weirdness, as it is not in a host context, but rather a variant of global.
* | mod_storage_sql: Strip timestamp precision in queries to fix error (thanks ↵Kim Alvefur2022-09-071-2/+2
| | | | | | | | | | | | | | | | | | muppeth) Fixes Error in SQL transaction: Error executing statement parameters: ERROR: invalid input syntax for integer This was handled for INSERT in 9524bb7f3944 but not SELECT.
* | mod_storage_sql: Drop archive timestamp precision pending schema updateKim Alvefur2022-08-141-1/+2
| | | | | | | | | | | | The "when" column is an INTEGER which will probably be unhappy about storing higher precision timestamps, so we keep the older behavior for now.
* | Merge 0.12->trunkKim Alvefur2022-07-291-4/+2
|\|
| * mod_storage_sql: Fix summary API with Postgres (fixes #1766)Kim Alvefur2022-07-221-4/+2
| | | | | | | | | | | | | | The ORDER BY and LIMIT clauses are not needed and don't even make much sense. This part was most likely a leftover from the :find method. Tested with sqlite and postgres 14
* | Merge 0.12->trunkKim Alvefur2022-07-271-1/+1
|\|
| * mod_storage_sql: Fix bypass of load procedure under prosodyctlKim Alvefur2022-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | There's no 'prosody.prosodyctl' property other than this one, introduced in 6216743c188c in 2015. Guessing that the intent was to skip this when running as a prosodyctl command. The module.command code does its own version of this initialization, so this seems likely. Thanks raja for noticing
* | compat: Remove handling of Lua 5.1 location of 'unpack' functionKim Alvefur2022-07-111-1/+1
| |
* | mod_storage_sql: Remove Lua 5.1 compatibility hackKim Alvefur2022-07-021-2/+1
|/ | | | Part of #1600
* mod_storage_sql: Return cached total where it makes senseKim Alvefur2021-11-301-4/+9
| | | | | This should skip the summary SQL query when not needed, ie when the cached value can be used directly.
* mod_storage_sql: Adjust handling of 'total' for multi-id queriesKim Alvefur2021-11-301-2/+3
| | | | | Otherwise a query for a set of ids may cause that value to be cached, despite only covering a subset.
* mod_storage_sql: Fix traceback on multi-user deletionKim Alvefur2021-11-301-2/+6
| | | | | | | jid.join(true, ...) fails. Since we don't know which users this affects, best to clear the whole cache.
* mod_storage_sql: Expose multi-user deletion capabilityKim Alvefur2021-11-301-0/+1
| | | | | archive_store:delete(true) deletes messages for all users, which would allow some simplification when this is supported.
* mod_storage_sql: Fix for move of yes/no function (Thanks Kasim)Kim Alvefur2021-06-211-2/+2
|
* mod_storage_sql: Implement map-like API for archivesKim Alvefur2021-02-011-0/+47
| | | | | | | | Used by mod_http_file_share, muc moderation, etc. Tests tweaked because they failed on stanza internals that happen becasue of re-serialization. Namespaces differ since inheritance is implicit when building but explicit after parsing.
* mod_storage_sql: Fix compatibilty with Lua 5.1Kim Alvefur2021-01-131-1/+2
| | | | | | string.rep() doesn't have the 3rd argument before Lua 5.2 Revert once we drop support for Lua 5.1
* mod_storage_sql: Support query for set of IDsKim Alvefur2021-01-121-0/+10
| | | | Not compatible with Lua 5.1
* mod_storage_sql: Advertise support for id range queryKim Alvefur2021-01-091-0/+1
| | | | That is, a query for items between two IDs (not inclusive).
* mod_storage_sql: Measure hits/misses on the item count cacheKim Alvefur2020-07-021-0/+7
| | | | | A cache miss can be expensive so having numbers on how often this occurs may be valuable.
* mod_storage_sql: Fix incorrect results when fetching items before specific ↵Matthew Wild2020-06-121-1/+1
| | | | | | archive id Copy/paste error, introduced in deb68066c7aa
* mod_storage_sql: Log database connection parameters when creating engineKim Alvefur2020-05-021-2/+3
| | | | | | This is meant to help trace down an issue where Prosody apparently creates multiple conflicting SQL engines, causing problems especially with SQLite3, e.g. #616 #784.
* Merge 0.11->trunkKim Alvefur2020-03-221-0/+1
|\
| * mod_storage_sql: Add index covering sort_id to improve performance (fixes #1505)Kim Alvefur2020-03-221-0/+1
| |
* | storagemanager, mod_storage_sql: Rename methods to :get_all() and :delete_all()Matthew Wild2020-03-111-4/+4
| |
* | mod_storage_sql: Add map_store:find_key() and map_store:delete_key() (+ tests)Matthew Wild2020-03-111-0/+44
| |
* | Merge 0.11->trunkKim Alvefur2020-02-221-6/+6
|\|
| * mod_storage_sql: Move update limit check back one step, fixes tracebackKim Alvefur2020-02-221-6/+6
| | | | | | | | | | 0c00274528a4 moved it one step too far, so the check was performed before connecting to the database instead of after.
* | Merge 0.11->trunkKim Alvefur2020-02-211-7/+7
|\|
| * mod_storage_sql: Fix check for deletion limits (fixes #1494)Kim Alvefur2020-02-211-7/+7
| | | | | | | | | | The check was only performed if sql_manage_tables was set to true (the default) It should always be performed
* | mod_storage_sql: Remove unused and not actually returned return value [luacheck]Kim Alvefur2019-12-241-1/+1
| | | | | | | | The :delete throws an error, it does not return one like this.