1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Migrations\Migration; |
6
|
|
|
use Illuminate\Database\Schema\Blueprint; |
7
|
|
|
|
8
|
|
|
class UpdateCallbackQueryTable extends Migration |
9
|
|
|
{ |
10
|
|
|
public function up () |
11
|
|
|
{ |
12
|
|
|
Schema::table(config('phptelegrambot.database.prefix', '') . 'callback_query', static function (Blueprint $table) { |
13
|
|
|
$table->char ('chat_instance', 255)->after('inline_message_id')->default('')->comment ('Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent'); |
14
|
|
|
$table->char ('game_short_name', 255)->after('data')->default('')->comment ('Short name of a Game to be returned, serves as the unique identifier for the game'); |
15
|
|
|
|
16
|
|
|
$table->dropForeign (config('phptelegrambot.database.prefix', '') . 'callback_query_ibfk_2'); |
17
|
|
|
|
18
|
|
|
$table->foreign ( |
19
|
|
|
['chat_id', 'message_id'], |
20
|
|
|
config('phptelegrambot.database.prefix', '') . 'callback_query_ibfk_2' |
21
|
|
|
) |
22
|
|
|
->references (['chat_id', 'id'])->on (config('phptelegrambot.database.prefix', '') . 'message') |
23
|
|
|
->onUpdate('RESTRICT')->onDelete('RESTRICT'); |
24
|
|
|
}); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function down () |
28
|
|
|
{ |
29
|
|
|
Schema::table(config('phptelegrambot.database.prefix', '') . 'callback_query', static function (Blueprint $table) { |
30
|
|
|
$table->dropColumn ('chat_instance'); |
31
|
|
|
$table->dropColumn ('game_short_name'); |
32
|
|
|
|
33
|
|
|
$table->dropForeign (config('phptelegrambot.database.prefix', '') . 'callback_query_ibfk_2'); |
34
|
|
|
|
35
|
|
|
$table->foreign ('chat_id', config('phptelegrambot.database.prefix', '') . 'callback_query_ibfk_2') |
36
|
|
|
->references ('chat_id')->on (config('phptelegrambot.database.prefix', '') . 'message') |
37
|
|
|
->onUpdate('RESTRICT')->onDelete('RESTRICT'); |
38
|
|
|
}); |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
|