50 lines
2.0 KiB
Plaintext
Executable File
50 lines
2.0 KiB
Plaintext
Executable File
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration {
|
|
public function up(): void
|
|
{
|
|
Schema::create('tg_msg', function (Blueprint $table) {
|
|
$table->id();
|
|
|
|
$table->bigInteger('update_id');
|
|
$table->string('token')->nullable();
|
|
// message 資料
|
|
$table->bigInteger('message_message_id')->nullable();
|
|
$table->bigInteger('message_from_id')->nullable();
|
|
$table->boolean('message_from_is_bot')->nullable();
|
|
$table->string('message_from_first_name')->nullable();
|
|
$table->string('message_from_last_name')->nullable();
|
|
$table->string('message_from_username')->nullable();
|
|
$table->string('message_from_language_code')->nullable();
|
|
$table->bigInteger('message_chat_id')->nullable();
|
|
$table->string('message_chat_title')->nullable();
|
|
$table->string('message_chat_type')->nullable();
|
|
$table->boolean('message_chat_all_members_are_administrators')->nullable();
|
|
$table->dateTime('message_date')->nullable(); // 👈 已改為 datetime
|
|
$table->longText('message_text')->nullable();
|
|
// entities 陣列中的第一個 mention 項目
|
|
$table->integer('message_entities_0_offset')->nullable();
|
|
$table->integer('message_entities_0_length')->nullable();
|
|
$table->string('message_entities_0_type')->nullable();
|
|
// 原始資料
|
|
$table->json('raw')->nullable();
|
|
// Laravel timestamps
|
|
$table->dateTime('created_at')->useCurrent()->nullable();
|
|
$table->dateTime('updated_at')->nullable()->useCurrentOnUpdate();
|
|
// 设置字符集与排序规则
|
|
$table->charset = 'utf8mb4';
|
|
$table->collation = 'utf8mb4_0900_ai_ci';
|
|
});
|
|
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('telegram_messages');
|
|
}
|
|
};
|