ExpinBot/.svn/pristine/99/99bc3d2deda5e1f6da20f885913...

37 lines
1.2 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
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('ledger', function (Blueprint $table) {
$table->increments('id'); // 主键 + AUTO_INCREMENT
$table->string('chat_id', 50)->comment('隶属群ID');
$table->string('user_id', 15)->comment('tg的ID');
$table->integer('type')->default(0)->comment('0收入1支出');
$table->dateTime('date')->nullable()->comment('记账时间');
$table->decimal('amount', 12, 2)->default(0)->comment('金额');
$table->timestamp('created_at')->useCurrent()->nullable();
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_0900_ai_ci';
$table->comment('收支记录');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ledger');
}
};