Files
memefast/database/migrations/2025_04_23_103046_create_medias_table.php
2025-06-13 09:44:18 +08:00

46 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('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->string('uploaded_url')->nullable();
$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');
}
};