Added Documentation
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('documentation_categories', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('name')->comment('Human-readable category name.');
|
||||
$table->string('slug')->unique()->comment('URL-safe category identifier.');
|
||||
$table->string('icon')->nullable()->comment('Optional UI icon class or key.');
|
||||
$table->string('colour', 32)->default('emerald')->comment('Display colour token.');
|
||||
$table->text('description')->nullable()->comment('Category description shown in the documentation UI.');
|
||||
$table->unsignedInteger('sort_order')->default(0)->index()->comment('Manual display order.');
|
||||
$table->boolean('is_active')->default(true)->index()->comment('Whether the category is visible and usable.');
|
||||
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete()->comment('User that created the category.');
|
||||
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete()->comment('Last user that updated the category.');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('documentation_categories');
|
||||
}
|
||||
};
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('documentation_documents', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('documentation_category_id')->nullable()->constrained('documentation_categories')->nullOnDelete()->comment('Optional owning documentation category.');
|
||||
$table->string('title')->comment('Document title.');
|
||||
$table->string('slug')->unique()->comment('URL-safe document identifier.');
|
||||
$table->string('summary', 500)->nullable()->comment('Short document summary.');
|
||||
$table->longText('body')->nullable()->comment('Full document body, markdown or HTML-safe text depending on editor implementation.');
|
||||
$table->string('status', 32)->default('draft')->index()->comment('Workflow status: draft, published, or archived.');
|
||||
$table->boolean('is_featured')->default(false)->index()->comment('Whether this document is highlighted on the documentation dashboard.');
|
||||
$table->string('version', 50)->default('1.0.0')->comment('Document version label.');
|
||||
$table->string('reference', 100)->nullable()->index()->comment('Optional business reference or document code.');
|
||||
$table->string('attachment_disk')->nullable()->comment('Storage disk used for the attached file.');
|
||||
$table->string('attachment_path')->nullable()->comment('Storage path for the attached file.');
|
||||
$table->string('attachment_name')->nullable()->comment('Original uploaded file name.');
|
||||
$table->string('attachment_mime')->nullable()->comment('Uploaded file MIME type.');
|
||||
$table->unsignedBigInteger('attachment_size')->nullable()->comment('Uploaded file size in bytes.');
|
||||
$table->timestamp('published_at')->nullable()->index()->comment('Date/time the document was published.');
|
||||
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete()->comment('User that created the document.');
|
||||
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete()->comment('Last user that updated the document.');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['status', 'is_featured']);
|
||||
$table->index(['documentation_category_id', 'status']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('documentation_documents');
|
||||
}
|
||||
};
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('documentation_attachments', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('documentation_document_id')->constrained('documentation_documents')->cascadeOnDelete()->comment('Owning documentation document.');
|
||||
$table->string('disk')->comment('Storage disk used for the uploaded attachment.');
|
||||
$table->string('path')->comment('Storage path for the uploaded attachment.');
|
||||
$table->string('original_name')->comment('Original uploaded file name.');
|
||||
$table->string('mime_type')->nullable()->comment('Uploaded file MIME type.');
|
||||
$table->unsignedBigInteger('size')->nullable()->comment('Uploaded file size in bytes.');
|
||||
$table->foreignId('uploaded_by')->nullable()->constrained('users')->nullOnDelete()->comment('User that uploaded the attachment.');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['documentation_document_id', 'created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('documentation_attachments');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user