private function addIndex(DbField $dbField, string $type, bool $exists = true) : bool
    {
        if (empty($type)) {
            return false;
        }

        // skip if table exists and has specified index
        if ($exists && $this->table->hasIndex($dbField->getName())) {
            return false;
        }

        $options = [];
        $options['name'] = $type . '_' . $dbField->getName();
        if ('unique' === $type) {
            $options['unique'] = true;
        }

        $this->table->addIndex($dbField->getName(), $options);

        return true;
    }