fixing documentation area
This commit is contained in:
+79
@@ -0,0 +1,79 @@
|
||||
<?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
|
||||
{
|
||||
if (! Schema::hasTable('documentation_categories')) {
|
||||
Schema::create('documentation_categories', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('name', 150);
|
||||
$table->string('slug', 180)->unique();
|
||||
$table->string('icon', 80)->nullable();
|
||||
$table->string('colour', 32)->default('blue');
|
||||
$table->text('description')->nullable();
|
||||
$table->unsignedInteger('sort_order')->default(0)->index();
|
||||
$table->boolean('is_active')->default(true)->index();
|
||||
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasTable('documentation_documents')) {
|
||||
Schema::create('documentation_documents', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('documentation_category_id')->nullable()->constrained('documentation_categories')->nullOnDelete();
|
||||
$table->string('title', 220);
|
||||
$table->string('slug', 240)->unique();
|
||||
$table->string('summary', 500)->nullable();
|
||||
$table->longText('body')->nullable();
|
||||
$table->string('status', 40)->default('draft')->index();
|
||||
$table->boolean('is_featured')->default(false)->index();
|
||||
$table->string('version', 50)->default('1.0.0');
|
||||
$table->string('reference', 100)->nullable()->index();
|
||||
$table->string('attachment_disk')->nullable();
|
||||
$table->string('attachment_path')->nullable();
|
||||
$table->string('attachment_name')->nullable();
|
||||
$table->string('attachment_mime')->nullable();
|
||||
$table->unsignedBigInteger('attachment_size')->nullable();
|
||||
$table->timestamp('published_at')->nullable()->index();
|
||||
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasTable('documentation_attachments')) {
|
||||
Schema::create('documentation_attachments', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('documentation_document_id')->constrained('documentation_documents')->cascadeOnDelete();
|
||||
$table->string('disk')->default('public');
|
||||
$table->string('path');
|
||||
$table->string('original_name');
|
||||
$table->string('mime_type')->nullable();
|
||||
$table->unsignedBigInteger('size')->nullable();
|
||||
$table->foreignId('uploaded_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('documentation_attachments');
|
||||
Schema::dropIfExists('documentation_documents');
|
||||
Schema::dropIfExists('documentation_categories');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user