<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('users', function (Blueprint $table) {
            // Ajouter les colonnes manquantes si elles n'existent pas
            if (!Schema::hasColumn('users', 'subscription_start_date')) {
                if (!Schema::hasColumn('users', 'subscription_start_date')) { $table->timestamp('subscription_start_date')->nullable(); }
            }
            
            if (!Schema::hasColumn('users', 'subscription_end_date')) {
                if (!Schema::hasColumn('users', 'subscription_end_date')) { $table->timestamp('subscription_end_date')->nullable(); }
            }
        });
    }

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


