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 CreateMessageTable extends Migration |
10
|
|
|
{ |
11
|
|
|
public function up(): void |
12
|
|
|
{ |
13
|
|
|
Schema::create('message', static function (Blueprint $table) { |
14
|
|
|
$table->bigInteger('chat_id')->comment('Unique chat identifier'); |
15
|
|
|
$table->bigInteger('id')->unsigned()->comment('Unique message identifier'); |
16
|
|
|
$table->bigInteger('user_id')->nullable()->index('user_id')->comment('Unique user identifier'); |
17
|
|
|
$table->dateTime('date')->nullable()->comment('Date the message was sent in timestamp format'); |
18
|
|
|
$table->bigInteger('forward_from')->nullable()->index('forward_from')->comment('Unique user identifier, sender of the original message'); |
19
|
|
|
$table->bigInteger('forward_from_chat')->nullable()->index('forward_from_chat')->comment('Unique chat identifier, chat the original message belongs to'); |
20
|
|
|
$table->bigInteger('forward_from_message_id')->nullable()->comment('Unique chat identifier of the original message in the channel'); |
21
|
|
|
$table->dateTime('forward_date')->nullable()->comment('date the original message was sent in timestamp format'); |
22
|
|
|
$table->bigInteger('reply_to_chat')->nullable()->index('reply_to_chat')->comment('Unique chat identifier'); |
23
|
|
|
$table->bigInteger('reply_to_message')->unsigned()->nullable()->index('reply_to_message')->comment('Message that this message is reply to'); |
24
|
|
|
$table->text('media_group_id')->nullable()->comment('The unique identifier of a media message group this message belongs to'); |
25
|
|
|
$table->text('text')->nullable()->comment('For text messages, the actual UTF-8 text of the message max message length 4096 char utf8mb4'); |
26
|
|
|
$table->text('entities')->nullable()->comment('For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text'); |
27
|
|
|
$table->text('audio')->nullable()->comment('Audio object. Message is an audio file, information about the file'); |
28
|
|
|
$table->text('document')->nullable()->comment('Document object. Message is a general file, information about the file'); |
29
|
|
|
$table->text('photo')->nullable()->comment('Array of PhotoSize objects. Message is a photo, available sizes of the photo'); |
30
|
|
|
$table->text('sticker')->nullable()->comment('Sticker object. Message is a sticker, information about the sticker'); |
31
|
|
|
$table->text('video')->nullable()->comment('Video object. Message is a video, information about the video'); |
32
|
|
|
$table->text('voice')->nullable()->comment('Voice Object. Message is a Voice, information about the Voice'); |
33
|
|
|
$table->text('video_note')->nullable()->comment('VoiceNote Object. Message is a Video Note, information about the Video Note'); |
34
|
|
|
$table->text('contact')->nullable()->comment('Contact object. Message is a shared contact, information about the contact'); |
35
|
|
|
$table->text('location')->nullable()->comment('Location object. Message is a shared location, information about the location'); |
36
|
|
|
$table->text('venue')->nullable()->comment('Venue object. Message is a Venue, information about the Venue'); |
37
|
|
|
$table->text('caption')->nullable()->comment('For message with caption, the actual UTF-8 text of the caption'); |
38
|
|
|
$table->text('new_chat_members')->nullable()->comment('List of unique user identifiers, new member(s) were added to the group, information about them (one of these members may be the bot itself)'); |
39
|
|
|
$table->bigInteger('left_chat_member')->nullable()->index('left_chat_member')->comment('Unique user identifier, a member was removed from the group, information about them (this member may be the bot itself)'); |
40
|
|
|
$table->char('new_chat_title')->nullable()->comment('A chat title was changed to this value'); |
41
|
|
|
$table->text('new_chat_photo')->nullable()->comment('Array of PhotoSize objects. A chat photo was change to this value'); |
42
|
|
|
$table->boolean('delete_chat_photo')->nullable()->default(0)->comment('Informs that the chat photo was deleted'); |
43
|
|
|
$table->boolean('group_chat_created')->nullable()->default(0)->comment('Informs that the group has been created'); |
44
|
|
|
$table->boolean('supergroup_chat_created')->nullable()->default(0)->comment('Informs that the supergroup has been created'); |
45
|
|
|
$table->boolean('channel_chat_created')->nullable()->default(0)->comment('Informs that the channel chat has been created'); |
46
|
|
|
$table->bigInteger('migrate_to_chat_id')->nullable()->index('migrate_to_chat_id')->comment('Migrate to chat identifier. The group has been migrated to a supergroup with the specified identifier'); |
47
|
|
|
$table->bigInteger('migrate_from_chat_id')->nullable()->index('migrate_from_chat_id')->comment('Migrate from chat identifier. The supergroup has been migrated from a group with the specified identifier'); |
48
|
|
|
$table->text('pinned_message')->nullable()->comment('Message object. Specified message was pinned'); |
49
|
|
|
$table->text('connected_website')->nullable()->comment('The domain name of the website on which the user has logged in.'); |
50
|
|
|
$table->primary(['chat_id', 'id']); |
51
|
|
|
$table->index(['reply_to_chat', 'reply_to_message'], 'reply_to_chat_2'); |
52
|
|
|
}); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function down(): void |
56
|
|
|
{ |
57
|
|
|
Schema::dropIfExists('message'); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|