public function addForeignKey(ForeignKey $foreignKey)
    {
        if ($this->hasForeignKey($foreignKey->getName())) {
            throw SchemaException::tableForeignKeyAlreadyExists($this->getName(), $foreignKey->getName());
        }

        foreach ($foreignKey->getLocalColumnNames() as $columnName) {
            if (!$this->hasColumn($columnName)) {
                throw SchemaException::tableColumnDoesNotExist($this->getName(), $columnName);
            }
        }

        if ($this->hasSchema()) {
            foreach ($foreignKey->getForeignColumnNames() as $columnName) {
                if (!$this->getSchema()->getTable($foreignKey->getForeignTableName())->hasColumn($columnName)) {
                    throw SchemaException::tableColumnDoesNotExist($foreignKey->getForeignTableName(), $columnName);
                }
            }
        }

        $this->foreignKeys[$foreignKey->getName()] = $foreignKey;
    }