<?php

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

class AddActiveToEspecialityTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('especiality', function (Blueprint $table) {
            $table->boolean('active')->default(true);
        });

        // Actualizar los registros existentes
        DB::table('especiality')->update(['active' => true]);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('especiality', function (Blueprint $table) {
            $table->dropColumn('active');
        });
    }
} 