Closed jcervantes-sipecom closed 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
.
Hello, Same error, after migration from 9.5.11 to 10.0.5... Regards
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.
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';
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 ?
Hello, I found the mistake. I patch with this https://github.com/yllen/behaviors/issues/4#issuecomment-1003971355 a year ago... Regards
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.
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
Page URL
No response
Steps To reproduce
Your GLPI setup information
Information about system installation and configuration
Server
GLPI constants
Libraries
LDAP directories
SQL replicas
Notifications
Plugins list
Anything else?
I have edited the default value from the database directly from null to 0 in glpi_documents:
So in this way the issue is solved:
Paste:
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'.