Esempio n. 1
0
 public function getSchema($tables = null)
 {
     if ($tables == null) {
         $tables = $this->getTables();
     }
     $schema = [];
     foreach ($tables as $tableName) {
         $fields = $this->getFields($tableName);
         $table = new Table($tableName, $fields);
         foreach ($this->getForeignKeyConstraints($tableName) as $fk) {
             $field = $table->getField($fk['field']);
             if ($field != null) {
                 $field->setForeign($fk['on'], $fk['references'], $fk['name']);
             }
         }
         $schema[] = $table;
     }
     return $schema;
 }