<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AlterOrdenesTrabajoAddCommentColumns extends Migration
{
    protected array $COLUMNS = [
        'preimpresion_revisada' => [
            'type' => 'BOOL',
            'default' => false
        ],
        'preimpresion_revisada_by' => [
            'type' => 'INT',
            'unsigned' => true,
            'constraint' => 11,
        ],
    ];
    public function up()
    {

        $this->forge->addColumn('ordenes_trabajo',$this->COLUMNS);
        $this->forge->addForeignKey('preimpresion_revisada_by','users','id','NULL','NULL');
        $this->forge->processIndexes('ordenes_trabajo');
    }

    public function down()
    {
        $this->forge->dropForeignKey('ordenes_trabajo','ordenes_trabajo_preimpresion_revisada_by_foreign');
        $this->forge->dropColumn('ordenes_trabajo',array_keys($this->COLUMNS));
    }
}
