Admin user can execute SQL direct to the database. To do so click on the SQL link in the admin area.
Warning: direct database manipulation is dangerous and can result in data loss and/or an unusable application!
Before using this feature you should:
- Make a backup of the database (admin/export SQL) and download it in case you lose data or crash the application.
- Test the SQL you want to execute on a local version first. You can build a database with the backup).
If there is no recent backup (maximal one day old) on the server, the SQL function is not available.
Keep in mind:
- It's an experimental but very powerful feature. Unlike the rest of the application there are no safeguards to prevent e.g. total data loss and/or making the application unusable.
- If data is lost and/or the application crashes it can be fixed only with server and database access. Depending on the situation fixing the problem, even if it is possible, could take some time.
- A transaction (BEGIN, COMMIT) is automatically build around your statement, so don't use it in your statement.
- Don't refresh the page (e.g pressing F5) because this will execute the statement again.
- You can use multiple statements (every single one has to have a ";" at the end) but only the results of the last one (if successful) will be displayed.
After clicking on Execute the SQL in the input field will be executed and the result (of the last query) are shown below:
- Error - if there was an error there is nothing to worry about because the transaction executes the statement(s) only if there is no error. The error message from the database is displayed below the input field.
- SELECT - if you execute a select statement you will see the row count and the (not very readable) result below the input field.
- Other - if you execute a manipulative statement (DELETE, UPDATE, ...) you will see the affected row count below.