ubc / iPeer

Peer Evaluation System
http://ipeer.ctlt.ubc.ca
Other
17 stars 18 forks source link

Problem creating Survey events #662

Closed kitsook closed 3 years ago

kitsook commented 3 years ago

When trying to save a new Survey type event, iPeer shows "Add event failed" and cannot save it.

Problem seems to be related to the Maria DB version 10.2.4 and later, in which Strict Mode is enabled by default.

For survey events, the result_release_date_begin and result_release_date_end fields for the event are not needed. CakePHP generated SQL to insert empty string '' instead of null. With Strict Mode turned on, this causes DB insertion error.

One possible fix is to turn off Strict Mode. e.g. adding command: --sql_mode="" in docker-compose.yml seems to get around it.

EDIT: With MariaDB 10.4.14, the default SQL modes:

STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

Removing STRICT_TRANS_TABLES can avoid the issue.