소스 검색

Add db migration

Daniel Supernault 4 년 전
부모
커밋
327a0e2d7d
1개의 변경된 파일36개의 추가작업 그리고 0개의 파일을 삭제
  1. 36 0
      database/migrations/2020_11_14_221947_add_type_to_direct_messages_table.php

+ 36 - 0
database/migrations/2020_11_14_221947_add_type_to_direct_messages_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddTypeToDirectMessagesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('direct_messages', function (Blueprint $table) {
+            $table->string('type')->default('text')->nullable()->index()->after('from_id');
+            $table->boolean('is_hidden')->default(false)->index()->after('group_message');
+            $table->json('meta')->nullable()->after('is_hidden');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('direct_messages', function (Blueprint $table) {
+            $table->dropColumn('type');
+            $table->dropColumn('is_hidden');
+            $table->dropColumn('meta');
+        });
+    }
+}