<?php

use App\Enums\DbStatusFieldEnum;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        /*  moved to create migration
            Schema::table('profit_centers', function (Blueprint $table) {
               $table->string('nameId')->nullable();; //betu azonosito
               $table->string('email')->nullable();
               $table->string('postCode')->nullable();
               $table->string('city')->nullable();
               $table->string('street')->nullable();
               $table->string('phone')->nullable();
               $table->string('mobil')->nullable();
               $table->string('note')->nullable(); //megjegyezes
               $table->boolean('canSee')->default(true);
               $table->enum('status', DbStatusFieldEnum::getValues())->default(DbStatusFieldEnum::draft);
           });
           if (Schema::hasColumn('profit_centers', 'address')){
               DB::statement("update profit_centers set street=address");
               Schema::table('profit_centers', function (Blueprint $table) {
                   $table->dropColumn('address');
               });
           }*/
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {

        /*
        Schema::table('profit_centers', function (Blueprint $table) {
             $table->string('address')->nullable();
         });
         DB::statement("update profit_centers set address=street");
         Schema::table('profit_centers', function (Blueprint $table) {
         $table->dropColumn('nameId');
         $table->dropColumn('email');;
         $table->dropColumn('postCode');
         $table->dropColumn('city');
         $table->dropColumn('street');
         $table->dropColumn('phone');
         $table->dropColumn('mobil');
         $table->dropColumn('note');
         $table->dropColumn('canSee');
         $table->dropColumn('status');
         });
        */

    }
};
