phase oen updates

This commit is contained in:
Mark Gregory
2026-07-27 08:19:38 +01:00
parent 09cad63280
commit 3a93d4eaea
35 changed files with 512 additions and 73 deletions
@@ -0,0 +1,62 @@
<?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('content_types', function (Blueprint $table): void {
$table->id();
$table->string('name');
$table->string('key')->unique();
$table->text('description')->nullable();
$table->json('schema')->nullable();
$table->string('renderer');
$table->json('allowed_regions')->nullable();
$table->boolean('is_system')->default(false);
$table->boolean('is_active')->default(true);
$table->timestamps();
});
Schema::create('content_documents', function (Blueprint $table): void {
$table->id();
$table->foreignId('content_type_id')->constrained('content_types')->cascadeOnDelete();
$table->string('title');
$table->string('slug')->unique();
$table->json('data')->nullable();
$table->string('status')->default('draft')->index();
$table->timestamp('published_at')->nullable()->index();
$table->timestamp('expires_at')->nullable();
$table->string('language', 12)->nullable();
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamps();
$table->softDeletes();
});
Schema::create('page_content', function (Blueprint $table): void {
$table->id();
$table->foreignId('page_id')->nullable()->constrained('pages')->cascadeOnDelete();
$table->string('page_key')->nullable()->index();
$table->foreignId('content_document_id')->constrained('content_documents')->cascadeOnDelete();
$table->string('region')->index();
$table->unsignedInteger('sort_order')->default(0);
$table->boolean('is_enabled')->default(true);
$table->json('visibility_rules')->nullable();
$table->json('presentation')->nullable();
$table->timestamp('starts_at')->nullable();
$table->timestamp('ends_at')->nullable();
$table->timestamps();
$table->unique(['page_key', 'region', 'sort_order'], 'page_content_key_region_order_unique');
});
}
public function down(): void
{
Schema::dropIfExists('page_content');
Schema::dropIfExists('content_documents');
Schema::dropIfExists('content_types');
}
};