id(); $table->string('name'); $table->string('slug')->unique(); $table->text('description')->nullable(); $table->string('icon')->default('BookOpen'); $table->string('color')->default('#3b82f6'); $table->boolean('is_public')->default(false); $table->foreignId('created_by')->constrained('users'); $table->timestamps(); $table->softDeletes(); }); Schema::create('wiki_pages', function (Blueprint $table) { $table->id(); $table->foreignId('space_id')->constrained('wiki_spaces')->cascadeOnDelete(); $table->foreignId('parent_id')->nullable()->constrained('wiki_pages')->nullOnDelete(); $table->string('title'); $table->string('slug'); $table->longText('content'); // Markdown content $table->longText('content_html')->nullable(); // rendered HTML cache $table->json('tags')->nullable(); $table->boolean('is_published')->default(true); $table->integer('order')->default(0); $table->foreignId('created_by')->constrained('users'); $table->foreignId('updated_by')->nullable()->constrained('users'); $table->timestamps(); $table->softDeletes(); $table->unique(['space_id', 'slug']); }); Schema::create('wiki_page_revisions', function (Blueprint $table) { $table->id(); $table->foreignId('page_id')->constrained('wiki_pages')->cascadeOnDelete(); $table->longText('content'); $table->string('change_summary')->nullable(); $table->foreignId('created_by')->constrained('users'); $table->timestamps(); }); Schema::create('wiki_attachments', function (Blueprint $table) { $table->id(); $table->foreignId('page_id')->nullable()->constrained('wiki_pages')->nullOnDelete(); $table->string('filename'); $table->string('original_name'); $table->string('mime_type'); $table->bigInteger('size'); $table->string('path'); $table->string('disk')->default('local'); $table->foreignId('uploaded_by')->constrained('users'); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('wiki_attachments'); Schema::dropIfExists('wiki_page_revisions'); Schema::dropIfExists('wiki_pages'); Schema::dropIfExists('wiki_spaces'); } };