Edit File: 2021_11_23_084500_create_room_messages_table.php
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateRoomMessagesTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('room_messages', function (Blueprint $table) { $table->id(); $table->enum('type',['text','map','sound','image'])->default('text'); $table->foreignId('sender_id')->constrained()->references('id')->on('users')->onDelete('cascade'); $table->foreignId('receiver_id')->constrained()->references('id')->on('users')->onDelete('cascade'); $table->foreignId('room_id')->constrained()->references('id')->on('rooms')->onDelete('cascade'); $table->text('content'); $table->double('duration')->default('0.0')->nullable(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('room_messages'); } }
Back to File Manager