43 lines
1.2 KiB
PHP
43 lines
1.2 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('photos', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('person_id');
|
|
$table->string('filename');
|
|
$table->string('original_filename')->nullable();
|
|
$table->string('file_path');
|
|
$table->string('mime_type')->nullable();
|
|
$table->integer('file_size')->nullable(); // in KB
|
|
$table->boolean('is_profile_photo')->default(false);
|
|
$table->text('caption')->nullable();
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
|
|
// Foreign key constraint
|
|
$table->foreign('person_id')
|
|
->references('person_id')
|
|
->on('person')
|
|
->onDelete('cascade');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('photos');
|
|
}
|
|
};
|