]> git.localhorst.tv Git - alttp.git/blobdiff - database/migrations/2024_01_19_090216_chat_evaluation.php
chat log evaluation
[alttp.git] / database / migrations / 2024_01_19_090216_chat_evaluation.php
diff --git a/database/migrations/2024_01_19_090216_chat_evaluation.php b/database/migrations/2024_01_19_090216_chat_evaluation.php
new file mode 100644 (file)
index 0000000..840950c
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+       /**
+        * Run the migrations.
+        *
+        * @return void
+        */
+       public function up()
+       {
+               Schema::table('chat_logs', function (Blueprint $table) {
+                       $table->timestamp('evaluated_at')->nullable()->default(null);
+                       $table->foreignId('user_id')->nullable()->default(null)->constrained();
+                       $table->foreignId('channel_id')->nullable()->default(null)->constrained();
+                       $table->string('type')->default('');
+                       $table->text('text_content')->nullable()->default(null);
+                       $table->boolean('banned')->default(false);
+                       $table->index(['type', 'banned']);
+               });
+       }
+
+       /**
+        * Reverse the migrations.
+        *
+        * @return void
+        */
+       public function down()
+       {
+               Schema::table('chat_logs', function (Blueprint $table) {
+                       $table->dropColumn('evaluated_at');
+                       $table->dropForeign(['user_id']);
+                       $table->dropColumn('user_id');
+                       $table->dropForeign(['channel_id']);
+                       $table->dropColumn('channel_id');
+                       $table->dropColumn('type');
+                       $table->dropColumn('text_content');
+                       $table->dropColumn('banned');
+               });
+       }
+};