CreateChatTable   A
last analyzed

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 CreateChatTable extends Migration
10
{
11
    public function up(): void
12
    {
13
        Schema::create('chat', static function (Blueprint $table) {
14
            $table->bigInteger('id')->primary()->comment('Unique user or chat identifier');
15
            $table->enum('type', ['private', 'group', 'supergroup', 'channel'])->comment('Chat type, either private, group, supergroup or channel');
16
            $table->char('title')->nullable()->default('')->comment('Chat (group) title, is null if chat type is private');
17
            $table->char('username')->nullable()->comment('Username, for private chats, supergroups and channels if available');
18
            $table->boolean('all_members_are_administrators')->nullable()->default(0)->comment('True if a all members of this group are admins');
19
            $table->timestamps();
20
            $table->bigInteger('old_id')->nullable()->index('old_id')->comment('Unique chat identifier, this is filled when a group is converted to a supergroup');
21
        });
22
    }
23
24
    public function down(): void
25
    {
26
        Schema::dropIfExists('chat');
27
    }
28
}
29