<?php
namespace Core\Database\Operations;

use Core\Database\Schema;
use Core\Database\MigrationOperation;

class DropForeignKey implements MigrationOperation
{
    protected string $table;
    protected string $keyName;

    public function __construct(string $table, string $keyName)
    {
        $this->table = $table;
        $this->keyName = $keyName;
    }

    public function up()
    {
        Schema::dropForeignKey($this->table, $this->keyName);
    }

    public function down()
    {
        throw new \Exception("Cannot rollback DropForeignKey: no column info for foreign key '{$this->keyName}'.");
    }
}
