Merge pull request #7816 from nextcloud/enhancement/dev-debug-sql

Document SQL debugging for (app) devs
This commit is contained in:
Christoph Wurst
2021-12-13 20:29:38 +01:00
committed by GitHub

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
---------------------------------