<?php

namespace Tenant\Database\Migrations;

use CodeIgniter\Database\Migration;

/**
 * Alongside the existing date_of_birth — SendBirthdayOffers checks both
 * columns daily. No new "already sent this year" tracking column needed:
 * message_log (message_type birthday_offer/anniversary_offer) already
 * records every attempt with a timestamp, so "sent this year" is just a
 * YEAR(created_at) check against it — same table every other outbound
 * message already writes to, not a parallel tracking mechanism.
 */
class AddAnniversaryDateToGuests extends Migration
{
    public function up()
    {
        $this->forge->addColumn('guests', [
            'anniversary_date' => [
                'type' => 'DATE',
                'null' => true,
                'after' => 'date_of_birth',
            ],
        ]);
    }

    public function down()
    {
        $this->forge->dropColumn('guests', 'anniversary_date');
    }
}
