Files
mykopkb-be/database/migrations/2026_06_14_061334_create_documents_table.php
T

37 lines
1.0 KiB
PHP

<?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('documents', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->uuidMorphs('documentable');
$table->string('name');
$table->string('path', 500);
$table->unsignedBigInteger('file_size')->nullable();
$table->string('mime_type', 100)->nullable();
$table->string('type', 100)->nullable()->default('general')->index();
$table->text('description')->nullable();
$table->foreignUuid('uploaded_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('documents');
}
};