move into sonardesk

This commit is contained in:
Mark Gregory
2026-10-12 14:50:13 +01:00
parent 5f0d2ceb72
commit 38b4a7406f
879 changed files with 24021 additions and 1 deletions
@@ -0,0 +1,58 @@
<?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('builder_documents', function (Blueprint $table) {
$table->id();
$table->foreignId('site_id')->nullable()->constrained('sites')->nullOnDelete();
$table->string('type', 30)->index();
$table->string('name');
$table->string('slug')->nullable();
$table->string('status', 20)->default('draft')->index();
$table->unsignedInteger('version')->default(1);
$table->json('document')->nullable();
$table->json('settings')->nullable();
$table->nullableMorphs('buildable');
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamp('published_at')->nullable();
$table->timestamps();
$table->unique(['site_id', 'type', 'slug'], 'builder_document_site_type_slug_unique');
});
Schema::create('builder_document_versions', function (Blueprint $table) {
$table->id();
$table->foreignId('builder_document_id')->constrained('builder_documents')->cascadeOnDelete();
$table->unsignedInteger('version');
$table->json('document');
$table->json('settings')->nullable();
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamps();
$table->unique(['builder_document_id', 'version']);
});
Schema::create('builder_templates', function (Blueprint $table) {
$table->id();
$table->string('type', 30)->index();
$table->string('name');
$table->string('slug')->unique();
$table->text('description')->nullable();
$table->json('document');
$table->json('settings')->nullable();
$table->boolean('is_system')->default(false);
$table->boolean('is_active')->default(true)->index();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('builder_templates');
Schema::dropIfExists('builder_document_versions');
Schema::dropIfExists('builder_documents');
}
};