#5124 migrate: Duplicate entry '1-1' for key 'PRIMARY'

skala
Laurent Opprecht 13 years ago
parent f83349a710
commit ece37e7c59
  1. 9
      main/install/update-db-1.8.8-1.9.0.inc.php

@ -284,10 +284,15 @@ if (defined('SYSTEM_INSTALLATION')) {
} }
//Adding admin user in the access_url_rel_user table //Adding admin user in the access_url_rel_user table
$sql = "SELECT user_id FROM admin WHERE user_id = 1 AND access_url_id = 1"; $sql = "SELECT user_id FROM admin WHERE user_id = 1";
$result = iDatabase::query($sql); $result = iDatabase::query($sql);
$has_user_id = Database::num_rows($result) > 0;
if (Database::num_rows($result) == 0) { $sql = "SELECT * FROM access_url_rel_user WHERE user_id = 1 AND access_url_id = 1";
$result = iDatabase::query($sql);
$has_entry = Database::num_rows($result) > 0;
if ($has_user_id && !$has_entry) {
$sql = "INSERT INTO access_url_rel_user VALUES(1, 1)"; $sql = "INSERT INTO access_url_rel_user VALUES(1, 1)";
iDatabase::query($sql); iDatabase::query($sql);
} }

Loading…
Cancel
Save