<?php

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

return new class extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('aziendas', function (Blueprint $table) {
            // Remove accounting configuration columns
            $table->dropColumn([
                'chiusura_anno_fiscale',
                'scadenza_abbonamenti',
                'scadenza_pagamenti_uscita'
            ]);

            // Add same_address boolean column
            $table->boolean('same_address')->default(false);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('aziendas', function (Blueprint $table) {
            // Add back accounting configuration columns
            $table->date('chiusura_anno_fiscale')->nullable();
            $table->date('scadenza_abbonamenti')->nullable();
            $table->date('scadenza_pagamenti_uscita')->nullable();

            // Remove same_address column
            $table->dropColumn('same_address');
        });
    }
};
