33 lines
998 B
PHP
33 lines
998 B
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('documents', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete();
|
|
$table->foreignId('project_id')->nullable()->constrained()->nullOnDelete();
|
|
$table->string('title');
|
|
$table->text('description')->nullable();
|
|
$table->string('file_path');
|
|
$table->string('file_type', 50);
|
|
$table->foreignId('uploaded_by')->constrained('users')->cascadeOnDelete();
|
|
$table->timestamps();
|
|
|
|
$table->index('tenant_id');
|
|
$table->index('project_id');
|
|
$table->index('uploaded_by');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('documents');
|
|
}
|
|
};
|