diff --git a/CHANGELOG.md b/CHANGELOG.md index efe363a..3460d4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ Latest * [#121](https://github.com/cleverage/ui-process-bundle/issues/121) `ListAction` / `LaunchAction`: accessed directly (`/process/list`, `/process/launch`), redirected to the dashboard (`/process?routeName=...`) instead of a 500. Add tests. * [#123](https://github.com/cleverage/ui-process-bundle/issues/123) HTTP API: the parameters of the query string are also read without body, and `queue` is read from the query string (the form data takes precedence). Add tests. * [#125](https://github.com/cleverage/ui-process-bundle/issues/125) `ProcessSchedule::getContext()` decodes a JSON string as an array; `User::getRoles()` no longer duplicates `ROLE_USER`; `symfony/expression-language` declared (used by `Assert\When`); the `underscore_number_aware` Doctrine naming strategy prerequisite is documented. Add tests. +* [#127](https://github.com/cleverage/ui-process-bundle/issues/127) `Version20261008120000` migration (MySQL / MariaDB, PostgreSQL): remove the `(DC2Type:...)` column comments created by the migrations when the type comments are not used (always with DBAL 4, `disable_type_comments` with DBAL 3): the schema was always reported as out of sync; with DBAL 3 using the type comments, they are kept. `UiOptions` PHPDoc: types instead of string literals (`'run': ?bool`, context rows `int|string`). v3.0.2 ------ diff --git a/src/Manager/ProcessConfigurationsManager.php b/src/Manager/ProcessConfigurationsManager.php index 913e738..fa97237 100644 --- a/src/Manager/ProcessConfigurationsManager.php +++ b/src/Manager/ProcessConfigurationsManager.php @@ -27,8 +27,8 @@ * 'ui_launch_mode': ?string, * 'entrypoint_type': string, * 'constraints': Constraint[], - * 'run': 'null|bool', - * 'default': array{'input': mixed, 'context': array{array{'key': 'int|text', 'value':'int|text'}}} + * 'run': ?bool, + * 'default': array{'input': mixed, 'context': array} * } */ final readonly class ProcessConfigurationsManager diff --git a/src/Migrations/Version20261008120000.php b/src/Migrations/Version20261008120000.php new file mode 100644 index 0000000..119e982 --- /dev/null +++ b/src/Migrations/Version20261008120000.php @@ -0,0 +1,77 @@ +connection->getConfiguration()->getDisableTypeComments()) { + return; + } + + $platform = $this->connection->getDatabasePlatform(); + if ($platform instanceof MariaDBPlatform || $platform instanceof MySQLPlatform) { + $this->addSql('ALTER TABLE log_record MODIFY context JSON NOT NULL, MODIFY created_at DATETIME NOT NULL'); + $this->addSql('ALTER TABLE process_execution MODIFY start_date DATETIME NOT NULL, MODIFY end_date DATETIME DEFAULT NULL, MODIFY report JSON NOT NULL'); + $this->addSql('ALTER TABLE process_schedule MODIFY context JSON NOT NULL'); + $this->addSql('ALTER TABLE process_user MODIFY roles JSON NOT NULL'); + } + + if ($platform instanceof PostgreSQLPlatform) { + $this->addSql('COMMENT ON COLUMN log_record.created_at IS NULL'); + $this->addSql('COMMENT ON COLUMN process_execution.start_date IS NULL'); + $this->addSql('COMMENT ON COLUMN process_execution.end_date IS NULL'); + } + } + + #[\Override] + public function down(Schema $schema): void + { + if (!$this->connection->getConfiguration()->getDisableTypeComments()) { + return; + } + + $platform = $this->connection->getDatabasePlatform(); + if ($platform instanceof MariaDBPlatform || $platform instanceof MySQLPlatform) { + $this->addSql('ALTER TABLE log_record MODIFY context JSON NOT NULL COMMENT \'(DC2Type:json)\', MODIFY created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\''); + $this->addSql('ALTER TABLE process_execution MODIFY start_date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', MODIFY end_date DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', MODIFY report JSON NOT NULL COMMENT \'(DC2Type:json)\''); + $this->addSql('ALTER TABLE process_schedule MODIFY context JSON NOT NULL COMMENT \'(DC2Type:json)\''); + $this->addSql('ALTER TABLE process_user MODIFY roles JSON NOT NULL COMMENT \'(DC2Type:json)\''); + } + + if ($platform instanceof PostgreSQLPlatform) { + $this->addSql('COMMENT ON COLUMN log_record.created_at IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('COMMENT ON COLUMN process_execution.start_date IS \'(DC2Type:datetime_immutable)\''); + $this->addSql('COMMENT ON COLUMN process_execution.end_date IS \'(DC2Type:datetime_immutable)\''); + } + } +}