<?php

declare(strict_types=1);

use App\Infrastructure\Db\Migrations\BaseMigration;

final class CreatePolicies extends BaseMigration
{
    public function change(): void
    {
        $table = $this->table('policies');
        $table
            ->addColumn('name', 'string', ['limit' => 128, 'null' => false])
            ->addColumn('description', 'text', ['null' => true])
            ->addColumn('include_manual_blocks', 'boolean', ['null' => false, 'default' => true]);

        $this->addTimestampColumn($table, 'created_at');

        $table
            ->addIndex(['name'], ['unique' => true, 'name' => 'uniq_policies_name'])
            ->create();
    }
}
