1. In the file DBUtil.class.php in the function createTable() after
Code
add the following lines:
Code
// BEGING Support constraints
// Hack Mod by UnderMedia S.A.
$tabledef = $tablename . '_column_def';
$tablecol = $tablename . '_column';
$tableopt = $tablename . '_constraints';
if(array_key_exists($tableopt,$pntables) && is_array($pntables[$tableopt])){
foreach ($pntables[$tableopt] as $fk_column => $fk_reference){
$reference_table = $pntables[$fk_reference['table']];
$reference_column = $pntables[$fk_reference['table'] . '_column'][$fk_reference['column']];
$original_column = $pntables[$tablecol][$fk_column];
$tabopt['constraints'] .= ", CONSTRAINT FOREIGN KEY ($original_column) REFERENCES $reference_table ($reference_column) $fk_reference[accion]";
}
}
// END Support constraints
// Hack Mod by UnderMedia S.A.
$tabledef = $tablename . '_column_def';
$tablecol = $tablename . '_column';
$tableopt = $tablename . '_constraints';
if(array_key_exists($tableopt,$pntables) && is_array($pntables[$tableopt])){
foreach ($pntables[$tableopt] as $fk_column => $fk_reference){
$reference_table = $pntables[$fk_reference['table']];
$reference_column = $pntables[$fk_reference['table'] . '_column'][$fk_reference['column']];
$original_column = $pntables[$tablecol][$fk_column];
$tabopt['constraints'] .= ", CONSTRAINT FOREIGN KEY ($original_column) REFERENCES $reference_table ($reference_column) $fk_reference[accion]";
}
}
// END Support constraints
2. In pntables.php you should create a array like the follow:
Code
I don't know if the function createTable() is the correct or the hack can be put in the function getTableDefinition($tablename)...
What do you think about it?
Thanks!
edited by: netoec84, Mar 11, 2007 - 03:28 AM
