From e41c135bd297fd6c308d2c7966d3cf6e07335621 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Mon, 5 Oct 2026 15:26:26 +0200 Subject: [PATCH] fix #97 Make process_execution.context nullable, as in the mapping process_execution.context was created as NOT NULL by Version20241007152613 while the mapping declares it nullable. Handled in Version20261005120000 (added by #98, never released). Co-Authored-By: Claude Opus 5.5 (1M context) --- CHANGELOG.md | 2 +- src/Migrations/Version20261005120000.php | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9216d22..98d82c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +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). +* [#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` (log records without process execution are deleted) and `process_execution.context` nullable, as in the mapping. * [#99](https://github.com/cleverage/ui-process-bundle/issues/99) Fix the migrations on PostgreSQL (they could not create a working schema): id columns created as identity columns (the sequences were not used: inserts failed with the IDENTITY generation), `process_schedule` created with the PostgreSQL syntax (`AUTO_INCREMENT` failed). PostgreSQL support documented. v3.0.2 diff --git a/src/Migrations/Version20261005120000.php b/src/Migrations/Version20261005120000.php index c896911..6bb831a 100644 --- a/src/Migrations/Version20261005120000.php +++ b/src/Migrations/Version20261005120000.php @@ -20,14 +20,15 @@ use Doctrine\Migrations\AbstractMigration; /** - * Align log_record.process_execution_id, created as nullable by Version20231006111525, on the entity mapping. + * Align on the entity mapping log_record.process_execution_id, created as nullable by Version20231006111525, and + * process_execution.context, created as NOT NULL by Version20241007152613. */ final class Version20261005120000 extends AbstractMigration { #[\Override] public function getDescription(): string { - return 'Make log_record.process_execution_id NOT NULL'; + return 'Make log_record.process_execution_id NOT NULL, process_execution.context nullable'; } public function up(Schema $schema): void @@ -43,6 +44,9 @@ public function up(Schema $schema): void $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'); + $this->addSql($mySql + ? 'ALTER TABLE process_execution MODIFY context JSON DEFAULT NULL' + : 'ALTER TABLE process_execution ALTER context DROP NOT NULL'); } #[\Override] @@ -57,5 +61,8 @@ public function down(Schema $schema): void $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'); + $this->addSql($mySql + ? 'ALTER TABLE process_execution MODIFY context JSON NOT NULL' + : 'ALTER TABLE process_execution ALTER context SET NOT NULL'); } }