Completed
Pull Request — master (#24)
by
unknown
11:40 queued 10s
created

CreatePollTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 19 1
A down() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
use Illuminate\Database\Migrations\Migration;
6
use Illuminate\Database\Schema\Blueprint;
7
8
class CreatePollTable extends Migration
9
{
10
    public function up()
11
    {
12
        Schema::create(config('phptelegrambot.database.prefix', '') . 'poll', static function (Blueprint $table) {
13
            $table->bigInteger('id')->primary()->unsigned()->comment('Unique poll identifier');
14
            $table->char('question', 255)->comment ('Poll question');
15
            $table->text ('options')->comment ('List of poll options');
16
            $table->integer('total_voter_count')->unsigned()->nullable()->comment ('Total number of users that voted in the poll');
17
            $table->boolean ('is_closed')->nullable()->default(0)->comment('True, if the poll is closed');
18
            $table->boolean ('is_anonymous')->nullable()->default(1)->comment('True, if the poll is anonymous');
19
            $table->char('type', 255)->nullable()->comment('Poll type, currently can be "regular" or "quiz"');
20
            $table->boolean ('allows_multiple_answers')->nullable()->default(0)->comment('True, if the poll allows multiple answers');
21
            $table->integer('correct_option_id')->unsigned()->nullable()->comment ('0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.');
22
            $table->string('explanation', 255)->nullable()->comment('Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters');
23
            $table->text ('explanation_entities')->nullable()->comment ('Special entities like usernames, URLs, bot commands, etc. that appear in the explanation');
24
            $table->integer('open_period')->unsigned()->nullable()->comment ('Amount of time in seconds the poll will be active after creation');
25
            $table->timestamp('close_date')->nullable()->comment('Point in time (Unix timestamp) when the poll will be automatically closed	');
26
            $table->timestamp('created_at')->nullable()->comment ('Entry date creation');
27
        });
28
    }
29
30
    public function down()
31
    {
32
        Schema::dropIfExists(config('phptelegrambot.database.prefix', '') . 'poll');
33
    }
34
}
35