<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('appointments', function (Blueprint $table) {
            $table->foreignId('speciality_id')->nullable()->after('appointment_type');
            $table->foreignId('organization_id')->nullable()->after('end_time');
        });

        Schema::table('appointment_participants', function (Blueprint $table) {
            $table->foreignId('appointment_id')->nullable()->after('id');
        });
    }

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

        Schema::table('appointment_participants', function (Blueprint $table) {
            $table->dropColumn('appointment_id');
        });
    }
};
