private function removeIndexes(DbField $dbField, bool $exists = true) : void
    {
        if (! $exists) {
            return;
        }

        // remove legacy index
        $this->table->removeIndexByName($dbField->getName());

        // remove unique index
        if (!$dbField->getUnique() && $this->table->hasIndex($dbField->getName())) {
            $indexName = 'unique_' . $dbField->getName();
            $this->table->removeIndexByName($indexName);
        }

        // remove lookup index
        if ('uuid' !== $dbField->getType() && $this->table->hasIndex($dbField->getName())) {
            $indexName = 'lookup_' . $dbField->getName();
            $this->table->removeIndexByName($indexName);
        }
    }