<?php

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

/**
 * An account nobody ever bought anything with is removed after a year — and told
 * about it first.
 *
 * The column is what makes "told about it first" provable. Without it the sweep
 * would either write the warning every night for the last fortnight, or send it
 * on exactly one calendar day and lose it whenever that night's run did not
 * happen. Neither is a promise anybody can keep in an AGB.
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->timestamp('dormant_warned_at')->nullable()->after('email_verified_at');
        });
    }

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