<?php

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

/** Graduate the primary_care specialty to a structural plugin backed by this driver. */
class MakePrimaryCareStructural extends Migration
{
    public function up()
    {
        if (! Schema::hasTable('clc_specialties')) return;
        DB::table('clc_specialties')->whereNull('business_id')->where('code', 'primary_care')
            ->update(['is_structural' => true, 'driver_key' => 'primary_care', 'updated_at' => now()]);
    }

    public function down()
    {
        if (! Schema::hasTable('clc_specialties')) return;
        DB::table('clc_specialties')->whereNull('business_id')->where('code', 'primary_care')
            ->update(['is_structural' => false, 'driver_key' => null, 'updated_at' => now()]);
    }
}
