示例#1
0
 static function makeDb($schemaFile, $createDB = true)
 {
     $schema = sfYaml::load("../../entities/schema/{$schemaFile}");
     if (is_array($schema)) {
         self::getConection();
         $sb = new SchemaBuilder(self::$conectionDB);
         if ($createDB) {
             $result = $sb->createDataBase();
             $ok = substr($result[0], 0, 2) == 'Ok';
         } else {
             $ok = true;
             $result = array();
         }
         if ($ok) {
             $result1 = $sb->buildTables($schema);
             foreach ($result1 as $item) {
                 array_push($result, $item);
             }
         }
     } else {
         $result = array("Schema file do not exists or is empty");
     }
     return $result;
 }