glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
4.26k stars 1.29k forks source link

Error: Field 'tickets_id' doesn't have a default value #13671

Closed jcervantes-sipecom closed 1 year ago

jcervantes-sipecom commented 1 year ago

Code of Conduct

Is there an existing issue for this?

Version

10.0.5

Bug description

When I tried to attach files to a validation request from a ticket, the document isn't created, in SQL I got: Error: Field 'tickets_id' doesn't have a default value.

This happend only in migration database from previous version of GLPI, in cloud it doesn't happend.

Relevant log output

glpisqllog.ERROR: DBmysql::query() in /glpi/src/DBmysql.php line 370
  *** MySQL query error:
  SQL: INSERT INTO `glpi_documents` (`tag`, `entities_id`, `is_recursive`, `documentcategories_id`, `users_id`, `mime`, `filename`, `filepath`, `sha1sum`, `name`, `date_creation`, `date_mod`) VALUES ('05813c91-b2d8e96f-63a6159991d129.04785002', '6', '0', '0', '7', 'image/png', '5f085037fb86fc.74966100image_paste2415424.png', 'PNG/12/4149742791524f54019d3b7b864ecffa669dca.PNG', '124149742791524f54019d3b7b864ecffa669dca', '5f085037fb86fc.74966100image_paste2415424.png', '2022-12-23 15:54:57', '2022-12-23 15:54:57')
  Error: Field 'tickets_id' doesn't have a default value
  Backtrace :
  src/DBmysql.php:1320
  src/CommonDBTM.php:719                             DBmysql->insert()
  src/CommonDBTM.php:1324                            CommonDBTM->addToDB()
  src/CommonDBTM.php:5489                            CommonDBTM->add()
  src/CommonITILValidation.php:301                   CommonDBTM->addFiles()
  src/CommonDBTM.php:1325                            CommonITILValidation->post_addItem()
  front/commonitilvalidation.form.php:73             CommonDBTM->add()
  front/ticketvalidation.form.php:40                 include()

glpisqllog.ERROR: DBmysql::query() in /glpi/src/DBmysql.php line 370
  *** MySQL query error:
  SQL: INSERT INTO `glpi_documents` (`tag`, `entities_id`, `is_recursive`, `documentcategories_id`, `users_id`, `mime`, `filename`, `filepath`, `sha1sum`, `name`, `date_creation`, `date_mod`) VALUES ('05813c91-b2d8e96f-63a6160bd2e599.54460627', '6', '0', '0', '7', 'image/png', 'Screenshot_2.png', 'PNG/23/bcd6b246e571fc084d89c684e47c1e116f28d6.PNG', '23bcd6b246e571fc084d89c684e47c1e116f28d6', 'Screenshot_2.png', '2022-12-23 15:57:18', '2022-12-23 15:57:18')
  Error: Field 'tickets_id' doesn't have a default value
  Backtrace :
  src/DBmysql.php:1320
  src/CommonDBTM.php:719                             DBmysql->insert()
  src/CommonDBTM.php:1324                            CommonDBTM->addToDB()
  src/CommonDBTM.php:5489                            CommonDBTM->add()
  src/CommonITILValidation.php:306                   CommonDBTM->addFiles()
  src/CommonDBTM.php:1325                            CommonITILValidation->post_addItem()
  front/commonitilvalidation.form.php:73             CommonDBTM->add()
  front/ticketvalidation.form.php:40                 include()

Page URL

No response

Steps To reproduce

  1. Update database from GLPI 9.5.9 to GLPI 10.0.5
  2. Create a Ticket,
  3. Create a Validation Request/Ask for validation
  4. Paste or attach a file or document
  5. The pasted image doesn't shows:

image

  1. Or the attached file doesn't shows:

image

image

Your GLPI setup information

Information about system installation and configuration
GLPI 10.0.5 ( => /glpi)
Installation mode: TARBALL
Current language:en_GB

Server
 
