Files
myep-team/migrations/Version20261015154754.php
T

39 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Adds the staffing matrix and what the assignment generator needs from the travel import.
*
* destination.product_code is the travel code MyE&P reports per date; destination.imported_at
* tells the dates the latest import reported from ones cancelled upstream, which the import
* never deletes. Both stay NULL until the next app:myep-import.
*
* Written by hand rather than taken from doctrine:migrations:diff, which also carries the
* pre-existing drift of the dev database.
*/
final class Version20261015154754 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add the staffing_rule table and destination.product_code / imported_at';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE staffing_rule (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, product_code VARCHAR(32) NOT NULL, guides INT NOT NULL, ski_beginner TINYINT NOT NULL, ski_advanced TINYINT NOT NULL, split TINYINT NOT NULL, guiding TINYINT NOT NULL, bus_escort TINYINT NOT NULL, enabled TINYINT NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, deleted_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_91DFB1A2D17F50A6 (uuid), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('ALTER TABLE destination ADD product_code VARCHAR(32) DEFAULT NULL, ADD imported_at DATETIME DEFAULT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE staffing_rule');
$this->addSql('ALTER TABLE destination DROP product_code, DROP imported_at');
}
}