Skip to content

Commit a47d406

Browse files
committed
Add migration files
1 parent 350f9d6 commit a47d406

21 files changed

+801
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class CreateBotanShortenerTable extends Migration
7+
{
8+
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('botan_shortener', function (Blueprint $table) {
17+
$table->bigInteger('id', true)->unsigned()->comment('Unique identifier for this entry');
18+
$table->bigInteger('user_id')->nullable()->index('user_id')->comment('Unique user identifier');
19+
$table->text('url', 65535)->comment('Original URL');
20+
$table->char('short_url')->default('')->comment('Shortened URL');
21+
$table->dateTime('created_at')->nullable()->comment('Entry date creation');
22+
});
23+
}
24+
25+
/**
26+
* Reverse the migrations.
27+
*
28+
* @return void
29+
*/
30+
public function down()
31+
{
32+
Schema::drop('botan_shortener');
33+
}
34+
35+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class CreateCallbackQueryTable extends Migration
7+
{
8+
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('callback_query', function (Blueprint $table) {
17+
$table->bigInteger('id')->unsigned()->primary()->comment('Unique identifier for this query');
18+
$table->bigInteger('user_id')->nullable()->index('user_id')->comment('Unique user identifier');
19+
$table->bigInteger('chat_id')->nullable()->index('chat_id')->comment('Unique chat identifier');
20+
$table->bigInteger('message_id')->unsigned()->nullable()->index('message_id')->comment('Unique message identifier');
21+
$table->char('inline_message_id')->nullable()->comment('Identifier of the message sent via the bot in inline mode, that originated the query');
22+
$table->char('data')->default('')->comment('Data associated with the callback button');
23+
$table->dateTime('created_at')->nullable()->comment('Entry date creation');
24+
$table->index(['chat_id', 'message_id'], 'chat_id_2');
25+
});
26+
}
27+
28+
/**
29+
* Reverse the migrations.
30+
*
31+
* @return void
32+
*/
33+
public function down()
34+
{
35+
Schema::drop('callback_query');
36+
}
37+
38+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class CreateChatTable extends Migration
7+
{
8+
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('chat', function (Blueprint $table) {
17+
$table->bigInteger('id')->primary()->comment('Unique user or chat identifier');
18+
$table->enum('type', ['private', 'group', 'supergroup', 'channel'])->comment('Chat type, either private, group, supergroup or channel');
19+
$table->char('title')->nullable()->default('')->comment('Chat (group) title, is null if chat type is private');
20+
$table->char('username')->nullable()->comment('Username, for private chats, supergroups and channels if available');
21+
$table->boolean('all_members_are_administrators')->nullable()->default(0)->comment('True if a all members of this group are admins');
22+
$table->timestamps();
23+
$table->bigInteger('old_id')->nullable()->index('old_id')->comment('Unique chat identifier, this is filled when a group is converted to a supergroup');
24+
});
25+
}
26+
27+
/**
28+
* Reverse the migrations.
29+
*
30+
* @return void
31+
*/
32+
public function down()
33+
{
34+
Schema::drop('chat');
35+
}
36+
37+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class CreateChosenInlineResultTable extends Migration
7+
{
8+
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('chosen_inline_result', function (Blueprint $table) {
17+
$table->bigInteger('id', true)->unsigned()->comment('Unique identifier for this entry');
18+
$table->char('result_id')->default('')->comment('Identifier for this result');
19+
$table->bigInteger('user_id')->nullable()->index('user_id')->comment('Unique user identifier');
20+
$table->char('location')->nullable()->comment('Location object, user\'s location');
21+
$table->char('inline_message_id')->nullable()->comment('Identifier of the sent inline message');
22+
$table->text('query', 65535)->comment('The query that was used to obtain the result');
23+
$table->dateTime('created_at')->nullable()->comment('Entry date creation');
24+
});
25+
}
26+
27+
/**
28+
* Reverse the migrations.
29+
*
30+
* @return void
31+
*/
32+
public function down()
33+
{
34+
Schema::drop('chosen_inline_result');
35+
}
36+
37+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class CreateConversationTable extends Migration
7+
{
8+
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('conversation', function (Blueprint $table) {
17+
$table->bigInteger('id', true)->unsigned()->comment('Unique identifier for this entry');
18+
$table->bigInteger('user_id')->nullable()->index('user_id')->comment('Unique user identifier');
19+
$table->bigInteger('chat_id')->nullable()->index('chat_id')->comment('Unique user or chat identifier');
20+
$table->enum('status', ['active', 'cancelled', 'stopped'])->default('active')->index('status')->comment('Conversation state');
21+
$table->string('command', 160)->nullable()->default('')->comment('Default command to execute');
22+
$table->text('notes', 65535)->nullable()->comment('Data stored from command');
23+
$table->timestamps();
24+
});
25+
}
26+
27+
/**
28+
* Reverse the migrations.
29+
*
30+
* @return void
31+
*/
32+
public function down()
33+
{
34+
Schema::drop('conversation');
35+
}
36+
37+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class CreateEditedMessageTable extends Migration
7+
{
8+
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('edited_message', function (Blueprint $table) {
17+
$table->bigInteger('id', true)->unsigned()->comment('Unique identifier for this entry');
18+
$table->bigInteger('chat_id')->nullable()->index('chat_id')->comment('Unique chat identifier');
19+
$table->bigInteger('message_id')->unsigned()->nullable()->index('message_id')->comment('Unique message identifier');
20+
$table->bigInteger('user_id')->nullable()->index('user_id')->comment('Unique user identifier');
21+
$table->dateTime('edit_date')->nullable()->comment('Date the message was edited in timestamp format');
22+
$table->text('text', 65535)->nullable()->comment('For text messages, the actual UTF-8 text of the message max message length 4096 char utf8');
23+
$table->text('entities',
24+
65535)->nullable()->comment('For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text');
25+
$table->text('caption', 65535)->nullable()->comment('For message with caption, the actual UTF-8 text of the caption');
26+
$table->index(['chat_id', 'message_id'], 'chat_id_2');
27+
});
28+
}
29+
30+
/**
31+
* Reverse the migrations.
32+
*
33+
* @return void
34+
*/
35+
public function down()
36+
{
37+
Schema::drop('edited_message');
38+
}
39+
40+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class CreateInlineQueryTable extends Migration
7+
{
8+
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('inline_query', function (Blueprint $table) {
17+
$table->bigInteger('id')->unsigned()->primary()->comment('Unique identifier for this query');
18+
$table->bigInteger('user_id')->nullable()->index('user_id')->comment('Unique user identifier');
19+
$table->char('location')->nullable()->comment('Location of the user');
20+
$table->text('query', 65535)->comment('Text of the query');
21+
$table->char('offset')->nullable()->comment('Offset of the result');
22+
$table->dateTime('created_at')->nullable()->comment('Entry date creation');
23+
});
24+
}
25+
26+
/**
27+
* Reverse the migrations.
28+
*
29+
* @return void
30+
*/
31+
public function down()
32+
{
33+
Schema::drop('inline_query');
34+
}
35+
36+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class CreateMessageTable extends Migration
7+
{
8+
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('message', function (Blueprint $table) {
17+
$table->bigInteger('chat_id')->comment('Unique chat identifier');
18+
$table->bigInteger('id')->unsigned()->comment('Unique message identifier');
19+
$table->bigInteger('user_id')->nullable()->index('user_id')->comment('Unique user identifier');
20+
$table->dateTime('date')->nullable()->comment('Date the message was sent in timestamp format');
21+
$table->bigInteger('forward_from')->nullable()->index('forward_from')->comment('Unique user identifier, sender of the original message');
22+
$table->bigInteger('forward_from_chat')->nullable()->index('forward_from_chat')->comment('Unique chat identifier, chat the original message belongs to');
23+
$table->bigInteger('forward_from_message_id')->nullable()->comment('Unique chat identifier of the original message in the channel');
24+
$table->dateTime('forward_date')->nullable()->comment('date the original message was sent in timestamp format');
25+
$table->bigInteger('reply_to_chat')->nullable()->index('reply_to_chat')->comment('Unique chat identifier');
26+
$table->bigInteger('reply_to_message')->unsigned()->nullable()->index('reply_to_message')->comment('Message that this message is reply to');
27+
$table->text('media_group_id', 65535)->nullable()->comment('The unique identifier of a media message group this message belongs to');
28+
$table->text('text', 65535)->nullable()->comment('For text messages, the actual UTF-8 text of the message max message length 4096 char utf8mb4');
29+
$table->text('entities',
30+
65535)->nullable()->comment('For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text');
31+
$table->text('audio', 65535)->nullable()->comment('Audio object. Message is an audio file, information about the file');
32+
$table->text('document', 65535)->nullable()->comment('Document object. Message is a general file, information about the file');
33+
$table->text('photo', 65535)->nullable()->comment('Array of PhotoSize objects. Message is a photo, available sizes of the photo');
34+
$table->text('sticker', 65535)->nullable()->comment('Sticker object. Message is a sticker, information about the sticker');
35+
$table->text('video', 65535)->nullable()->comment('Video object. Message is a video, information about the video');
36+
$table->text('voice', 65535)->nullable()->comment('Voice Object. Message is a Voice, information about the Voice');
37+
$table->text('video_note', 65535)->nullable()->comment('VoiceNote Object. Message is a Video Note, information about the Video Note');
38+
$table->text('contact', 65535)->nullable()->comment('Contact object. Message is a shared contact, information about the contact');
39+
$table->text('location', 65535)->nullable()->comment('Location object. Message is a shared location, information about the location');
40+
$table->text('venue', 65535)->nullable()->comment('Venue object. Message is a Venue, information about the Venue');
41+
$table->text('caption', 65535)->nullable()->comment('For message with caption, the actual UTF-8 text of the caption');
42+
$table->text('new_chat_members',
43+
65535)->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)');
44+
$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)');
45+
$table->char('new_chat_title')->nullable()->comment('A chat title was changed to this value');
46+
$table->text('new_chat_photo', 65535)->nullable()->comment('Array of PhotoSize objects. A chat photo was change to this value');
47+
$table->boolean('delete_chat_photo')->nullable()->default(0)->comment('Informs that the chat photo was deleted');
48+
$table->boolean('group_chat_created')->nullable()->default(0)->comment('Informs that the group has been created');
49+
$table->boolean('supergroup_chat_created')->nullable()->default(0)->comment('Informs that the supergroup has been created');
50+
$table->boolean('channel_chat_created')->nullable()->default(0)->comment('Informs that the channel chat has been created');
51+
$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');
52+
$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');
53+
$table->text('pinned_message', 65535)->nullable()->comment('Message object. Specified message was pinned');
54+
$table->text('connected_website', 65535)->nullable()->comment('The domain name of the website on which the user has logged in.');
55+
$table->primary(['chat_id', 'id']);
56+
$table->index(['reply_to_chat', 'reply_to_message'], 'reply_to_chat_2');
57+
});
58+
}
59+
60+
/**
61+
* Reverse the migrations.
62+
*
63+
* @return void
64+
*/
65+
public function down()
66+
{
67+
Schema::drop('message');
68+
}
69+
70+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class CreateRequestLimiterTable extends Migration
7+
{
8+
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('request_limiter', function (Blueprint $table) {
17+
$table->bigInteger('id', true)->unsigned()->comment('Unique identifier for this entry');
18+
$table->char('chat_id')->nullable()->comment('Unique chat identifier');
19+
$table->char('inline_message_id')->nullable()->comment('Identifier of the sent inline message');
20+
$table->char('method')->nullable()->comment('Request method');
21+
$table->dateTime('created_at')->nullable()->comment('Entry date creation');
22+
});
23+
}
24+
25+
/**
26+
* Reverse the migrations.
27+
*
28+
* @return void
29+
*/
30+
public function down()
31+
{
32+
Schema::drop('request_limiter');
33+
}
34+
35+
}

0 commit comments

Comments
 (0)