Schema::create('order_services', function (Blueprint $table) {
$table->foreignId('order_id')->constrained('orders')->onDelete('cascade');
$table->foreignId('service_id')->constrained('services')->onDelete('restrict');
$table->foreignId('mechanic_id')->nullable()->constrained('users')->onDelete('set null');
$table->integer('quantity')->default(1);
$table->decimal('price_at_ordered', 10, 2);
$table->primary(['order_id', 'service_id']);
});
Schema::create('order_parts', function (Blueprint $table) {
$table->foreignId('order_id')->constrained('orders')->onDelete('cascade');
$table->foreignId('part_id')->constrained('spare_parts')->onDelete('restrict');
$table->integer('quantity')->default(1);
$table->decimal('price_at_ordered', 10, 2);
$table->primary(['order_id', 'part_id']);
});