<?php

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

/**
 * Self-service account deletion: when a user requests deletion we stamp this and
 * suspend the account immediately; a later purge (admin / cron) removes the PII.
 */
return new class extends Migration
{
    public function up(): void
    {
        foreach (['users', 'vendors', 'delivery_partners'] as $table) {
            Schema::table($table, function (Blueprint $t) {
                $t->timestamp('deletion_requested_at')->nullable()->after('status');
            });
        }
    }

    public function down(): void
    {
        foreach (['users', 'vendors', 'delivery_partners'] as $table) {
            Schema::table($table, function (Blueprint $t) {
                $t->dropColumn('deletion_requested_at');
            });
        }
    }
};
