feat(attachments): create Attachment model and migration for file attachments

This commit is contained in:
2026-06-25 12:07:52 -03:00
parent 492c6c4ac2
commit b874a45724
3 changed files with 83 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
<?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('attachments', function (Blueprint $table) {
$table->id();
$table->string('attachable_type');
$table->unsignedBigInteger('attachable_id');
$table->string('path');
$table->string('filename');
$table->string('type')->nullable();
$table->string('mime_type');
$table->boolean('is_public')->default(false);
$table->string('extension', 20)->nullable();
$table->unsignedBigInteger('size')->default(0);
$table->timestamps();
$table->index(['attachable_type', 'attachable_id']);
$table->index('type');
$table->index('mime_type');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('attachments');
}
};