35 lines
1021 B
Plaintext
35 lines
1021 B
Plaintext
<?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->timestamps();
|
|
$table->charset = 'utf8mb4';
|
|
$table->collation = 'utf8mb4_0900_ai_ci';
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('ledger');
|
|
}
|
|
};
|