<?php

namespace Tenant\Database\Migrations;

use CodeIgniter\Database\Migration;

/**
 * A persisted running counter, not a COUNT(*) over restaurant_reservations
 * at read time — the Phase 2 brief specifically says "store a running
 * no-show count on the guest profile." Incremented by
 * RestaurantReservationModel::markNoShow(); never decremented (a
 * no-show is a fact of history, not reversible bookkeeping).
 */
class AddRestaurantNoShowCountToGuests extends Migration
{
    public function up()
    {
        $this->forge->addColumn('guests', [
            'restaurant_no_show_count' => [
                'type'       => 'INT',
                'constraint' => 10,
                'unsigned'   => true,
                'default'    => 0,
                'after'      => 'notes',
            ],
        ]);
    }

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