<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

/**
 * A till's opening balance is now required to carry forward from its
 * previous closing balance (enforced in PosSessionService::open()); this
 * column captures the cashier's reason on the rare occasion it's overridden,
 * so the deviation is auditable rather than silently accepted.
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::table('pos_sessions', function (Blueprint $table) {
            $table->string('opening_note', 500)->nullable()->after('opening_balance');
        });
    }

    public function down(): void
    {
        Schema::table('pos_sessions', function (Blueprint $table) {
            $table->dropColumn('opening_note');
        });
    }
};
