@@ 8-25 (lines=18) @@ | ||
5 | use Illuminate\Database\Migrations\Migration; |
|
6 | use Illuminate\Database\Schema\Blueprint; |
|
7 | ||
8 | class CreatePollAnswerTable extends Migration |
|
9 | { |
|
10 | public function up() |
|
11 | { |
|
12 | Schema::create(config('phptelegrambot.database.prefix', '') . 'poll_answer', static function (Blueprint $table) { |
|
13 | $table->bigInteger('poll_id')->unsigned()->comment('Unique poll identifier'); |
|
14 | $table->bigInteger('user_id')->comment('The user, who changed the answer to the poll'); |
|
15 | $table->text ('option_ids')->comment ('0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.'); |
|
16 | $table->timestamp('created_at')->nullable()->comment ('Entry date creation'); |
|
17 | $table->primary (['poll_id', 'user_id']); |
|
18 | }); |
|
19 | } |
|
20 | ||
21 | public function down() |
|
22 | { |
|
23 | Schema::dropIfExists(config('phptelegrambot.database.prefix', '') . 'poll_answer'); |
|
24 | } |
|
25 | } |
|
26 |
@@ 8-25 (lines=18) @@ | ||
5 | use Illuminate\Database\Migrations\Migration; |
|
6 | use Illuminate\Database\Schema\Blueprint; |
|
7 | ||
8 | class UpdateChatTable extends Migration |
|
9 | { |
|
10 | public function up () |
|
11 | { |
|
12 | Schema::table(config('phptelegrambot.database.prefix', '') . 'chat', static function (Blueprint $table) { |
|
13 | $table->char ('first_name', 255)->after('username')->nullable()->comment ('First name of the other party in a private chat'); |
|
14 | $table->char ('last_name', 255)->after('first_name')->nullable ()->comment ('Last name of the other party in a private chat'); |
|
15 | }); |
|
16 | } |
|
17 | ||
18 | public function down () |
|
19 | { |
|
20 | Schema::table(config('phptelegrambot.database.prefix', '') . 'chat', static function (Blueprint $table) { |
|
21 | $table->dropColumn ('first_name'); |
|
22 | $table->dropColumn ('last_name'); |
|
23 | }); |
|
24 | } |
|
25 | } |
|
26 |