andrzejkupczyk / mantisbt-todolists

To-Do Lists Plugin for MantisBT
Apache License 2.0
12 stars 3 forks source link

Install error: Invalid default value for 'finished' #10

Closed pluk77 closed 4 years ago

pluk77 commented 4 years ago

Trying to install but am getting this error:

Upgrading the plugin schema failed at step #0. Error "Invalid default value for 'finished'" occurred while executing the following statement(s):

CREATE TABLE mantis_plugin_ToDoLists_tasks_table (
    id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
    bug_id INTEGER UNSIGNED NOT NULL DEFAULT 0,
    description VARCHAR(120) NOT NULL DEFAULT '',
    finished TINYINT DEFAULT 'f',
    PRIMARY KEY (id)
)ENGINE=MyISAM DEFAULT CHARSET=utf8
Esylias commented 4 years ago

CREATE TABLE mantis_plugin_ToDoLists_tasks_table ( id int(10) UNSIGNED NOT NULL, bug_id int(10) UNSIGNED NOT NULL DEFAULT '0', description varchar(120) NOT NULL DEFAULT '', finished tinyint(1) NOT NULL DEFAULT '0' ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

and remove "public function schema() {}" in "ToDoLists.php"

andrzejkupczyk commented 4 years ago

Better do not modify source files since this could make it harder for you to upgrade plugin in the future. @pluk77 , what version of plugin do you have installed?

pluk77 commented 4 years ago

I think I have version 2.0.1

pluk77 commented 4 years ago

In ToDoLists.php I did make a change to line 63 get it to install properly as 'f' is not a valid default value for an integer field:

finished L DEFAULT \'f\'' to: finished L DEFAULT \'0\''

andrzejkupczyk commented 4 years ago

Okay, so this is how it was done in the previous release and was changed due to https://github.com/andrzejkupczyk/mantisbt-todolists/issues/7 issue. This is silly :) I'll check it ASAP.

pluk77 commented 4 years ago

Seems like somewhere the column types for Postgress and MySQL are not compatible and are not 'translated' into the same type.

Others seems to have similar problems with compatibility: https://www.mantisbt.org/bugs/view.php?id=26109

andrzejkupczyk commented 4 years ago

Yeah, this is exactly what I've suspected. MantisBT (using ADOdb) should build proper query based on a database.
I'll try to solve this problem.

andrzejkupczyk commented 4 years ago

@pluk77 I've just tested and released the patch v2.0.2.
I hope it will work for you.