首次提交 Laravel 專案
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?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->dateTime('created_at')->useCurrent()->nullable();
|
||||
$table->dateTime('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');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user