<?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('keywords',function(Blueprint $t){$t->boolean('tracking_enabled')->default(false)->after('device');$t->string('check_frequency',16)->default('daily')->after('tracking_enabled');$t->timestamp('next_check_at')->nullable()->after('check_frequency');$t->timestamp('last_queued_at')->nullable()->after('next_check_at');$t->index(['tracking_enabled','next_check_at']);});
 Schema::table('serp_checks',function(Blueprint $t){$t->string('phrase',190)->default('')->after('keyword_id');$t->string('active_slot',16)->nullable()->after('status');$t->timestamp('started_at')->nullable();$t->timestamp('completed_at')->nullable();$t->timestamp('failed_at')->nullable();$t->string('provider_reference',191)->nullable();$t->unsignedInteger('duration_ms')->nullable();$t->unique(['keyword_id','active_slot'],'serp_checks_keyword_active_unique');$t->index(['keyword_id','status']);});
 }public function down():void{Schema::table('serp_checks',function(Blueprint $t){$t->dropUnique('serp_checks_keyword_active_unique');$t->dropIndex(['keyword_id','status']);$t->dropColumn(['phrase','active_slot','started_at','completed_at','failed_at','provider_reference','duration_ms']);});Schema::table('keywords',function(Blueprint $t){$t->dropIndex(['tracking_enabled','next_check_at']);$t->dropColumn(['tracking_enabled','check_frequency','next_check_at','last_queued_at']);});}};