Operating system: LinuxUbuntu SMP Tue Dec 6 17:00:26 UTC 2022 x86_64
PHP 7.4.3 apache2handler (Core, FFI, PDO, Phar, Reflection, SPL, SimpleXML, Zend OPcache, apache2handler, apc, apcu, bz2,
    calendar, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, intl, json, ldap, libxml, mbstring,
    mysqli, mysqlnd, openssl, pcre, pdo_mysql, posix, readline, session, shmop, sockets, sodium, standard, sysvmsg, sysvsem,
    sysvshm, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib)
Setup: max_execution_time="600" memory_limit="1G" post_max_size="8M" safe_mode="" session.save_handler="files"
    upload_max_filesize="2M" 
Software: Apache/2.4.41 (Ubuntu) (Apache/2.4.41 (Ubuntu) Server
)
    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.46
Server Software: (Ubuntu)
    Server Version: 8.0.31-0ubuntu0.20.04.1
    Server SQL Mode: STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
    Parameters: 
    Host info: Localhost via UNIX socket

PHP version (7.4.3) is supported.
Sessions configuration is OK.
Allocated memory is sufficient.
mysqli extension is installed.
Following extensions are installed: dom, fileinfo, json, simplexml.
curl extension is installed.
gd extension is installed.
intl extension is installed.
libxml extension is installed.
zlib extension is installed.
The constant SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES is present.
Database engine version (8.0.31) is supported.
No files from previous GLPI version detected.
The log file has been created successfully.
Write access to /glpi/files/_cache has been validated.
Write access to /glpi/config/ has been validated.
Write access to /glpi/files/_cron has been validated.
Write access to /glpi/files has been validated.
Write access to /glpi/files/_dumps has been validated.
Write access to /glpi/files/_graphs has been validated.
Write access to /glpi/files/_lock has been validated.
Write access to /glpi/files/_pictures has been validated.
Write access to /glpi/files/_plugins has been validated.
Write access to /glpi/files/_rss has been validated.
Write access to /glpi/files/_sessions has been validated.
Write access to /glpi/files/_tmp has been validated.
Write access to /glpi/files/_uploads has been validated.
GLPI data directories are located in a secured path.
Sessions configuration is secured.
exif extension is installed.
ldap extension is installed.
openssl extension is installed.
zip extension is installed.
bz2 extension is installed.
Zend OPcache extension is installed.
Following extensions are installed: ctype, iconv, mbstring, sodium.
Write access to /glpi/marketplace has been validated.
Timezones seems loaded in database.

GLPI constants
 
GLPI_ROOT: "/glpi"
GLPI_CONFIG_DIR: "/glpi/config/"
GLPI_VAR_DIR: "/glpi/files"
GLPI_LOG_DIR: "/glpi/_log"
GLPI_MARKETPLACE_DIR: "/glpi/marketplace"
GLPI_USE_CSRF_CHECK: "1"
GLPI_CSRF_EXPIRES: "7200"
GLPI_CSRF_MAX_TOKENS: "100"
GLPI_USE_IDOR_CHECK: "1"
GLPI_IDOR_EXPIRES: "7200"
GLPI_ALLOW_IFRAME_IN_RICH_TEXT: false
GLPI_SERVERSIDE_URL_ALLOWLIST: ["/^(https?|feed):\\/\\/[^@:]+(\\/.*)?$/"]
GLPI_TELEMETRY_URI: "https://telemetry.glpi-project.org"
GLPI_INSTALL_MODE: "TARBALL"
GLPI_NETWORK_MAIL: "glpi@teclib.com"
GLPI_NETWORK_SERVICES: "https://services.glpi-network.com"
GLPI_MARKETPLACE_ALLOW_OVERRIDE: true
GLPI_MARKETPLACE_MANUAL_DOWNLOADS: true
GLPI_USER_AGENT_EXTRA_COMMENTS: ""
GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE: "1"
GLPI_AJAX_DASHBOARD: "1"
GLPI_CALDAV_IMPORT_STATE: 0
GLPI_DEMO_MODE: "0"
GLPI_CENTRAL_WARNINGS: "1"
GLPI_DOC_DIR: "/glpi/files"
GLPI_CACHE_DIR: "/glpi/files/_cache"
GLPI_CRON_DIR: "/glpi/files/_cron"
GLPI_DUMP_DIR: "/glpi/files/_dumps"
GLPI_GRAPH_DIR: "/glpi/files/_graphs"
GLPI_LOCAL_I18N_DIR: "/glpi/files/_locales"
GLPI_LOCK_DIR: "/glpi/files/_lock"
GLPI_PICTURE_DIR: "/glpi/files/_pictures"
GLPI_PLUGIN_DOC_DIR: "/glpi/files/_plugins"
GLPI_RSS_DIR: "/glpi/files/_rss"
GLPI_SESSION_DIR: "/glpi/files/_sessions"
GLPI_TMP_DIR: "/glpi/files/_tmp"
GLPI_UPLOAD_DIR: "/glpi/files/_uploads"
GLPI_INVENTORY_DIR: "/glpi/files/_inventories"
GLPI_NETWORK_REGISTRATION_API_URL: "https://services.glpi-network.com/api/registration/"
GLPI_MARKETPLACE_PLUGINS_API_URI: "https://services.glpi-network.com/api/glpi-plugins/"
GLPI_I18N_DIR: "/glpi/locales"
GLPI_VERSION: "10.0.5"
GLPI_SCHEMA_VERSION: "10.0.5@628dbfbb91eb4caf10c35969d9162b9300b141e0"
GLPI_MARKETPLACE_PRERELEASES: false
GLPI_MIN_PHP: "7.4.0"
GLPI_MAX_PHP: "8.3.0"
GLPI_YEAR: "2022"

