Files
animexe/database/migrations/2024_01_01_000050_create_episodes_table.php
2026-07-14 00:01:48 +03:00

42 lines
1.6 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::create('episodes', function (Blueprint $table) {
$table->id();
$table->foreignId('anime_id')->constrained()->onDelete('cascade');
$table->foreignId('season_id')->constrained()->onDelete('cascade');
$table->integer('episode_number');
$table->string('title')->nullable();
$table->text('description')->nullable();
$table->string('thumbnail')->nullable();
$table->integer('duration')->nullable(); // saniye
// BunnyCDN
$table->string('bunny_video_id')->nullable();
$table->string('bunny_library_id')->nullable();
$table->string('video_url')->nullable(); // CDN pull URL
$table->string('m3u8_url')->nullable();
// Kaynak
$table->string('source_url')->nullable(); // Anizium CDN URL
$table->enum('source', ['bunnycdn', 'external', 'direct'])->default('bunnycdn');
// Durum
$table->enum('status', ['pending', 'processing', 'published', 'failed'])->default('pending');
$table->integer('view_count')->default(0);
$table->boolean('is_published')->default(false);
$table->timestamps();
$table->unique(['season_id', 'episode_number']);
});
}
public function down(): void
{
Schema::dropIfExists('episodes');
}
};