Initial commit
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
ssww23
2026-03-10 00:55:37 +03:00
parent fc0f28d830
commit 93a655235a
155 changed files with 24768 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('chat_conversations', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
$table->string('visitor_token')->unique();
$table->string('status')->default('open');
$table->timestamp('last_message_at')->nullable()->index();
$table->timestamps();
});
Schema::create('chat_messages', function (Blueprint $table) {
$table->id();
$table->foreignId('chat_conversation_id')->constrained('chat_conversations')->cascadeOnDelete();
$table->string('sender', 20);
$table->text('body');
$table->boolean('is_read')->default(false);
$table->timestamps();
$table->index(['chat_conversation_id', 'created_at']);
$table->index(['chat_conversation_id', 'sender', 'is_read']);
});
}
public function down(): void
{
Schema::dropIfExists('chat_messages');
Schema::dropIfExists('chat_conversations');
}
};