Libraries
 
htmlawed/htmlawed version 1.2.9 in (/glpi/vendor/htmlawed/htmlawed)
phpmailer/phpmailer version 6.6.0 in (/glpi/vendor/phpmailer/phpmailer/src)
simplepie/simplepie version 1.5.8 in (/glpi/vendor/simplepie/simplepie/library)
tecnickcom/tcpdf version 6.5.0 in (/glpi/vendor/tecnickcom/tcpdf)
michelf/php-markdown in (/glpi/vendor/michelf/php-markdown/Michelf)
true/punycode in (/glpi/vendor/true/punycode/src)
iamcal/lib_autolink in (/glpi/vendor/iamcal/lib_autolink)
sabre/dav in (/glpi/vendor/sabre/dav/lib/DAV)
sabre/http in (/glpi/vendor/sabre/http/lib)
sabre/uri in (/glpi/vendor/sabre/uri/lib)
sabre/vobject in (/glpi/vendor/sabre/vobject/lib)
laminas/laminas-i18n in (/glpi/vendor/laminas/laminas-i18n/src)
laminas/laminas-servicemanager in (/glpi/vendor/laminas/laminas-servicemanager/src)
monolog/monolog in (/glpi/vendor/monolog/monolog/src/Monolog)
sebastian/diff in (/glpi/vendor/sebastian/diff/src)
donatj/phpuseragentparser in (/glpi/vendor/donatj/phpuseragentparser/src/UserAgent)
elvanto/litemoji in (/glpi/vendor/elvanto/litemoji/src)
symfony/console in (/glpi/vendor/symfony/console)
scssphp/scssphp in (/glpi/vendor/scssphp/scssphp/src)
laminas/laminas-mail in (/glpi/vendor/laminas/laminas-mail/src/Protocol)
laminas/laminas-mime in (/glpi/vendor/laminas/laminas-mime/src)
rlanvin/php-rrule in (/glpi/vendor/rlanvin/php-rrule/src)
blueimp/jquery-file-upload in (/glpi/vendor/blueimp/jquery-file-upload/server/php)
ramsey/uuid in (/glpi/vendor/ramsey/uuid/src)
psr/log in (/glpi/vendor/psr/log/Psr/Log)
psr/simple-cache in (/glpi/vendor/psr/simple-cache/src)
psr/cache in (/glpi/vendor/psr/cache/src)
league/csv in (/glpi/vendor/league/csv/src)
mexitek/phpcolors in (/glpi/vendor/mexitek/phpcolors/src/Mexitek/PHPColors)
guzzlehttp/guzzle in (/glpi/vendor/guzzlehttp/guzzle/src)
guzzlehttp/psr7 in (/glpi/vendor/guzzlehttp/psr7/src)
glpi-project/inventory_format in (/glpi/vendor/glpi-project/inventory_format/lib/php)
wapmorgan/unified-archive in (/glpi/vendor/wapmorgan/unified-archive/src)
paragonie/sodium_compat in (/glpi/vendor/paragonie/sodium_compat/src)
symfony/cache in (/glpi/vendor/symfony/cache)
html2text/html2text in (/glpi/vendor/html2text/html2text/src)
symfony/css-selector in (/glpi/vendor/symfony/css-selector)
symfony/dom-crawler in (/glpi/vendor/symfony/dom-crawler)
twig/twig in (/glpi/vendor/twig/twig/src)
twig/string-extra in (/glpi/vendor/twig/string-extra)
symfony/polyfill-ctype not found
symfony/polyfill-iconv not found
symfony/polyfill-mbstring not found
symfony/polyfill-php80 in (/glpi/vendor/symfony/polyfill-php80)
symfony/polyfill-php81 in (/glpi/vendor/symfony/polyfill-php81)
symfony/polyfill-php82 in (/glpi/vendor/symfony/polyfill-php82)

