Files
Kent-logistics-Laravel/database/migrations/2025_01_01_000000_create_entries_table.php
Abhishek Mali 6e1ae8f380 account section
2025-11-21 16:07:43 +05:30

47 lines
1.4 KiB
PHP

<?php
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('entries', function (Blueprint $table) {
$table->id();
$table->string('entry_no')->unique(); // PAY-2024-001
$table->string('description');
$table->string('region');
$table->unsignedInteger('order_quantity')->default(0); // selected consolidated order count
$table->decimal('amount', 12, 2);
$table->decimal('pending_amount', 12, 2); // always <= amount
$table->date('entry_date'); // auto-today default by controller
// Toggle-based payment states
$table->enum('payment_status', ['unpaid', 'pending', 'paid'])->default('unpaid');
$table->tinyInteger('toggle_pos')->default(0); // 0 left, 1 middle, 2 right
// Dispatch state (for second table)
$table->enum('dispatch_status', [
'pending',
'loading',
'packed',
'dispatched',
'delivered'
])->default('pending');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('entries');
}
};