2024_07_19_063615_create_chat_table.php 1.02 KB
<?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::create('chats', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->nullable(false);
            $table->integer('to_user_id');
            $table->boolean('is_removed')->default(false);
            $table->boolean('is_fixed')->default(false);
            $table->dateTime('fixation_date')->nullable(true);
            $table->dateTime('last_message_date')->nullable(false);
            $table->integer('last_message_id')->nullable(false);
            $table->dateTime('fixed_time')->nullable(true);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('chats');
    }
};