LDAP directories
 
Server: 

SQL replicas
 
Not active

Notifications
 
Way of sending emails: 

Plugins list
 
    activity             Name: Activities                     Version: 3.1.2      State: Enabled                                 
        Install Method: Marketplace
    actualtime           Name: ActualTime                     Version: 2.0.0      State: Enabled                                 
        Install Method: Marketplace
    fields               Name: Additional fields              Version: 1.20.0     State: Installed / not activated               
        Install Method: Marketplace
    advancedplanning     Name: advancedplanning               Version: 1.1.0      State: Installed / not activated               
        Install Method: Marketplace
    news                 Name: Alerts                         Version: 1.10.5     State: Installed / not activated               
        Install Method: Marketplace
    archisw              Name: Apps structures                Version: 2.2.15     State: Installed / not activated               
        Install Method: Marketplace
    cleanarchivedemails  Name: Archived eMail clean           Version: 2.0.0      State: Installed / not activated               
        Install Method: Manual
    impacts              Name: Asset impacts                  Version: 2.0.7      State: Installed / not activated               
        Install Method: Manual
    barcode              Name: Barcode                        Version: 2.7.1      State: Enabled                                 
        Install Method: Marketplace
    behaviors            Name: Behaviours                     Version: 2.7.2      State: Enabled                                 
        Install Method: Manual
    camerainput          Name: Camera Input                   Version: 2.0.1      State: Installed / not activated               
        Install Method: Marketplace
    positions            Name: Cartography                    Version: 6.0.2      State: Enabled                                 
        Install Method: Marketplace
    cmdb                 Name: CMDB                           Version: 3.0.3      State: Enabled                                 
        Install Method: Marketplace
    consumables          Name: Consumable request             Version: 2.0.0      State: Enabled                                 
        Install Method: Marketplace
    costs                Name: Costs                          Version: 3.0.1      State: Installed / not activated               
        Install Method: Marketplace
    credit               Name: Credit vouchers                Version: 1.11.3     State: Installed / not activated               
        Install Method: Marketplace
    accounts             Name: Cuentas                        Version: 3.0.2      State: Enabled                                 
        Install Method: Marketplace
    dashboard            Name: Dashboard                      Version: 1.0.2      State: Installed / not activated               
        Install Method: Manual
    datainjection        Name: Data injection                 Version: 2.12.0     State: Installed / not activated               
        Install Method: Marketplace
    archidata            Name: Data structures                Version: 1.0.13     State: Installed / not activated               
        Install Method: Marketplace
    databases            Name: Databases                      Version: 2.3.2      State: Not installed                           
        Install Method: Manual
    dataflows            Name: Dataflows                      Version: 2.2.18     State: Installed / not activated               
        Install Method: Marketplace
    archimap             Name: Diagrams                       Version: 3.2.18     State: Enabled                                 
        Install Method: Marketplace
    manageentities       Name: Entities portal                Version: 4.0.3      State: Installed / not activated               
        Install Method: Marketplace
    environment          Name: Environment                    Version: 2.4.2      State: Installed / not activated               
        Install Method: Manual
    escalade             Name: Escalation                     Version: 2.8.1      State: Installed / not activated               
        Install Method: Marketplace
    father               Name: Father&Sons                    Version: 1.2.0      State: Not installed                           
        Install Method: Manual
    formcreator          Name: Form Creator                   Version: 2.13.3     State: Enabled                                 
        Install Method: Marketplace
    fpsaml               Name: FP SAML                        Version: 1.1.0      State: Installed / not activated               
        Install Method: Manual
    gappessentials       Name: Gapp Essentials                Version: 2.1.1      State: Installed / not activated               
        Install Method: Marketplace
    glpiinventory        Name: GLPI Inventory                 Version: 1.0.6      State: Enabled                                 
        Install Method: Marketplace
    mod                  Name: GLPI Modifications             Version: 2.0.2      State: Installed / not activated               
        Install Method: Manual
    resources            Name: Human Resources                Version: 3.0.4      State: Installed / not activated               
        Install Method: Marketplace
    geninventorynumber   Name: Inventory number generation    Version: 2.8.3      State: Enabled                                 
        Install Method: Marketplace
    addressing           Name: IP Adressing                   Version: 3.0.1      State: Enabled                                 
        Install Method: Marketplace
    uninstall            Name: Item's Lifecycle (uninstall)   Version: 2.8.1      State: Enabled                                 
        Install Method: Marketplace
    jsaddons             Name: JS Addons                      Version: 2.0.0      State: Installed / not activated               
        Install Method: Marketplace
    mailanalyzer         Name: Mail Analyzer                  Version: 3_1.0.0 beta State: Enabled                                 
        Install Method: Manual
    metabase             Name: Metabase                       Version: 1.3.2      State: Installed / not activated               
        Install Method: Marketplace
    mreporting           Name: More Reporting                 Version: 1.8.2      State: Enabled                                 
        Install Method: Marketplace
    satisfaction         Name: More satisfaction              Version: 1.6.1      State: Installed / not activated               
        Install Method: Marketplace
    moreticket           Name: More ticket                    Version: 1.7.1      State: Installed / not activated               
        Install Method: Marketplace
    mydashboard          Name: My Dashboard                   Version: 2.1.4      State: Installed / not activated               
        Install Method: Marketplace
    oauthimap            Name: Oauth IMAP                     Version: 1.4.1      State: Enabled                                 
        Install Method: Marketplace
    genericobject        Name: Objects management             Version: 2.14.1     State: Installed / not activated               
        Install Method: Marketplace
    ocsinventoryng       Name: OCS Inventory NG               Version: 2.0.4      State: Enabled                                 
        Install Method: Marketplace
    officeonline         Name: Office Online                  Version: 2.0.2      State: Installed / not activated               
        Install Method: Manual
    onetimesecret        Name: OneTimeSecret                  Version: 2.0.0      State: Enabled                                 
        Install Method: Marketplace
    order                Name: Orders management              Version: 2.10.0     State: Enabled                                 
        Install Method: Marketplace
    patchpanel           Name: PatchPanel                     Version: 0.9.4.1    State: Installed / not activated               
        Install Method: Manual
    phpsaml              Name: PHP SAML                       Version: 1.2.0      State: Installed / not activated               
        Install Method: Manual
    pdf                  Name: Print to pdf                   Version: 3.0.0      State: To update                               
        Install Method: Manual
    protocolsmanager     Name: Protocols manager              Version: 1.4.2      State: Installed / not activated               
        Install Method: Manual
    purchaserequest      Name: Purchase request               Version: 3.0.1      State: Enabled                                 
        Install Method: Marketplace
    reports              Name: Reports                        Version: 1.16.0     State: To update                               
        Install Method: Manual
    reservation          Name: Reservation                    Version: 2.4.2      State: To update                               
        Install Method: Manual
    room                 Name: Rooms                          Version: 3.1.3      State: Not installed                           
        Install Method: Manual
    screenshot           Name: Screenshot                     Version: 2.0.2      State: To update                               
        Install Method: Marketplace
    shellcommands        Name: Shell Commands                 Version: 4.0.1      State: Installed / not activated               
        Install Method: Marketplace
    stab                 Name: Split Timeline Action Buttons  Version: 1.1.2      State: Installed / not activated               
        Install Method: Marketplace
    statecheck           Name: Statecheck Rules               Version: 2.3.8      State: Installed / not activated               
        Install Method: Marketplace
    tag                  Name: Tag Management                 Version: 2.10.0     State: Installed / not activated               
        Install Method: Marketplace
    taskdrop             Name: TaskDrop                       Version: 2.0.0      State: Installed / not activated               
        Install Method: Marketplace
    tasklists            Name: Tasks list                     Version: 2.0.3      State: Installed / not activated               
        Install Method: Marketplace
    ticketcleaner        Name: Ticket Cleaner                 Version: 3.0.0      State: Not installed                           
        Install Method: Manual
    timelineticket       Name: Timeline of tickets            Version: 10.0+1.1   State: Installed / not activated               
        Install Method: Marketplace
    timesheet            Name: Timesheet for GLPI             Version: 1.0.1      State: Not installed                           
        Install Method: Manual
    treeview             Name: Tree view                      Version: 1.10.0     State: Installed / not activated               
        Install Method: Marketplace
    typology             Name: Typologies                     Version: 3.0.0      State: Installed / not activated               
        Install Method: Marketplace
    useditemsexport      Name: Used items export              Version: 2.5.1      State: Enabled                                 
        Install Method: Marketplace
    webapplications      Name: Web applications               Version: 4.0.1      State: Enabled                                 
        Install Method: Marketplace
    webresources         Name: Web Resources                  Version: 2.0.3      State: Installed / not activated               
        Install Method: Marketplace
    yagp                 Name: yagp                           Version: 2.1.1      State: Enabled                                 
        Install Method: Marketplace

