<?php
namespace Core\Database\Operations;

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

class ModifyColumn implements MigrationOperation
{
    protected string $table;
    protected string $column;
    protected string $type;

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

    public function up()
    {
        Schema::modifyColumn($this->table, $this->column, $this->type);
    }

    public function down()
    {
        throw new \Exception("Cannot rollback ModifyColumn: original column definition is unavailable.");
    }
}
