refactor: rename the monitor resource type to hardware

This commit is contained in:
fromme committed 2026-09-28 16:41:00 +02:00
1 parent d287cb2600
commit af73dcdc2d
2 files changed
+47 -6

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* The kind outgrew "a monitor": it now covers any piece of hardware that can be lent out, and
* the enum case was renamed from MONITOR to HARDWARE. This brings the stored backing value along,
* so nothing keeps the old word alive -- there are no bookmarked /board/monitor URLs to break.
*
* Every table with a `type` column mapped to ResourceType is updated, not just `resource`:
* a group and a settings row are addressed by the same backing value, and a row left behind
* would simply stop matching its kind.
*/
final class Version20260928161500 extends AbstractMigration
{
private const TABLES = ['resource', 'resource_group', 'resource_type_settings'];
public function getDescription(): string
{
return 'Renames the monitor resource type to hardware';
}
public function up(Schema $schema): void
{
foreach (self::TABLES as $table) {
$this->addSql(\sprintf("UPDATE %s SET type = 'hardware' WHERE type = 'monitor'", $table));
}
}
public function down(Schema $schema): void
{
foreach (self::TABLES as $table) {
$this->addSql(\sprintf("UPDATE %s SET type = 'monitor' WHERE type = 'hardware'", $table));
}
}
}
+6 -6
View File
@@ -20,7 +20,7 @@ enum ResourceType: string
{
case DESK = 'desk';
case PARKING = 'parking';
case MONITOR = 'monitor';
case HARDWARE = 'hardware';
case ROOM = 'room';
case CAR = 'car';
@@ -29,7 +29,7 @@ enum ResourceType: string
return match ($this) {
self::DESK => 'Schreibtisch',
self::PARKING => 'Parkplatz',
self::MONITOR => 'Mobiler Monitor',
self::HARDWARE => 'Gerät',
self::ROOM => 'Zimmer',
self::CAR => 'Fahrzeug',
};
@@ -40,7 +40,7 @@ enum ResourceType: string
return match ($this) {
self::DESK => 'Schreibtische',
self::PARKING => 'Parkplätze',
self::MONITOR => 'Mobile Monitore',
self::HARDWARE => 'Geräte',
self::ROOM => 'Zimmer',
self::CAR => 'Fahrzeuge',
};
@@ -51,7 +51,7 @@ enum ResourceType: string
return match ($this) {
self::DESK => 'Einen Platz im Büro reservieren.',
self::PARKING => 'Einen Stellplatz reservieren.',
self::MONITOR => 'Einen mobilen Monitor ausleihen.',
self::HARDWARE => 'Einen mobilen Monitor o. Ä. ausleihen.',
self::ROOM => 'Ein Zimmer reservieren.',
self::CAR => 'Ein Fahrzeug reservieren.',
};
@@ -70,7 +70,7 @@ enum ResourceType: string
return match ($this) {
self::DESK => 'Raum',
self::PARKING => 'Bereich',
self::MONITOR => 'Standort',
self::HARDWARE => 'Standort',
self::ROOM => 'Standort',
self::CAR => 'Standort',
};
@@ -81,7 +81,7 @@ enum ResourceType: string
return match ($this) {
self::DESK => 'lucide:armchair',
self::PARKING => 'lucide:square-parking',
self::MONITOR => 'lucide:monitor',
self::HARDWARE => 'lucide:monitor',
self::ROOM => 'lucide:door-open',
self::CAR => 'lucide:car',
};