Anything else?

I have edited the default value from the database directly from null to 0 in glpi_documents:

image

image

So in this way the issue is solved:

Paste: image

image

But I don't know where the problem can repeat in another table like this, I guess since the installation or upgrade, GLPI should set this default value to '0'.

cedric-anne commented 1 year ago

Hi,

This columns definition has not been touched, at least, since GLPI 0.78. If something went wrong in migrations, it was probably in migration from 0.72 to 0.78 (12 years ago). Migration from 0.72 is not supported anymore, so we will not try to fix it.

You can fix your database manually by setting the default value to 0.

CorentinS6 commented 1 year ago

Hello, Same error, after migration from 9.5.11 to 10.0.5... Regards

jcervantes-sipecom commented 1 year ago

Hi @cedric-Anne, yes, I manually modified the field in 0 as a default, but actually I had never used 0.72 or 0.78 GLPI versions, I started to use GLPI with 9.4 versions, so this configuration maybe comes from that version or prior.

It would be good that there was a validation of this field in next upgrades, so there isn't the need to modify manually the database.

CorentinS6 commented 1 year ago

same here. never use this old version. start from glpi 9.4.*. fix with : ALTER TABLE glpi_documents MODIFY COLUMN tickets_id int unsigned NOT NULL DEFAULT '0';

cedric-anne commented 1 year ago

I take a look on GLPI migration code, and I found nothing that could explain why there is no default value on this field. This default value was present in 9.4.0 install code, and no change were made on this field since 0.78. See https://github.com/glpi-project/glpi/blob/1783b781b221fe4212806c910dec3898c079c59f/install/mysql/glpi-empty.sql#L2702-L2732

If none of you manually changed its database structure in the past, maybe a plugin did it. If you still have access to a backup of the database of your previous GLPI version, could you check if this default value was present ?

CorentinS6 commented 1 year ago

Hello, I found the mistake. I patch with this https://github.com/yllen/behaviors/issues/4#issuecomment-1003971355 a year ago... Regards

cedric-anne commented 1 year ago

I guess many people used the SQL query and/or script proposed in this thread, but we will not try to implement some kind of fix in GLPI migrations. Indeed, there are probably thousands of threads on the Internet that tells users to run a SQL query or apply a patch in order to solve an issue, and will not spend time on trying to fix their side effects.

You should run php bin/console glpi:database:check_schema_integrity to find database inconsistencies and fix them.