View Issue Details

IDProjectCategoryView StatusLast Update
0026568mantisbtinstallationpublic2020-03-15 15:23
Reporterdregad Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Target Version2.24.0Fixed in Version2.24.0 
Summary0026568: Use appropriate statement to update DB schema when generating SQL
Description

When the installer is used to generate SQL instead of directly creating the database, the last statement printed is a hardcoded INSERT to create the database_version key in the config table.

This does not consider the case of an upgrade, where the record already exists, so running the script as-is triggers an SQL error, e.g.:
ERROR 1062 (23000): Duplicate entry 'database_version-0-0' for key 'PRIMARY'

Since the installer knows whether it is installing a new database or upgrading an existing one, an UPDATE statement should be generated instead in the latter case.

TagsNo tags attached.

Relationships

related to 0026556 closeddregad Upgrading from 2.22.0 crashed when updating database 
related to 0026662 closeddregad Final statement to set database version not logged in SQL script 

Activities

Related Changesets

MantisBT: master 412f855f

2020-01-06 04:54

dregad


Details Diff
Use UPDATE/INSERT to update DB schema

When the installer is used to generate SQL instead of directly creating
the database, the last statement printed was a hardcoded INSERT to
create the database_version key in the config table.

This did not consider the case of an upgrade, where the record already
exists, so running the script as-is caused a duplicate key SQL error.

Since the installer knows whether it is installing a new database or
upgrading an existing one, an UPDATE statement should be generated
instead in the latter case.

Fixes 0026568
Affected Issues
0026568
mod - admin/install.php Diff File