1
0
mirror of synced 2024-12-14 07:06:04 +03:00

create a db schema for the current connection

This commit is contained in:
runa 2006-10-31 18:50:45 +00:00
parent f4df5424f4
commit b219cf4c95

View File

@ -66,7 +66,27 @@ class Doctrine_Import_Reader_Db extends Doctrine_Import_Reader
*/
public function read( )
{
return new Doctrine_Schema(); /* @todo FIXME i am incomplete*/
$dataDict = Doctrine_Manager::getInstance()->getCurrentConnection()->getDataDict();
$schema = new Doctrine_Schema(); /* @todo FIXME i am incomplete*/
$db = new Doctrine_Schema_Database();
$schema->addDatabase($db);
$dbName = 'XXtest'; // @todo FIXME where should we get
$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);
}
return $schema;
}