Permalink
Browse files

remplacement de la clé unique en primary, compatibilté cluster galera

  • Loading branch information...
bcenou committed Jun 12, 2018
1 parent 228fbb4 commit f38662f50eec4e59803ca26386dd87cce9dee55e
Showing with 6 additions and 6 deletions.
  1. +6 −6 lodel/scripts/logic/class.classes.php
@@ -164,15 +164,15 @@ protected function _saveRelatedTables ($vo, &$context)
if (!isset($this->oldvo->class)) {
switch($vo->classtype) {
case 'entities' :
$create = "identity INTEGER UNSIGNED UNIQUE, KEY index_identity (identity)";
$create = "identity INTEGER UNSIGNED PRIMARY KEY";
break;
case 'entries' :
$create = "identry INTEGER UNSIGNED UNIQUE, KEY index_identry (identry)";
$db->execute (lq ("CREATE TABLE IF NOT EXISTS #_TP_entities_". $vo->class." ( idrelation INTEGER UNSIGNED UNIQUE, KEY index_idrelation (idrelation) )")) or trigger_error("SQL ERROR :<br />".$GLOBALS['db']->ErrorMsg(), E_USER_ERROR);
$create = "identry INTEGER UNSIGNED PRIMARY KEY";
$db->execute (lq ("CREATE TABLE IF NOT EXISTS #_TP_entities_". $vo->class." ( idrelation INTEGER UNSIGNED PRIMARY KEY )")) or trigger_error("SQL ERROR :<br />".$GLOBALS['db']->ErrorMsg(), E_USER_ERROR);
break;
case 'persons' :
$create = "idperson INTEGER UNSIGNED UNIQUE, KEY index_idperson (idperson)";
$db->execute (lq ("CREATE TABLE IF NOT EXISTS #_TP_entities_". $vo->class." ( idrelation INTEGER UNSIGNED UNIQUE, KEY index_idrelation (idrelation) )")) or trigger_error("SQL ERROR :<br />".$GLOBALS['db']->ErrorMsg(), E_USER_ERROR);
$create = "idperson INTEGER UNSIGNED PRIMARY KEY";
$db->execute (lq ("CREATE TABLE IF NOT EXISTS #_TP_entities_". $vo->class." ( idrelation INTEGER UNSIGNED PRIMARY KEY )")) or trigger_error("SQL ERROR :<br />".$GLOBALS['db']->ErrorMsg(), E_USER_ERROR);
break;
}
$db->execute(lq("CREATE TABLE IF NOT EXISTS #_TP_". $vo->class." ( ". $create." )")) or trigger_error("SQL ERROR :<br />".$GLOBALS['db']->ErrorMsg(), E_USER_ERROR);
@@ -307,4 +307,4 @@ protected function _uniqueFields()
}
// end{uniquefields} automatic generation //
} // class
} // class

0 comments on commit f38662f

Please sign in to comment.