You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2021-12-15 15:09:15

benfl
Member
Registered: 2021-12-15
Posts: 1

Upgrade DB : SQL Error "1062": Duplicate entry for key 'unicity'

Hi, I'm trying to install GLPI on a docker container, with the database stored in a separate container (Mariadb 10.6.5).
For now, we have a GLPI instance(version 9.3.1) running in a separate VM.
The GLPI version running in the container is 9.5.6.
I am able to deploy the DB in the mariaDB container using mysqldump, and to connect the glpi container to the DB using the CLI tool "db:configure".
When I try to update the DB from 9.3.1 to 6.5.6 using db:update, I run into multiple errors like these :

 SQL Error "1062": Duplicate entry '15-Computer-194' for key 'unicity' in query "INSERT INTO `glpi_domains_items` (`domains_id`, `itemtype`, `items_id`) VALUES ('15', 'Computer', '194')"
DBmysql::query() in /var/www/html/glpi/inc/dbmysql.class.php line 309
  *** MySQL query error:
  SQL: INSERT INTO `glpi_domains_items` (`domains_id`, `itemtype`, `items_id`) VALUES ('15', 'Computer', '195')
  Error: Duplicate entry '15-Computer-195' for key 'unicity'
  Backtrace :
  inc/dbmysql.class.php:1148
  install/update_94_95.php:1236                      DBmysql->insert()
  inc/update.class.php:475                           update94to95()
  inc/console/database/updatecommand.class.php:183   Update->doUpdates()
  vendor/symfony/console/Command/Command.php:255     Glpi\Console\Database\UpdateCommand->execute()
  vendor/symfony/console/Application.php:1000        Symfony\Component\Console\Command\Command->run()
  inc/console/application.class.php:249              Symfony\Component\Console\Application->doRunCommand()
  vendor/symfony/console/Application.php:271         Glpi\Console\Application->doRunCommand()
  vendor/symfony/console/Application.php:147         Symfony\Component\Console\Application->doRun()
  bin/console:102                                    Symfony\Component\Console\Application->run()
 SQL Error "1062": Duplicate entry '15-Computer-195' for key 'unicity' in query "INSERT INTO `glpi_domains_items` (`domains_id`, `itemtype`, `items_id`) VALUES ('15', 'Computer', '195')"
DBmysql::query() in /var/www/html/glpi/inc/dbmysql.class.php line 309
  *** MySQL query error:
  SQL: INSERT INTO `glpi_domains_items` (`domains_id`, `itemtype`, `items_id`) VALUES ('15', 'Computer', '196')
  Error: Duplicate entry '15-Computer-196' for key 'unicity'
  Backtrace :
  inc/dbmysql.class.php:1148
  install/update_94_95.php:1236                      DBmysql->insert()
  inc/update.class.php:475                           update94to95()
  inc/console/database/updatecommand.class.php:183   Update->doUpdates()
  vendor/symfony/console/Command/Command.php:255     Glpi\Console\Database\UpdateCommand->execute()
  vendor/symfony/console/Application.php:1000        Symfony\Component\Console\Command\Command->run()
  inc/console/application.class.php:249              Symfony\Component\Console\Application->doRunCommand()
  vendor/symfony/console/Application.php:271         Glpi\Console\Application->doRunCommand()
  vendor/symfony/console/Application.php:147         Symfony\Component\Console\Application->doRun()
  bin/console:102                                    Symfony\Component\Console\Application->run()
 SQL Error "1062": Duplicate entry '15-Computer-196' for key 'unicity' in query "INSERT INTO `glpi_domains_items` (`domains_id`, `itemtype`, `items_id`) VALUES ('15', 'Computer', '196')" 

I tried to see if duplicate entries existed in the DB, but it doesn't seems like it, for example :

 MariaDB [servicedesk]> select * from glpi_domains_items where items_id = 194;
+-----+------------+----------+----------+--------------------+
| id  | domains_id | items_id | itemtype | domainrelations_id |
+-----+------------+----------+----------+--------------------+
| 133 |         15 |      194 | Computer |                  0 |
+-----+------------+----------+----------+--------------------+
1 row in set (0.002 sec) 

Any idea on how to fix  this issue ? I don't understand why the upgrade process tries to recreate rows similar to existing ones, or maybe I am completely wrong with my reasoning.
Thanks in advance !
A propos je suis français, donc vous pouvez répondre en français à ma question smile

Offline

Board footer

Powered by FluxBB