<?php
namespace Core\Database\Operations;

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

class RenameColumn implements MigrationOperation
{
    protected string $table;
    protected string $old;
    protected string $new;
    protected string $type;

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

    public function up()
    {
        Schema::renameColumn($this->table, $this->old, $this->new, $this->type);
    }

    public function down()
    {
        Schema::renameColumn($this->table, $this->new, $this->old, $this->type);
    }
}
