I recently modified my MySQL configuration to run in strict mode (sql-mode = "TRADITIONAL").
Since then, I noticed this was causing a MySQL error when sending a new ticket in Traq. The error was:
Field 'milestone_id' doesn't have a default value
INSERT INTO `tickets` (`ticket_id`, `summary`, `body`, `user_id`, `project_id`, `version_id`, `component_id`, `type_id`, `status_id`, `priority_id`, `severity_id`, `assigned_to_id`, `is_closed`, `tasks`, `extra`, `created_at`) VALUES('4', 'MySQL Strict test', 'Test', '1', '2', '0', '0', '1', '1', '3', '4', '0', '0', '[]', '{\"voted\":[],\"custom_fields\":[]}', '2013-09-25 23:26:20')
The problem is that Traq does not insert any value in the milestone_id field, and it doesn't have a default value, which is not allowed in strict mode (a numeric field cannot be left empty, but can be set to null if nullable).
The problem can be fixed by setting a default value in the table field (0 or null) or insert a default value in SQL query.
The problem can be reproduced with Wamp 2.2, just editing the my.ini to add the following line:
sql-mode = "TRADITIONAL"
PHP version is 5.3.13 and MySQL version is 5.5.24.
I've updated the
install.sql
and upgrade file to add a default value.