👁 查看:2024_01_01_000010_create_orders_table.php
路径:/home/boguraj1/.trash/database/migrations/2024_01_01_000010_create_orders_table.php
大小:975 B · 修改:2026-07-23 16:13:46 · 权限:0644 · 可写
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrdersTable extends Migration
{
    public function up()
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->id();
            $table->string('order_number')->unique();
            $table->string('name');
            $table->text('address');
            $table->string('mobile', 20);
            $table->text('note')->nullable();
            $table->decimal('subtotal', 10, 2)->default(0);
            $table->decimal('total', 10, 2)->default(0);
            // pending, confirmed, processing, shipped, delivered, cancelled
            $table->enum('status', ['pending', 'confirmed', 'processing', 'shipped', 'delivered', 'cancelled'])->default('pending');
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::dropIfExists('orders');
    }
}