45 lines
1.3 KiB
PHP
45 lines
1.3 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->id();
|
|
$table->softDeletes();
|
|
$table->uuid()->nullable()->unique();
|
|
$table->foreignId('media_collection_id');
|
|
$table->foreignId('user_id')->nullable();
|
|
$table->enum('media_type', ['video', 'image', 'audio', 'any']);
|
|
$table->enum('media_source', ['ai_generated', 'user_uploaded', 'system_uploaded', 'user_rendered', 'system_rendered']);
|
|
$table->string('name')->nullable();
|
|
$table->string('media_provider');
|
|
$table->string('mime_type');
|
|
$table->string('file_name');
|
|
$table->string('file_path');
|
|
$table->string('disk');
|
|
|
|
$table->timestamps();
|
|
|
|
$table->foreign('media_collection_id')->references('id')->on('media_collections');
|
|
$table->index('media_source');
|
|
$table->index('media_type');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('medias');
|
|
}
|
|
};
|