Passed
Push — master ( fde606...0af3c0 )
by Armando
08:21
created

CreateConversationTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 18
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 10 1
A down() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
use Illuminate\Database\Migrations\Migration;
6
use Illuminate\Database\Schema\Blueprint;
7
use Illuminate\Support\Facades\Schema;
8
9
class CreateConversationTable extends Migration
10
{
11
    public function up(): void
12
    {
13
        Schema::create('conversation', static function (Blueprint $table) {
14
            $table->bigInteger('id', true)->unsigned()->comment('Unique identifier for this entry');
15
            $table->bigInteger('user_id')->nullable()->index('user_id')->comment('Unique user identifier');
16
            $table->bigInteger('chat_id')->nullable()->index('chat_id')->comment('Unique user or chat identifier');
17
            $table->enum('status', ['active', 'cancelled', 'stopped'])->default('active')->index('status')->comment('Conversation state');
18
            $table->string('command', 160)->nullable()->default('')->comment('Default command to execute');
19
            $table->text('notes')->nullable()->comment('Data stored from command');
20
            $table->timestamps();
21
        });
22
    }
23
24
    public function down(): void
25
    {
26
        Schema::dropIfExists('conversation');
27
    }
28
}
29