public function toArray($assoc=false)
    {
        $data = array(
            'name' => $this->_name,
            'comment' => $this->getComment(),
        );
        foreach ($this->_columns as $name => $column) {
            if ($assoc) {
                $data['columns'][$name] = $column->toArray();
            } else {
                $data['columns'][] = $column->toArray();
            }
        }
        if (!empty($this->_primaryKey)) {
            foreach ($this->_primaryKey as $name => $column) {
                $data['primary_key'][] = $column->getName();
            }
        }
        foreach ($this->getIndexes() as $name => $index) {
            if ($assoc) {
                $data['indexes'][$name] = $index->toArray();
            } else {
                $data['indexes'][] = $index->toArray();
            }
        }
        return $data;
    }