Skip to content

A self-hosted media server and file management system

update table structure

aminnausin0716f1847cd0
diff --git a/database/migrations/2024_08_14_013845_create_video_meta_data_table.php b/database/migrations/2024_08_14_013845_create_video_meta_data_table.php
index 80be5c19..82b91651 100644
--- a/database/migrations/2024_08_14_013845_create_video_meta_data_table.php
+++ b/database/migrations/2024_08_14_013845_create_video_meta_data_table.php
@@ -13,8 +13,9 @@ return new class extends Migration
{
Schema::create('metadata', function (Blueprint $table) {
$table->id();
- $table->unsignedBigInteger('video_id')->nullable();
+ $table->unsignedBigInteger('video_id')->nullable()->unique();
$table->unsignedBigInteger('editor_id')->nullable();
+ $table->string('composite_id')->unique();
$table->string('title')->nullable();
$table->integer('season')->nullable();
$table->integer('episode')->nullable();
diff --git a/database/migrations/2024_08_14_044416_create_series_table.php b/database/migrations/2024_08_14_044416_create_series_table.php
index 0c9defda..8ceabc20 100644
--- a/database/migrations/2024_08_14_044416_create_series_table.php
+++ b/database/migrations/2024_08_14_044416_create_series_table.php
@@ -13,6 +13,9 @@ return new class extends Migration
{
Schema::create('series', function (Blueprint $table) {
$table->id();
+ $table->unsignedBigInteger('folder_id')->nullable()->unique();
+ $table->unsignedBigInteger('editor_id')->nullable();
+ $table->string('composite_id')->unique(); // This keeps a record of linked folder if database entry is deleted and recreated at the same path. Should prune like once in a while maybe or keep data for archival
$table->string('title')->nullable();
$table->string('description')->nullable();
$table->string('studio')->nullable();
@@ -23,7 +26,10 @@ return new class extends Migration
$table->date('date_start')->nullable();
$table->date('date_end')->nullable();
$table->string('thumbnail_url')->nullable();
- $table->unsignedBigInteger('editor_id')->nullable();
+ $table->foreign('folder_id')
+ ->references('id')
+ ->on('folders')
+ ->nullOnDelete();
$table->foreign('editor_id')
->references('id')
->on('users')
diff --git a/database/migrations/2024_08_14_050329_add_series_link_to_folders_table.php b/database/migrations/2024_08_14_050329_add_series_link_to_folders_table.php
deleted file mode 100644
index 8d124f40..00000000
--- a/database/migrations/2024_08_14_050329_add_series_link_to_folders_table.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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('folders', function (Blueprint $table) {
- $table->unsignedBigInteger('series_id')->nullable();
- $table->foreign('series_id')
- ->references('id')
- ->on('series')
- ->nullOnDelete();
- });
- }
-
- /**
- * Reverse the migrations.
- */
- public function down(): void
- {
- Schema::table('folders', function (Blueprint $table) {
- $table->dropColumn('series_id');
- });
- }
-};
diff --git a/database/migrations/2024_08_15_043043_create_playback_table.php b/database/migrations/2024_08_15_043043_create_playback_table.php
index d4150ff8..2f2b81b6 100644
--- a/database/migrations/2024_08_15_043043_create_playback_table.php
+++ b/database/migrations/2024_08_15_043043_create_playback_table.php
@@ -14,6 +14,7 @@ return new class extends Migration
Schema::create('playback', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('metadata_id')->nullable();
+ $table->unsignedTinyInteger('progress');
$table->foreign('metadata_id')
->references('id')
->on('metadata')