Skip to content

A self-hosted media server and file management system

temporary table changes don't use yet

aminnausin7bbe7f19c72d
diff --git a/database/migrations/2024_02_10_212124_create_folders_table.php b/database/migrations/2024_02_10_212124_create_folders_table.php
index 8626a811..82a4383b 100644
--- a/database/migrations/2024_02_10_212124_create_folders_table.php
+++ b/database/migrations/2024_02_10_212124_create_folders_table.php
@@ -16,6 +16,10 @@ return new class extends Migration
$table->string('name');
$table->string('path')->unique();
$table->foreignId('category_id')->constrained();
+ $table->foreign('category_id')
+ ->references('id')
+ ->on('categories')
+ ->onDelete('cascade');
});
}
diff --git a/database/migrations/2024_02_10_212508_create_videos_table.php b/database/migrations/2024_02_10_212508_create_videos_table.php
index 5c885eb0..6504a491 100644
--- a/database/migrations/2024_02_10_212508_create_videos_table.php
+++ b/database/migrations/2024_02_10_212508_create_videos_table.php
@@ -16,7 +16,10 @@ return new class extends Migration
$table->string('name');
$table->string('path')->unique();
$table->string('date');
- $table->foreignId('folder_id')->constrained();
+ $table->foreign('folder_id')
+ ->references('id')
+ ->on('folders')
+ ->onDelete('cascade');
});
}
diff --git a/database/migrations/2024_02_27_183528_create_records_table.php b/database/migrations/2024_02_27_183528_create_records_table.php
index 3bda5eba..f8029b8f 100644
--- a/database/migrations/2024_02_27_183528_create_records_table.php
+++ b/database/migrations/2024_02_27_183528_create_records_table.php
@@ -22,7 +22,8 @@ return new class extends Migration
$table->foreign('video_id')
->references('id')
->on('videos')
- ->onDelete('cascade');
+ ->nullable()
+ ->onDelete('set null');
$table->timestamps();
});
}
diff --git a/database/migrations/2024_07_03_040909_cascade_videos.php b/database/migrations/2024_07_03_040909_cascade_videos.php
new file mode 100644
index 00000000..b02eca3f
--- /dev/null
+++ b/database/migrations/2024_07_03_040909_cascade_videos.php
@@ -0,0 +1,28 @@
+<?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('videos', function (Blueprint $table) {
+ //
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('videos', function (Blueprint $table) {
+ //
+ });
+ }
+};
diff --git a/database/migrations/2024_07_03_040919_cascade_folders.php b/database/migrations/2024_07_03_040919_cascade_folders.php
new file mode 100644
index 00000000..92faa0db
--- /dev/null
+++ b/database/migrations/2024_07_03_040919_cascade_folders.php
@@ -0,0 +1,32 @@
+<?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->foreign('category_id')
+ ->references('id')
+ ->on('categories')
+ ->onDelete('cascade')
+ ->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('folders', function (Blueprint $table) {
+ //
+ });
+ }
+};
diff --git a/database/migrations/2024_07_03_040938_nullable_records.php b/database/migrations/2024_07_03_040938_nullable_records.php
new file mode 100644
index 00000000..47f53fd2
--- /dev/null
+++ b/database/migrations/2024_07_03_040938_nullable_records.php
@@ -0,0 +1,28 @@
+<?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('records', function (Blueprint $table) {
+ //
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('records', function (Blueprint $table) {
+ //
+ });
+ }
+};