Files
Infra-Management/database/migrations/2024_01_01_000009_create_wiki_table.php
I-Fun c649f055d8 feat: initialize Infra Manager with React, Tailwind CSS, and Inertia.js
- Added main application entry point (app.jsx) and bootstrap file for React setup.
- Created Wiki index page (Index.jsx) for documentation and file management.
- Implemented utility functions for formatting and status handling in utils.js.
- Set up Blade template (app.blade.php) for Inertia.js integration.
- Defined API routes for metrics and terminal access in api.php.
- Established console commands for scheduled tasks in console.php.
- Created web routes for various application features including authentication, hypervisors, containers, cloud accounts, security, backups, and wiki management in web.php.
- Developed setup scripts for Windows (setup.ps1) and Linux (setup.sh) environments.
- Configured Tailwind CSS for styling with custom themes and animations in tailwind.config.js.
- Set up Vite for asset bundling and development server in vite.config.js.
2026-04-07 20:29:32 +07:00

74 lines
2.8 KiB
PHP

<?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('wiki_spaces', function (Blueprint $table) {
$table->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');
}
};