A documentation section has been added to the admin panel.

This commit is contained in:
2024-05-17 21:05:13 +05:00
parent 156d8a9f68
commit 45504791c0
93 changed files with 3495 additions and 10 deletions

View File

@@ -0,0 +1,124 @@
<?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_versions', function (Blueprint $table) {
$table->id();
$table->string('title', 255);
$table->string('slug', 100);
$table->unsignedBigInteger('project_id')->index();
$table->foreign('project_id')->references('id')->on('projects');
$table->boolean('is_public')->default(0);
$table->unsignedInteger('status')->index();
$table->timestamps();
$table->softDeletes()->index();
$table->unique(['project_id', 'slug']);
$table->index(['is_public', 'deleted_at']);
});
Schema::create('documentation_categories', function (Blueprint $table) {
$table->id();
$table->string('slug');
$table->boolean('is_public')->default(0);
$table->integer('sort')->index();
$table->unsignedBigInteger('version_id')->index();
$table->foreign('version_id')->references('id')->on('documentation_versions');
$table->unsignedBigInteger('parent_id')->nullable()->index();
$table->foreign('parent_id')->references('id')->on('documentation_categories');
$table->timestamps();
$table->softDeletes()->index();
$table->index(['slug', 'version_id', 'deleted_at']);
$table->index(['slug', 'version_id', 'is_public', 'deleted_at'], 'slug_version_id_is_public_deleted_at_index');
$table->index(['parent_id', 'deleted_at']);
$table->index(['parent_id', 'is_public', 'deleted_at']);
$table->unique(['version_id', 'slug']);
});
Schema::create('documentation_category_content', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('category_id')->index();
$table->foreign('category_id')->references('id')->on('documentation_categories');
$table->unsignedBigInteger('language_id')->index();
$table->foreign('language_id')->references('id')->on('project_languages');
$table->string('title', 255);
$table->timestamps();
$table->softDeletes();
$table->index(['category_id', 'language_id', 'deleted_at'], 'category_language_deleted_index');
});
Schema::create('documentation', function (Blueprint $table) {
$table->id();
$table->string('slug');
$table->unsignedBigInteger('version_id')->index();
$table->foreign('version_id')->references('id')->on('documentation_versions');
$table->unsignedBigInteger('category_id')->nullable()->index();
$table->foreign('category_id')->references('id')->on('documentation_categories');
$table->boolean('is_public')->default(0)->index();
$table->integer('sort')->index();
$table->timestamps();
$table->softDeletes()->index();
$table->index(['slug', 'version_id', 'deleted_at']);
$table->index(['slug', 'version_id', 'is_public', 'deleted_at']);
$table->index(['category_id', 'deleted_at']);
$table->index(['category_id', 'is_public', 'deleted_at']);
$table->unique(['version_id', 'slug']);
});
Schema::create('documentation_content', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('documentation_id')->index();
$table->foreign('documentation_id')->references('id')->on('documentation');
$table->unsignedBigInteger('language_id')->index();
$table->foreign('language_id')->references('id')->on('project_languages');
$table->string('title', 255);
$table->longText('content')->nullable();
$table->timestamps();
$table->softDeletes();
$table->index(['documentation_id', 'language_id', 'deleted_at'], 'content_documentation_language_deleted_index');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('documentation_content');
Schema::dropIfExists('documentation');
Schema::dropIfExists('documentation_category_content');
Schema::dropIfExists('documentation_categories');
Schema::dropIfExists('documentation_versions');
}
};