pluginsGLPI / geninventorynumber

Inventorynumber generation
GNU General Public License v3.0
8 stars 14 forks source link

GLPI10 upgrade glpi:migration:unsigned_keys migration fail #47

Closed ftoledo closed 2 years ago

ftoledo commented 2 years ago

on upgrate to glpi 10, i run the unsigned integer migration:

php7.4 bin/console glpi:migration:unsigned_keys
Found 1 primary/foreign key columns(s) using signed integers.
Desea continuar? [Yes/no]y
Migration of column "glpi_plugin_geninventorynumber_configs.entities_id" cannot be done as it contains negative values.
 1/1 [============================] 100%
Errors occured during migration.

The problem is that the default value for glpi_plugin_geninventorynumber_configs has negative value :

+-------------+------------------+------+-----+---------+----------------+
| Field       | Type             | Null | Key | Default | Extra          |
+-------------+------------------+------+-----+---------+----------------+
| id          | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| name        | varchar(255)     | YES  |     |         |                |
| entities_id | int(11)          | NO   |     | -1      |                |
| is_active   | tinyint(1)       | NO   |     | 0       |                |
| index       | int(11)          | NO   |     | 0       |                |
| comment     | mediumtext       | YES  |     | NULL    |                |
+-------------+------------------+------+-----+---------+----------------+

as workaround you can modify these default value to 0 (but i dont know if need a code change to support it)

alter table  glpi_plugin_geninventorynumber_configs modify entities_id int(11) default 0;

Related: https://github.com/glpi-project/glpi/issues/10474

cedric-anne commented 2 years ago

Hi,

It has been handled in #46 and integrated in yesterday releases.

Regards