<?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('page_revisions', function (Blueprint $t) { $t->id(); $t->unsignedBigInteger('page_id'); $t->longText('content')->nullable(); $t->string('title', 200); $t->string('slug', 180); $t->string('meta_title', 200)->nullable(); $t->string('meta_description', 320)->nullable(); $t->string('meta_keywords', 255)->nullable(); $t->string('og_image', 500)->nullable(); $t->string('canonical_url', 500)->nullable(); $t->string('robots', 60)->nullable(); $t->longText('schema_json')->nullable(); $t->enum('status', ['draft','published']); $t->unsignedBigInteger('created_by_admin_id'); $t->timestamp('created_at')->useCurrent(); $t->index('created_by_admin_id', 'page_revisions_created_by_admin_id_foreign'); $t->index(['page_id', 'created_at'], 'page_revisions_page_id_created_at_index'); $t->foreign('created_by_admin_id', 'page_revisions_created_by_admin_id_foreign')->references('id')->on('admins'); $t->foreign('page_id', 'page_revisions_page_id_foreign')->references('id')->on('pages')->onDelete('cascade'); }); } public function down(): void { Schema::dropIfExists('page_revisions'); } }; 