38 lines
1 KiB
PHP
38 lines
1 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('medias', function (Blueprint $table) {
|
|
$table->uuid('id')->primary();
|
|
$table->uuidMorphs('mediable');
|
|
$table->string('collection')->default('default');
|
|
$table->string('type');
|
|
$table->string('path');
|
|
$table->string('original_filename');
|
|
$table->string('mime_type');
|
|
$table->unsignedBigInteger('size');
|
|
$table->unsignedInteger('order')->default(0);
|
|
$table->json('meta')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->index(['mediable_type', 'mediable_id', 'collection']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('medias');
|
|
}
|
|
};
|