summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--install.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/install.php b/install.php
index 1345a6bd..b736713f 100644
--- a/install.php
+++ b/install.php
@@ -140,11 +140,16 @@ function tableGetContraints($table, $column, $refTable, $refColumn)
*/
function tableAddConstraint($table, $column, $refTable, $refColumn, $actions)
{
- $test = tableGetConstraints($table, $column, $refTable, $refColumn);
+ $test = tableExists($refTable) && tableHasColumn($refTable, $refColumn);
if ($test === false) {
- // Most likely, destination table does not exist yep
+ // Most likely, destination table does not exist yet or isn't up to date
return UPDATE_RETRY;
}
+ $test = tableGetConstraints($table, $column, $refTable, $refColumn);
+ if ($test === false) {
+ // Should never happen!?
+ finalResponse(UPDATE_FAILED, 'DB: Cannot query constraints: ' . Database::lastError());
+ }
if (!empty($test)) {
// Already exists
return UPDATE_NOOP;
@@ -154,7 +159,7 @@ function tableAddConstraint($table, $column, $refTable, $refColumn, $actions)
REFERENCES `$refTable` (`$refColumn`)
$actions");
if ($ret === false) {
- finalResponse(UPDATE_FAILED, 'DB-Error: ' . Database::lastError());
+ finalResponse(UPDATE_FAILED, 'DB: Cannot add constraint: ' . Database::lastError());
}
return UPDATE_DONE;
}