<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddSourceToAttendances extends Migration
{
    public function up(): void
    {
        $this->forge->addColumn('attendances', [
            'source' => [
                'type'       => 'ENUM',
                'constraint' => ['manual', 'qr_scan'],
                'default'    => 'manual',
                'null'       => false,
                'after'      => 'recorded_by',
            ],
        ]);
    }

    public function down(): void
    {
        $this->forge->dropColumn('attendances', 'source');
    }
}
