Skip to content

A free open source IT asset/license management system

Belt and suspenders

snipefd5736fac4d6
diff --git a/database/migrations/2023_07_13_052204_denormalized_eol_and_add_column_for_explicit_date_to_assets.php b/database/migrations/2023_07_13_052204_denormalized_eol_and_add_column_for_explicit_date_to_assets.php
index f7a928aeca..274bbdc9e9 100644
--- a/database/migrations/2023_07_13_052204_denormalized_eol_and_add_column_for_explicit_date_to_assets.php
+++ b/database/migrations/2023_07_13_052204_denormalized_eol_and_add_column_for_explicit_date_to_assets.php
@@ -25,11 +25,10 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
});
// This is a back in time migration to fix restores from very old versions of Snipe-IT where
- // companies were not soft-deletable. We will undo this in this migration
- // after the eol_explicit stuff is done
+ // companies were not soft-deletable.
Schema::table('companies', function (Blueprint $table) {
if (! Schema::hasColumn('companies', 'deleted_at')) {
- $table->datetime('deleted_at')->nullable()->default(null);
+ $table->softDeletes();
}
});
@@ -64,11 +63,6 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
'asset_eol_date' => $this->eolUpdateExpression(),
]);
- Schema::table('companies', function (Blueprint $table) {
- if (Schema::hasColumn('companies', 'deleted_at')) {
- $table->dropColumn('deleted_at');
- }
- });
}
diff --git a/database/migrations/2026_03_26_150316_add_deleted_at_to_companies.php b/database/migrations/2026_03_26_150316_add_deleted_at_to_companies.php
index 4faec9c74e..9f448bba28 100644
--- a/database/migrations/2026_03_26_150316_add_deleted_at_to_companies.php
+++ b/database/migrations/2026_03_26_150316_add_deleted_at_to_companies.php
@@ -11,8 +11,11 @@ return new class extends Migration
*/
public function up(): void
{
+
Schema::table('companies', function (Blueprint $table) {
- $table->softDeletes();
+ if (!Schema::hasColumn('companies', 'deleted_at')) {
+ $table->softDeletes();
+ }
});
}