Skip to content

A free open source IT asset/license management system

Switch from timestamp to datetime for maintenance completed_at

snipe4c29fae6d3ca
diff --git a/database/migrations/2026_07_21_000002_change_maintenance_completed_at_to_datetime.php b/database/migrations/2026_07_21_000002_change_maintenance_completed_at_to_datetime.php
new file mode 100644
index 0000000000..ef60967e90
--- /dev/null
+++ b/database/migrations/2026_07_21_000002_change_maintenance_completed_at_to_datetime.php
@@ -0,0 +1,31 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ /**
+ * completed_at was added in 2026_05_18_094309 as a TIMESTAMP. The
+ * 2026_07_17_000001 migration moved start_date and completion_date
+ * (now expected_completion_date) to DATETIME for consistency and to
+ * dodge TIMESTAMP's 2038 range limit + session-timezone auto-
+ * conversion, but skipped completed_at. This finishes that job.
+ *
+ * Values fit in both types, so no data transformation is required.
+ */
+ public function up(): void
+ {
+ Schema::table('maintenances', function (Blueprint $table) {
+ $table->dateTime('completed_at')->nullable()->change();
+ });
+ }
+
+ public function down(): void
+ {
+ Schema::table('maintenances', function (Blueprint $table) {
+ $table->timestamp('completed_at')->nullable()->change();
+ });
+ }
+};