1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Migrations\Migration; |
6
|
|
|
use Illuminate\Database\Schema\Blueprint; |
7
|
|
|
|
8
|
|
|
class UpdateMessageTable extends Migration |
9
|
|
|
{ |
10
|
|
|
public function up () |
11
|
|
|
{ |
12
|
|
|
Schema::table(config('phptelegrambot.database.prefix', '') . 'message', static function (Blueprint $table) { |
13
|
|
|
$table->text ('forward_signature')->after ('forward_from_message_id')->nullable()->comment ('For messages forwarded from channels, signature of the post author if present'); |
14
|
|
|
$table->text ('forward_sender_name')->after ('forward_signature')->nullable()->comment ('Sender\'s name for messages forwarded from users who disallow adding a link to their account in forwarded messages'); |
15
|
|
|
$table->bigInteger('edit_date')->after('reply_to_message')->unsigned()->nullable()->comment('Date the message was last edited in Unix time'); |
16
|
|
|
$table->text ('author_signature')->after ('media_group_id')->nullable()->comment ('Signature of the post author for messages in channels'); |
17
|
|
|
$table->text ('caption_entities')->after ('entities')->nullable()->comment('For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption'); |
18
|
|
|
$table->text('animation')->after('document')->nullable()->comment('Message is an animation, information about the animation'); |
19
|
|
|
$table->text('game')->after('animation')->nullable()->comment('Game object. Message is a game, information about the game'); |
20
|
|
|
$table->text('poll')->after('venue')->nullable()->comment ('Poll object. Message is a native poll, information about the poll'); |
21
|
|
|
$table->text('dice')->after('poll')->nullable()->comment ('Message is a dice with random value from 1 to 6'); |
22
|
|
|
$table->text('invoice')->after('pinned_message')->nullable()->comment ('Message is an invoice for a payment, information about the invoice'); |
23
|
|
|
$table->text('successful_payment')->after('invoice')->nullable()->comment ('Message is a service message about a successful payment, information about the payment'); |
24
|
|
|
$table->text('passport_data')->after('connected_website')->nullable()->comment ('Telegram Passport data'); |
25
|
|
|
$table->text('reply_markup')->after('passport_data')->nullable()->comment ('Inline keyboard attached to the message'); |
26
|
|
|
|
27
|
|
|
// Foreign indexes |
28
|
|
|
$table->dropForeign (config('phptelegrambot.database.prefix', '') . 'message_ibfk_5'); |
29
|
|
|
$table->foreign ( |
30
|
|
|
['reply_to_chat', 'reply_to_message'], |
31
|
|
|
config('phptelegrambot.database.prefix', '') . 'message_ibfk_5' |
32
|
|
|
) |
33
|
|
|
->references (['chat_id', 'id'])->on (config('phptelegrambot.database.prefix', '') . 'message') |
34
|
|
|
->onUpdate('RESTRICT')->onDelete('RESTRICT'); |
35
|
|
|
|
36
|
|
|
$table->foreign ( |
37
|
|
|
'forward_from', |
38
|
|
|
config('phptelegrambot.database.prefix', '') . 'message_ibfk_6' |
39
|
|
|
) |
40
|
|
|
->references ('id')->on (config('phptelegrambot.database.prefix', '') . 'user') |
41
|
|
|
->onUpdate('RESTRICT')->onDelete('RESTRICT'); |
42
|
|
|
}); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function down () |
46
|
|
|
{ |
47
|
|
|
Schema::table(config('phptelegrambot.database.prefix', '') . 'message', static function (Blueprint $table) { |
48
|
|
|
$table->dropColumn ('forward_signature'); |
49
|
|
|
$table->dropColumn ('forward_sender_name'); |
50
|
|
|
$table->dropColumn ('edit_date'); |
51
|
|
|
$table->dropColumn ('author_signature'); |
52
|
|
|
$table->dropColumn ('caption_entities'); |
53
|
|
|
$table->dropColumn ('animation'); |
54
|
|
|
$table->dropColumn ('game'); |
55
|
|
|
$table->dropColumn ('poll'); |
56
|
|
|
$table->dropColumn ('dice'); |
57
|
|
|
$table->dropColumn ('invoice'); |
58
|
|
|
$table->dropColumn ('successful_payment'); |
59
|
|
|
$table->dropColumn ('passport_data'); |
60
|
|
|
$table->dropColumn ('reply_markup'); |
61
|
|
|
|
62
|
|
|
$table->dropForeign (config('phptelegrambot.database.prefix', '') . 'message_ibfk_5'); |
63
|
|
|
$table->dropForeign (config('phptelegrambot.database.prefix', '') . 'message_ibfk_6'); |
64
|
|
|
|
65
|
|
|
$table->foreign ('reply_to_chat', config('phptelegrambot.database.prefix', '') . 'message_ibfk_5') |
66
|
|
|
->references ('chat_id')->on (config('phptelegrambot.database.prefix', '') . 'message') |
67
|
|
|
->onUpdate('RESTRICT')->onDelete('RESTRICT'); |
68
|
|
|
}); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|