<?php

namespace Tenant\Database\Migrations;

use CodeIgniter\Database\Migration;

/**
 * Marks when the pre-arrival reminder was sent for a booking, so the
 * batch command (see App\Commands\SendPreArrivalReminders) never double-
 * sends if it's run more than once on the same day.
 */
class AddReminderSentAtToBookings extends Migration
{
    public function up()
    {
        $this->forge->addColumn('bookings', [
            'reminder_sent_at' => [
                'type' => 'DATETIME',
                'null' => true,
                'after' => 'notes',
            ],
        ]);
    }

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