<?php
declare(strict_types=1);

use Phinx\Db\Adapter\AdapterInterface;
use Phinx\Migration\AbstractMigration;

final class UpdateSessionTable extends AbstractMigration
{
    public function up(): void
    {
        $this->table('sessions')
            ->changeColumn('active', AdapterInterface::PHINX_TYPE_BOOLEAN, [
                'null' => false,
                'default' => true
            ])
            ->addColumn('session_data', AdapterInterface::PHINX_TYPE_TEXT)
            ->update();

    }

    public function down(): void
    {
        $this->table('sessions')
            ->changeColumn('active', AdapterInterface::PHINX_TYPE_INTEGER, [
                'length' => 11,
                'null' => false,
            ])
            ->removeColumn('session_data')
            ->update();

    }
}
