support for FKs, indented with spaces
This commit is contained in:
parent
33b23eda3b
commit
185c334710
@ -76,15 +76,22 @@ class Doctrine_Import_Reader_Db extends Doctrine_Import_Reader
|
||||
|
||||
$db->set("name",$dbName);
|
||||
$tableNames = $dataDict->listTables();
|
||||
foreach($tableNames as $tableName){
|
||||
$table = new Doctrine_Schema_Table();
|
||||
$table->set("name",$tableName);
|
||||
$tableColumns = $dataDict->listTableColumns($tableName);
|
||||
foreach($tableColumns as $tableColumn){
|
||||
$table->addColumn($tableColumn);
|
||||
}
|
||||
$db->addTable($table);
|
||||
}
|
||||
foreach($tableNames as $tableName){
|
||||
$table = new Doctrine_Schema_Table();
|
||||
$table->set("name",$tableName);
|
||||
$tableColumns = $dataDict->listTableColumns($tableName);
|
||||
foreach($tableColumns as $tableColumn){
|
||||
$table->addColumn($tableColumn);
|
||||
}
|
||||
$db->addTable($table);
|
||||
if ($fks = $dataDict->listTableConstraints($tableName)){
|
||||
foreach($fks as $fk){
|
||||
$relation = new Doctrine_Schema_Relation();
|
||||
$relation->setRelationBetween($fk['referencingColumn'],$fk['referencedTable'],$fk['referencedColumn']);
|
||||
$table->setRelation($relation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user