Files
ExpinBot/.svn/pristine/08/086242da5171ff5898713a1b85f351185a88ed85.svn-base
T

48 lines
1.9 KiB
Plaintext

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('group_users', function (Blueprint $table) {
$table->increments('id'); // 主键 + AUTO_INCREMENT
$table->string('message_chat_id', 50)->nullable()->comment('隶属群ID');
$table->string('message_from_id', 15)->nullable()->comment('tg的ID');
$table->string('message_from_first_name', 200)->nullable();
$table->string('message_from_last_name', 50)->nullable();
$table->string('message_from_username', 120)->nullable()->comment('tg的username');
// $table->decimal('rate', 10, 2)->default(0)->comment('费率');
// $table->decimal('exchange_rate', 10, 2)->default(0)->comment('汇率');
// $table->integer('end_time')->nullable()->comment('日结束时间');
$table->integer('operator')->default(0)->comment('操作员 0不是1是');
$table->integer('competence')->default(0)->comment('0普通权限,1管理员');
$table->string('inviter', 50)->nullable()->comment('邀请人');
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->nullable();
// 设置字符集与排序规则
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_0900_ai_ci';
});
// 若需要设置表注释(Laravel 原生不支持)
// 可借助 doctrine/dbal 手动添加,或使用迁移后执行 SQL 语句
DB::statement("ALTER TABLE `group_users` COMMENT = '群用户人员'");
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('group_users');
}
};