@fleetbase/fleetops-engine 0.6.41 → 0.6.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/composer.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbase/fleetops-api",
3
- "version": "0.6.41",
3
+ "version": "0.6.43",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "keywords": [
6
6
  "fleetbase-extension",
package/extension.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Fleet-Ops",
3
- "version": "0.6.41",
3
+ "version": "0.6.43",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "repository": "https://github.com/fleetbase/fleetops",
6
6
  "license": "AGPL-3.0-or-later",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbase/fleetops-engine",
3
- "version": "0.6.41",
3
+ "version": "0.6.43",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "fleetbase": {
6
6
  "route": "fleet-ops"
@@ -1,7 +1,9 @@
1
1
  <?php
2
+
2
3
  use Illuminate\Database\Migrations\Migration;
3
4
  use Illuminate\Database\Schema\Blueprint;
4
5
  use Illuminate\Support\Facades\Schema;
6
+
5
7
  /**
6
8
  * Add Orchestrator constraint columns to the vehicles table.
7
9
  *
@@ -34,6 +36,7 @@ return new class extends Migration {
34
36
  $table->boolean('return_to_depot')->default(true)->after('time_window_end');
35
37
  });
36
38
  }
39
+
37
40
  public function down(): void
38
41
  {
39
42
  Schema::table('vehicles', function (Blueprint $table) {
@@ -1,7 +1,9 @@
1
1
  <?php
2
+
2
3
  use Illuminate\Database\Migrations\Migration;
3
4
  use Illuminate\Database\Schema\Blueprint;
4
5
  use Illuminate\Support\Facades\Schema;
6
+
5
7
  /**
6
8
  * Add Orchestrator capacity columns to the payloads table.
7
9
  *
@@ -24,6 +26,7 @@ return new class extends Migration {
24
26
  $table->unsignedInteger('capacity_parcels')->nullable()->after('capacity_pallets');
25
27
  });
26
28
  }
29
+
27
30
  public function down(): void
28
31
  {
29
32
  Schema::table('payloads', function (Blueprint $table) {
@@ -1,7 +1,9 @@
1
1
  <?php
2
+
2
3
  use Illuminate\Database\Migrations\Migration;
3
4
  use Illuminate\Database\Schema\Blueprint;
4
5
  use Illuminate\Support\Facades\Schema;
6
+
5
7
  /**
6
8
  * Drop redundant denormalised capacity columns from the payloads table.
7
9
  *
@@ -1,7 +1,9 @@
1
1
  <?php
2
+
2
3
  use Illuminate\Database\Migrations\Migration;
3
4
  use Illuminate\Database\Schema\Blueprint;
4
5
  use Illuminate\Support\Facades\Schema;
6
+
5
7
  /**
6
8
  * Correct orchestrator capacity column names on the vehicles table.
7
9
  *
@@ -1,8 +1,7 @@
1
1
  <?php
2
2
 
3
3
  use Illuminate\Database\Migrations\Migration;
4
- use Illuminate\Database\Schema\Blueprint;
5
- use Illuminate\Support\Facades\Schema;
4
+ use Illuminate\Support\Facades\DB;
6
5
 
7
6
  /**
8
7
  * Make `orchestrator_priority` nullable on the orders table.
@@ -20,24 +19,32 @@ use Illuminate\Support\Facades\Schema;
20
19
  * application layer (Order model + controllers) already coerces null to 50,
21
20
  * so NULL values will not appear in practice; the nullable flag is a
22
21
  * belt-and-suspenders safety net for any code path that may have been missed.
22
+ *
23
+ * NOTE: We use raw DB::statement() instead of Blueprint::change() because
24
+ * ->change() relies on Doctrine DBAL to introspect the existing column type,
25
+ * and Doctrine does not recognise MySQL's TINYINT as a mapped type
26
+ * ("Unknown column type tinyinteger requested"), causing the migration to
27
+ * crash on deployment. The raw ALTER TABLE statement is portable across all
28
+ * MySQL/MariaDB versions supported by Fleetbase and requires no extra
29
+ * dependencies.
23
30
  */
24
31
  return new class extends Migration {
25
32
  public function up(): void
26
33
  {
27
- Schema::table('orders', function (Blueprint $table) {
28
- $table->unsignedTinyInteger('orchestrator_priority')->default(50)->nullable()->change();
29
- });
34
+ DB::statement(
35
+ 'ALTER TABLE `orders` MODIFY COLUMN `orchestrator_priority` TINYINT UNSIGNED NULL DEFAULT 50'
36
+ );
30
37
  }
31
38
 
32
39
  public function down(): void
33
40
  {
34
- // First back-fill any NULLs so the NOT NULL constraint can be restored.
35
- \Illuminate\Support\Facades\DB::table('orders')
41
+ // Back-fill any NULLs before restoring the NOT NULL constraint.
42
+ DB::table('orders')
36
43
  ->whereNull('orchestrator_priority')
37
44
  ->update(['orchestrator_priority' => 50]);
38
45
 
39
- Schema::table('orders', function (Blueprint $table) {
40
- $table->unsignedTinyInteger('orchestrator_priority')->default(50)->nullable(false)->change();
41
- });
46
+ DB::statement(
47
+ 'ALTER TABLE `orders` MODIFY COLUMN `orchestrator_priority` TINYINT UNSIGNED NOT NULL DEFAULT 50'
48
+ );
42
49
  }
43
50
  };
@@ -0,0 +1,27 @@
1
+ <?php
2
+
3
+ use Illuminate\Database\Migrations\Migration;
4
+ use Illuminate\Database\Schema\Blueprint;
5
+ use Illuminate\Support\Facades\Schema;
6
+
7
+ return new class extends Migration {
8
+ public function up(): void
9
+ {
10
+ if (!Schema::hasColumn('vehicles', 'internal_id')) {
11
+ Schema::table('vehicles', function (Blueprint $table) {
12
+ $table->string('internal_id')
13
+ ->nullable()
14
+ ->after('public_id');
15
+ });
16
+ }
17
+ }
18
+
19
+ public function down(): void
20
+ {
21
+ if (Schema::hasColumn('vehicles', 'internal_id')) {
22
+ Schema::table('vehicles', function (Blueprint $table) {
23
+ $table->dropColumn('internal_id');
24
+ });
25
+ }
26
+ }
27
+ };
@@ -70,9 +70,9 @@ class OrchestrationPayloadBuilder
70
70
 
71
71
  foreach ($payload->entities as $entity) {
72
72
  // --- Weight ---
73
- $rawWeight = (float) ($entity->weight ?? 0);
73
+ $rawWeight = (float) ($entity->weight ?? 0);
74
74
  $weightUnit = strtolower($entity->weight_unit ?? 'kg');
75
- $weightKg = match ($weightUnit) {
75
+ $weightKg = match ($weightUnit) {
76
76
  'g', 'gram', 'grams' => $rawWeight / 1000,
77
77
  'lb', 'lbs', 'pound', 'pounds' => $rawWeight * 0.453592,
78
78
  'oz', 'ounce', 'ounces' => $rawWeight * 0.0283495,