<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddUniqueTaskOccurrenceDate extends Migration
{
    public function up(): void
    {
        $this->db->query(
            'ALTER TABLE task_occurrences ADD UNIQUE INDEX task_occurrences_task_date_unique (task_id, occurrence_date)',
        );
    }

    public function down(): void
    {
        $this->db->query('ALTER TABLE task_occurrences DROP INDEX task_occurrences_task_date_unique');
    }
}
