Files
ephub/migrations/Version20260925120000.php

29 lines
1007 B
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20260925120000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Adds the access codes for doors, the lift and the barrier';
}
public function up(Schema $schema): void
{
// No unique key: rotating a code means a second row for the same door, kept apart by
// valid_from. The index is on that, since every read orders by it.
$this->addSql('CREATE TABLE access_code (id INT AUTO_INCREMENT NOT NULL, label VARCHAR(50) NOT NULL, code VARCHAR(32) NOT NULL, valid_from DATE NOT NULL, description VARCHAR(255) DEFAULT NULL, visibility VARCHAR(20) NOT NULL, INDEX idx_access_code_valid_from (valid_from), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE access_code');
}
}