<?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('keywords',function(Blueprint $t){$t->id();$t->ulid('ulid')->unique();$t->foreignId('project_id')->constrained()->restrictOnDelete();$t->string('phrase',190);$t->string('normalized_phrase',190);$t->string('search_engine',16);$t->char('country_code',2);$t->string('language_code',8);$t->string('device',16);$t->string('status',20)->default('active')->index();$t->timestamp('archived_at')->nullable()->index();$t->timestamps();$t->index(['search_engine','country_code','language_code','device'],'keywords_target_index');$t->unique(['project_id','normalized_phrase','search_engine','country_code','language_code','device'],'keywords_target_unique');});} public function down():void{Schema::dropIfExists('keywords');}};