Merge branch 'develop' into use_new_laravel_scim_server
This commit is contained in:
@@ -314,7 +314,7 @@ class AssetFactory extends Factory
|
||||
{
|
||||
return $this->state(function () {
|
||||
return [
|
||||
'model_id' => 1,
|
||||
'model_id' => AssetModel::factory(),
|
||||
'assigned_to' => Asset::factory(),
|
||||
'assigned_type' => Asset::class,
|
||||
];
|
||||
|
||||
@@ -103,7 +103,7 @@ class CheckoutAcceptanceFactory extends Factory
|
||||
$acceptance->checkoutable->assetlog()->create([
|
||||
'action_type' => 'checkout',
|
||||
'target_id' => $acceptance->assigned_to_id,
|
||||
'target_type' => get_class($acceptance->assignedTo),
|
||||
'target_type' => User::class,
|
||||
'item_id' => $acceptance->checkoutable_id,
|
||||
'item_type' => $acceptance->checkoutable_type,
|
||||
]);
|
||||
|
||||
@@ -115,6 +115,41 @@ class UserFactory extends Factory
|
||||
return $this->appendPermission(['assets.view' => '1']);
|
||||
}
|
||||
|
||||
public function viewAssetHistory()
|
||||
{
|
||||
return $this->appendPermission(['assets.view' => '1']);
|
||||
}
|
||||
|
||||
public function viewUserHistory()
|
||||
{
|
||||
return $this->appendPermission(['users.view' => '1']);
|
||||
}
|
||||
|
||||
public function viewLocationHistory()
|
||||
{
|
||||
return $this->appendPermission(['locations.view' => '1']);
|
||||
}
|
||||
|
||||
public function viewAccessoryHistory()
|
||||
{
|
||||
return $this->appendPermission(['accessories.view' => '1']);
|
||||
}
|
||||
|
||||
public function viewLicenseHistory()
|
||||
{
|
||||
return $this->appendPermission(['licenses.view' => '1']);
|
||||
}
|
||||
|
||||
public function viewComponentHistory()
|
||||
{
|
||||
return $this->appendPermission(['components.view' => '1']);
|
||||
}
|
||||
|
||||
public function viewConsumableHistory()
|
||||
{
|
||||
return $this->appendPermission(['consumables.view' => '1']);
|
||||
}
|
||||
|
||||
public function createAssets()
|
||||
{
|
||||
return $this->appendPermission(['assets.create' => '1']);
|
||||
|
||||
@@ -22,6 +22,14 @@ class AddEolDateOnAssetsTable extends Migration
|
||||
$table->date('asset_eol_date')->after('purchase_date')->nullable()->default(null);
|
||||
}
|
||||
|
||||
// This is a back in time migration to fix restores from very old versions of Snipe-IT where
|
||||
// companies were not soft-deletable.
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('companies', 'deleted_at')) {
|
||||
$table->softDeletes();
|
||||
}
|
||||
});
|
||||
|
||||
// This is a temporary shim so we don't have to modify the asset observer for migrations where
|
||||
// there is a large version difference. (See the AssetObserver notes). This column gets created
|
||||
// later in 2023_07_13_052204_denormalized_eol_and_add_column_for_explicit_date_to_assets.php
|
||||
|
||||
+8
@@ -18,6 +18,13 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('companies', 'deleted_at')) {
|
||||
$table->softDeletes();
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('assets', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('assets', 'eol_explicit')) {
|
||||
$table->boolean('eol_explicit')->default(false)->after('asset_eol_date');
|
||||
@@ -54,6 +61,7 @@ class DenormalizedEolAndAddColumnForExplicitDateToAssets extends Migration
|
||||
->update([
|
||||
'asset_eol_date' => $this->eolUpdateExpression(),
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,8 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
//
|
||||
Artisan::call('snipeit:clean-checkout-acceptances');
|
||||
//Artisan::call('snipeit:clean-checkout-acceptances');
|
||||
// Commenting this out to prevent crashing due to a missing deleted_at clause
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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::table('companies', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('companies', 'deleted_at')) {
|
||||
$table->softDeletes();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void {}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
//
|
||||
Artisan::call('snipeit:clean-checkout-acceptances');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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::table('locations', function (Blueprint $table) {
|
||||
$table->index(['parent_id','deleted_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('locations', function (Blueprint $table) {
|
||||
$table->dropIndex(['parent_id','deleted_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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::table('accessories_checkout', function (Blueprint $table) {
|
||||
$table->index(['assigned_to','assigned_type']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('accessories_checkout', function (Blueprint $table) {
|
||||
$table->dropIndex(['assigned_to','assigned_type']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user