Field Manual Brokerage / Linux / Laravel
← Laravel

database/migrations/2026_01_01_000000_create_orders_table.php

Use this migration OR the generated orders migration, never both. DECIMAL(12,4) is enforced by MySQL; SQLite does not enforce decimal precision.

What it is

Complete brokerage practice file. The Assemble project page lists every file in order.

When to use it

Use this migration OR the generated orders migration, never both. DECIMAL(12,4) is enforced by MySQL; SQLite does not enforce decimal precision.

Syntax

mkdir -p 'database/migrations'
# Paste the Example below into database/migrations/2026_01_01_000000_create_orders_table.php

Example

<?php

declare(strict_types=1);

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

return new class () extends Migration {
    public function up(): void
    {
        Schema::create('orders', function (Blueprint $table): void {
            $table->id();
            $table->uuid('client_order_id')->unique();
            $table->string('exchange_order_id')->nullable()->unique();
            $table->string('symbol');
            $table->string('side');
            $table->string('type');
            $table->unsignedInteger('quantity');
            $table->decimal('price', 12, 4)->nullable();
            $table->string('status')->default('pending');
            $table->text('rejection_message')->nullable();
            $table->timestamps();
        });
    }

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

Common mistakes

Use the setup runbook first. Adapt provisional API assumptions to the supplied contract. Merge into supplied applications; do not duplicate the orders migration.

Related topics

API contract: change these points first