<?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::create('serp_checks',function(Blueprint $t){$t->id();$t->ulid('ulid')->unique();$t->foreignId('keyword_id')->constrained()->restrictOnDelete();$t->string('status',20)->default('pending')->index();$t->timestamp('checked_at')->nullable();$t->string('search_engine',16);$t->char('country_code',2);$t->string('language_code',8);$t->string('device',16);$t->string('provider',64)->nullable();$t->unsignedInteger('result_count')->default(0);$t->string('error_code',64)->nullable();$t->text('error_message')->nullable();$t->timestamps();$t->index(['keyword_id','checked_at']);});
 Schema::create('serp_results',function(Blueprint $t){$t->id();$t->foreignId('serp_check_id')->constrained()->restrictOnDelete();$t->unsignedInteger('position');$t->string('result_type',32)->default('organic');$t->string('title',500)->nullable();$t->string('url',2048);$t->string('display_url',500)->nullable();$t->text('snippet')->nullable();$t->boolean('is_project_domain')->default(false);$t->timestamps();$t->unique(['serp_check_id','position']);});
 } public function down():void{Schema::dropIfExists('serp_results');Schema::dropIfExists('serp_checks');}};