Document SQL debugging for (app) devs

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst
2021-12-13 14:46:02 +01:00
parent 51a3a799e4
commit 7dd3e09e7d

View File

@@ -85,6 +85,31 @@ Debugging HTML and templates
By default Nextcloud caches HTML generated by templates. This may prevent changes to app templates, for example, from being applied on page refresh. To disable caching, see Debug mode.
Debugging SQL queries
---------------------
When encountering database errors during queries or migrations, it can be helpful to get a full query log.
Debugging MariaDB queries
~~~~~~~~~~~~~~~~~~~~~~~~~
MariaDB can log all queries to a file or a table.
.. code-block :: sql
SET GLOBAL general_log = 'ON';
SET GLOBAL log_output = 'table';
These global settings will enable the log on the fly. No database restart is required.
.. code-block :: sql
SELECT * FROM mysql.general_log
This queries all the logged queries.
.. Note:: On :ref:`continuous integration<app-ci>` this trick can give you the SQLs of various types and versions of a database quite easily in case you have to debug a matrix of setups.
Using alternative app directories
---------------------------------