mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
Bugfix add primary key firmendaten_werte only if not already present
This commit is contained in:
parent
012796f423
commit
7e96a351d4
@ -8129,7 +8129,15 @@ function UpgradeDatabase($stufe = 0)
|
||||
}
|
||||
}
|
||||
|
||||
$this->CheckAlterTable("ALTER TABLE `firmendaten_werte` ADD PRIMARY KEY(`id`);");
|
||||
$keys = $this->app->DB->Select("SELECT COLUMN_NAME
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_NAME = 'firmendaten'
|
||||
AND COLUMN_KEY = 'PRI'");
|
||||
|
||||
if ($keys != 'id') { // Only if id is not already primary key
|
||||
$this->CheckAlterTable("ALTER TABLE `firmendaten_werte` ADD PRIMARY KEY(`id`);");
|
||||
}
|
||||
|
||||
$maxid = 1+(int)$this->app->DB->Select("SELECT max(id) FROM `firmendaten_werte`");
|
||||
$this->CheckAlterTable("ALTER TABLE `firmendaten_werte` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=".$maxid);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user