Skip to content

A self-hosted media server and file management system

feat: implement subtitles table

aminnausin567b72f13256
diff --git a/database/migrations/2026_01_08_160619_create_subtitles_table.php b/database/migrations/2026_01_08_160619_create_subtitles_table.php
new file mode 100644
index 00000000..667f263b
--- /dev/null
+++ b/database/migrations/2026_01_08_160619_create_subtitles_table.php
@@ -0,0 +1,35 @@
+<?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('subtitles', function (Blueprint $table) {
+ $table->id();
+
+ $table->foreignUuid('metadata_uuid')->constrained('metadata', 'uuid')->cascadeOnDelete();
+ $table->unsignedSmallInteger('track_id');
+ $table->string('language', 16)->nullable();
+ $table->string('codec', 32)->nullable();
+ $table->string('format', 16)->nullable();
+ $table->string('path')->nullable();
+
+ $table->timestamps();
+
+ $table->index(['metadata_uuid']);
+ $table->unique(['metadata_uuid', 'track_id']);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void {
+ Schema::dropIfExists('subtitles');
+ }
+};
diff --git a/database/migrations/2026_01_08_160620_add_subtitle_state_to_metadata.php b/database/migrations/2026_01_08_160620_add_subtitle_state_to_metadata.php
new file mode 100644
index 00000000..7c1e6996
--- /dev/null
+++ b/database/migrations/2026_01_08_160620_add_subtitle_state_to_metadata.php
@@ -0,0 +1,25 @@
+<?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::table('metadata', function (Blueprint $table) {
+ $table->timestamp('subtitles_scanned_at')->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void {
+ Schema::table('metadata', function (Blueprint $table) {
+ $table->dropColumn('subtitles_scanned_at');
+ });
+ }
+};