Bug 20229: Explicitly list the SQL modes we support
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 16 Feb 2018 15:23:26 +0000 (12:23 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 10 Apr 2018 06:53:40 +0000 (08:53 +0200)
commitf7b67d01fd98927cf34b9699d1ee998382ba269f
tree31e0a3af80e3d50e0f08ca0c17cd877e98b04191
parent2f22ee7576fb76acbae722f41208f52cb1af9ef3
Bug 20229: Explicitly list the SQL modes we support

In our installation procedure we ask the administrator to edit the
MySQL|MariaDB configuration file to specify the SQL modes we support
(see bug 17258 comment 6 and 7 for more information).

We are on the way to catch and fix all these issues and support these
stricter modes (as they highlight problem in our codebase/DB structure)
but in the meanwhile it may be good to remove this step and revert the
changes when we are ready.

TODO:
- Remove that for dev installations (to let developers catch these bugs)
- Edit the wiki page to remove this step

Test plan:
0. Do not apply this patch
1. Edit your MySQL|MariaDB config and add:
sql-mode = "ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
to the [mysqld] section (or edit it)
2. Restart your DBMS
3. Try to make the app explode (watch the logs)
(tips: you should get "'koha_kohadev.me.id' isn't in GROUP BY" when
editing an order)
4. Apply the patch, restart_all, restart your DBMS
5. Try to recreate the failure
=> You should no longer see the error in the logs

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 4dfdf061badfa40954022653326c3166448ae5bf)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Database.pm