private function buildTable(Mapping\ClassMetadata $metadata)
    {
        $tableName     = $this->classToTableNames[$metadata->getClassName()];
        $indexes       = $this->tables[$tableName]->getIndexes();
        $tableMetadata = new Mapping\TableMetadata();

        $tableMetadata->setName($this->classToTableNames[$metadata->getClassName()]);

        foreach ($indexes as $index) {
            /** @var Index $index */
            if ($index->isPrimary()) {
                continue;
            }

            $tableMetadata->addIndex([
                'name'    => $index->getName(),
                'columns' => $index->getColumns(),
                'unique'  => $index->isUnique(),
                'options' => $index->getOptions(),
                'flags'   => $index->getFlags(),
            ]);
        }

        $metadata->setTable($tableMetadata);
    }