<?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('bio_specimens', function (Blueprint $table) {
            if (!Schema::hasColumn('bio_specimens', 'atcc')) {
                $table->string('atcc', 150)->nullable()->after('strain');
            }
            if (!Schema::hasColumn('bio_specimens', 'sampleid')) {
                $table->string('sampleid', 150)->nullable()->after('atcc');
            }
        });
    }

    public function down(): void
    {
        Schema::table('bio_specimens', function (Blueprint $table) {
            if (Schema::hasColumn('bio_specimens', 'atcc')) {
                $table->dropColumn('atcc');
            }
            if (Schema::hasColumn('bio_specimens', 'sampleid')) {
                $table->dropColumn('sampleid');
            }
        });
    }
};
