composer require --dev kitloong/laravel-migrations-generator php artisan migrate:generate
40 lines
1.4 KiB
PHP
40 lines
1.4 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('files', function (Blueprint $table) {
|
|
$table->bigIncrements('id');
|
|
$table->unsignedBigInteger('tenant_id')->comment('멀티테넌시');
|
|
$table->string('file_path')->comment('저장경로');
|
|
$table->string('original_name')->comment('원본 파일명');
|
|
$table->string('file_name')->comment('저장 파일명 (난수)');
|
|
$table->string('file_name_old');
|
|
$table->integer('file_size')->nullable();
|
|
$table->string('mime_type', 50)->nullable();
|
|
$table->string('description')->nullable();
|
|
$table->unsignedBigInteger('fileable_id')->comment('Polymorphic - 연결된 모델의 PK');
|
|
$table->string('fileable_type', 100)->comment('Polymorphic - 연결된 모델 클래스명');
|
|
$table->unsignedBigInteger('uploaded_by')->nullable()->comment('업로더 사용자 ID');
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('files');
|
|
}
|
|
};
|