File: /home/posscale/www/printmanager/database/migrations/2025_10_13_140541_create_orders_table.php
<?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('orders', function (Blueprint $table) {
$table->id();
$table->integer('printer_instance_id')->nullable();
$table->string('tenant_id', 100)->nullable()->nullable();
$table->unsignedBigInteger('toner_ink_id')->nullable();
$table->unsignedBigInteger('supplier_id')->nullable();
$table->integer('quantity')->default(1);
$table->decimal('total_price', 10, 2)->nullable();
$table->timestamp('order_date')->useCurrent()->nullable();
$table->enum('status', ['Pending', 'Ordered', 'Shipped', 'Delivered', 'Cancelled'])->default('Pending');
$table->boolean('auto_ordered')->default(false);
$table->unsignedBigInteger('user_id')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('orders');
}
};