diff --git a/CHANGELOG.md b/CHANGELOG.md index 67b1346..aa4497a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Latest * [#89](https://github.com/cleverage/ui-process-bundle/issues/89) `ProcessConfigurationsManager`: resolve the `ui.default` option with a normalizer instead of nested options defined with `setDefault()` (deprecated since symfony/options-resolver 7.3, removed in 8.0). With Symfony 8, a process launched with the UI form (`ui_launch_mode: form`) without `ui.default` no longer fails (`Cannot use object of type Closure as array`), and `ui.default` is validated again. Add tests. * [#91](https://github.com/cleverage/ui-process-bundle/issues/91) `LoginController`: pass `error` and `last_username` (`AuthenticationUtils`) to the login template, so that a failed login displays the error message and keeps the email. Test updated. * [#95](https://github.com/cleverage/ui-process-bundle/issues/95) `DoctrineProcessHandler`: detach the written `LogRecord` entities after each flush (the Monolog records were detached instead), so that the identity map no longer grows during long processes; `LogRecord::$processExecution` cascade reduced from `all` to `persist`, so that detaching a log record does not detach the current process execution (which would then be inserted again). Add tests. +* [#97](https://github.com/cleverage/ui-process-bundle/issues/97) Align the mapping and the schema created by the migrations: `ProcessSchedule::$input` mapped as `VARCHAR(255)` as created by the migrations (was `TEXT`); `Version20261005120000` migration (MySQL / MariaDB, PostgreSQL) making `log_record.process_execution_id` `NOT NULL` as in the mapping (log records without process execution are deleted). v3.0.2 ------ diff --git a/docs/reference/05-scheduler.md b/docs/reference/05-scheduler.md index b9fa7c6..b47167b 100644 --- a/docs/reference/05-scheduler.md +++ b/docs/reference/05-scheduler.md @@ -14,7 +14,7 @@ Schedules are stored in the `process_schedule` table (`CleverAge\UiProcessBundle | `process` | Code of the process to run. Only public processes can be selected, and the code is validated. | | `type` | `cron` or `every`. | | `expression` | `cron`: a cron expression, e.g. `*/5 * * * *` or `@daily` (see [cron expression triggers](https://symfony.com/doc/current/scheduler.html#cron-expression-triggers)). `every`: a relative time, e.g. `5 seconds`, `1 hour`, `1 day` (see [periodical triggers](https://symfony.com/doc/current/scheduler.html#periodical-triggers)); it must be parsable by `strtotime()`. | -| `input` | Optional process input (string), e.g. a file path. | +| `input` | Optional process input (string, 255 characters max), e.g. a file path. | | `context` | Optional list of key/value pairs, passed as process context. | The schedules list displays the next execution date of `cron` schedules. diff --git a/src/Entity/ProcessSchedule.php b/src/Entity/ProcessSchedule.php index 8eea928..34f7234 100644 --- a/src/Entity/ProcessSchedule.php +++ b/src/Entity/ProcessSchedule.php @@ -45,7 +45,7 @@ class ProcessSchedule )] private string $expression; - #[ORM\Column(type: Types::TEXT, nullable: true)] + #[ORM\Column(length: 255, nullable: true)] private ?string $input = null; /** diff --git a/src/Migrations/Version20261005120000.php b/src/Migrations/Version20261005120000.php new file mode 100644 index 0000000..c896911 --- /dev/null +++ b/src/Migrations/Version20261005120000.php @@ -0,0 +1,61 @@ +connection->getDatabasePlatform(); + $mySql = $platform instanceof MariaDBPlatform || $platform instanceof MySQLPlatform; + if (!$mySql && !$platform instanceof PostgreSQLPlatform) { + return; + } + + // Log records without process execution are never displayed (the UI lists the logs of an execution) + $this->addSql('DELETE FROM log_record WHERE process_execution_id IS NULL'); + $this->addSql($mySql + ? 'ALTER TABLE log_record MODIFY process_execution_id INT NOT NULL' + : 'ALTER TABLE log_record ALTER process_execution_id SET NOT NULL'); + } + + #[\Override] + public function down(Schema $schema): void + { + $platform = $this->connection->getDatabasePlatform(); + $mySql = $platform instanceof MariaDBPlatform || $platform instanceof MySQLPlatform; + if (!$mySql && !$platform instanceof PostgreSQLPlatform) { + return; + } + + $this->addSql($mySql + ? 'ALTER TABLE log_record MODIFY process_execution_id INT DEFAULT NULL' + : 'ALTER TABLE log_record ALTER process_execution_id DROP NOT NULL'); + } +}