55 lines
1.9 KiB
PHP
55 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DoctrineMigrations;
|
|
|
|
use Doctrine\DBAL\Schema\Schema;
|
|
use Doctrine\Migrations\AbstractMigration;
|
|
|
|
/**
|
|
* The append-only store behind the assignment and disposition statistics.
|
|
*
|
|
* Written by hand rather than diffed: the schema carries unrelated drift (JSON column
|
|
* comments, a messenger index) that a generated diff would sweep in alongside this table.
|
|
*/
|
|
final class Version20260826000000 extends AbstractMigration
|
|
{
|
|
public function getDescription(): string
|
|
{
|
|
return 'Create statistics_event, the append-only store for assignment and disposition metrics';
|
|
}
|
|
|
|
public function up(Schema $schema): void
|
|
{
|
|
$this->addSql(<<<'SQL'
|
|
CREATE TABLE statistics_event (
|
|
id INT AUTO_INCREMENT NOT NULL,
|
|
name VARCHAR(64) NOT NULL,
|
|
occurred_at DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)',
|
|
actor_id INT DEFAULT NULL,
|
|
actor_label VARCHAR(180) DEFAULT NULL,
|
|
actor_role VARCHAR(32) DEFAULT NULL,
|
|
assignment_id INT DEFAULT NULL,
|
|
disposition_id INT DEFAULT NULL,
|
|
application_id INT DEFAULT NULL,
|
|
teamer_id INT DEFAULT NULL,
|
|
destination_id INT DEFAULT NULL,
|
|
job_profile_id INT DEFAULT NULL,
|
|
hotel_code VARCHAR(8) DEFAULT NULL,
|
|
payload JSON NOT NULL,
|
|
INDEX IDX_A343D13C5E237E0687C03D1B (name, occurred_at),
|
|
INDEX IDX_A343D13C5E237E06C0D0E610 (name, hotel_code),
|
|
INDEX IDX_A343D13CD19302F8 (assignment_id),
|
|
INDEX IDX_A343D13C4302FF75 (teamer_id),
|
|
PRIMARY KEY(id)
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
|
|
SQL);
|
|
}
|
|
|
|
public function down(Schema $schema): void
|
|
{
|
|
$this->addSql('DROP TABLE statistics_event');
|
|
}
|
|
}
|