The upgrade from version 0.5.8 to 0.5.9 led to a failure in generating the 'contact_primary' fields due to the nonexistence of 'contact_token_expire'. This should have been established during the database upgrade 0.2.7, detailed below:
`` if (CURRENT_DATABASE_VERSION == '0.2.6') {
// Execute the following queries to transition to DB version 0.2.7
mysqli_query($mysqli, "ALTER TABLE contacts
ADD contact_token_expire
DATETIME NULL DEFAULT NULL AFTER contact_password_reset_token
");
// Update the version variable in config.php for compatibility with Docker
file_put_contents("config.php", "\$repo_branch = 'master';" . PHP_EOL, FILE_APPEND);
// Next, transition the database to the subsequent sequential version
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.7'");
}
``
There was also an absence of the 'software_template' field in the software table. This field was supposed to be established during the database upgrade to 0.2.8, as described below:
`` if (CURRENT_DATABASE_VERSION == '0.2.7') {
mysqli_query($mysqli, "ALTER TABLE `vendors` ADD `vendor_template` TINYINT(1) DEFAULT 0 AFTER `vendor_notes`");
mysqli_query($mysqli, "ALTER TABLE `software` ADD `software_template` TINYINT(1) DEFAULT 0 AFTER `software_notes`");
mysqli_query($mysqli, "ALTER TABLE `vendors` DROP `vendor_template_id`");
mysqli_query($mysqli, "DROP TABLE vendor_templates");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.8'");
}
``
My hypothesis is that ITFlow was initially installed after these updates. However, the most recent database structure probably was not exported to db.sql during that time, which is utilized for the initial installation.
We rectified this issue without any charges because it benefited our ITFlow Development. We appreciate Lindell for granting us access to PHPMyAdmin and CPanel, which aided us in diagnosing the problem.
Additionally, it's important to note that database updates currently do not alert users about SQL errors after updates, which is why this problem remained undetected. To prevent such occurrences in the future, we aim to improve our error management system.