feat: group resources into rooms on the floor plan

This commit is contained in:
fromme committed 2026-09-14 08:25:05 +02:00
1 parent faef4d70a8
commit 8caf618950
14 files changed
+653 -34

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260914091500 extends AbstractMigration
{
public function getDescription(): string
{
return 'Adds resource groups (rooms of the office, areas of the car park)';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE resource_group (id INT AUTO_INCREMENT NOT NULL, type VARCHAR(255) NOT NULL, label VARCHAR(50) NOT NULL, position INT NOT NULL, svg_element_id VARCHAR(50) DEFAULT NULL, UNIQUE INDEX uniq_resource_group_label (type, label), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('ALTER TABLE resource ADD group_id INT DEFAULT NULL');
// SET NULL rather than RESTRICT: a group is configuration describing the building, and
// removing a room must leave its desks bookable rather than blocking the delete. The
// plan falls back to drawing them without a frame.
$this->addSql('ALTER TABLE resource ADD CONSTRAINT FK_BC91F416FE54D947 FOREIGN KEY (group_id) REFERENCES resource_group (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_BC91F416FE54D947 ON resource (group_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE resource DROP FOREIGN KEY FK_BC91F416FE54D947');
$this->addSql('DROP INDEX IDX_BC91F416FE54D947 ON resource');
$this->addSql('ALTER TABLE resource DROP group_id');
$this->addSql('DROP TABLE resource_group');
}
}