public function createForeignKey(
        array $localColumnNames,
        $foreignTable,
        array $foreignColumnNames,
        $onDelete = ForeignKey::RESTRICT,
        $onUpdate = ForeignKey::RESTRICT,
        $name = null
    ) {
        if ($foreignTable instanceof Table) {
            $foreignTable = $foreignTable->getName();
        }

        $foreignKey = new ForeignKey(
            $name,
            $localColumnNames,
            $foreignTable,
            $foreignColumnNames,
            $onDelete,
            $onUpdate
        );

        $this->addForeignKey($foreignKey);

        $this->createIndex($localColumnNames, false, 'idx_'.$foreignKey->getName());

        return $foreignKey;
    }