From 56739b68747899590640f5354ff8462ec28e61e3 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 8 Oct 2026 14:47:01 +0200 Subject: [PATCH 1/2] fix #127 Remove the (DC2Type) column comments, fix the UiOptions PHPDoc Co-Authored-By: Claude Opus 5.5 (1M context) --- CHANGELOG.md | 1 + src/Manager/ProcessConfigurationsManager.php | 4 +- src/Migrations/Version20231006111525.php | 3 - src/Migrations/Version20261008120000.php | 59 ++++++++++++++++++++ 4 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 src/Migrations/Version20261008120000.php diff --git a/CHANGELOG.md b/CHANGELOG.md index efe363a..719916b 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) Remove the `(DC2Type:...)` column comments, no longer used since DBAL 4 (the schema was always reported as out of sync): `Version20261008120000` migration (MySQL / MariaDB), `COMMENT ON COLUMN` statements removed from `Version20231006111525` (PostgreSQL). `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/Version20231006111525.php b/src/Migrations/Version20231006111525.php index 13a12db..1f0764a 100644 --- a/src/Migrations/Version20231006111525.php +++ b/src/Migrations/Version20231006111525.php @@ -50,14 +50,11 @@ public function up(Schema $schema): void $this->addSql('CREATE INDEX IDX_8ECECC333DAC0075 ON log_record (process_execution_id)'); $this->addSql('CREATE INDEX idx_log_record_level ON log_record (level)'); $this->addSql('CREATE INDEX idx_log_record_created_at ON log_record (created_at)'); - $this->addSql('COMMENT ON COLUMN log_record.created_at IS \'(DC2Type:datetime_immutable)\''); } if (!$schema->hasTable('process_execution')) { $this->addSql('CREATE TABLE process_execution (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, code VARCHAR(255) NOT NULL, log_filename VARCHAR(255) NOT NULL, start_date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, end_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, status VARCHAR(255) NOT NULL, report JSON NOT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX idx_process_execution_code ON process_execution (code)'); $this->addSql('CREATE INDEX idx_process_execution_start_date ON process_execution (start_date)'); - $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)\''); $this->addSql('ALTER TABLE log_record ADD CONSTRAINT FK_8ECECC333DAC0075 FOREIGN KEY (process_execution_id) REFERENCES process_execution (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); } if (!$schema->hasTable('process_user')) { diff --git a/src/Migrations/Version20261008120000.php b/src/Migrations/Version20261008120000.php new file mode 100644 index 0000000..d77a2ce --- /dev/null +++ b/src/Migrations/Version20261008120000.php @@ -0,0 +1,59 @@ +connection->getDatabasePlatform(); + if (!$platform instanceof MariaDBPlatform && !$platform instanceof MySQLPlatform) { + return; + } + + $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'); + } + + #[\Override] + public function down(Schema $schema): void + { + $platform = $this->connection->getDatabasePlatform(); + if (!$platform instanceof MariaDBPlatform && !$platform instanceof MySQLPlatform) { + return; + } + + $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)\''); + } +} From 93f7b82272a06f48d5be23aa81c0040a1e3be5b0 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 8 Oct 2026 14:51:55 +0200 Subject: [PATCH 2/2] fix #127 Keep the released migrations, keep the type comments when DBAL 3 uses them Co-Authored-By: Claude Opus 5.5 (1M context) --- CHANGELOG.md | 2 +- src/Migrations/Version20231006111525.php | 3 ++ src/Migrations/Version20261008120000.php | 48 ++++++++++++++++-------- 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 719916b..3460d4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +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) Remove the `(DC2Type:...)` column comments, no longer used since DBAL 4 (the schema was always reported as out of sync): `Version20261008120000` migration (MySQL / MariaDB), `COMMENT ON COLUMN` statements removed from `Version20231006111525` (PostgreSQL). `UiOptions` PHPDoc: types instead of string literals (`'run': ?bool`, context rows `int|string`). +* [#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/Migrations/Version20231006111525.php b/src/Migrations/Version20231006111525.php index 1f0764a..13a12db 100644 --- a/src/Migrations/Version20231006111525.php +++ b/src/Migrations/Version20231006111525.php @@ -50,11 +50,14 @@ public function up(Schema $schema): void $this->addSql('CREATE INDEX IDX_8ECECC333DAC0075 ON log_record (process_execution_id)'); $this->addSql('CREATE INDEX idx_log_record_level ON log_record (level)'); $this->addSql('CREATE INDEX idx_log_record_created_at ON log_record (created_at)'); + $this->addSql('COMMENT ON COLUMN log_record.created_at IS \'(DC2Type:datetime_immutable)\''); } if (!$schema->hasTable('process_execution')) { $this->addSql('CREATE TABLE process_execution (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, code VARCHAR(255) NOT NULL, log_filename VARCHAR(255) NOT NULL, start_date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, end_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, status VARCHAR(255) NOT NULL, report JSON NOT NULL, PRIMARY KEY(id))'); $this->addSql('CREATE INDEX idx_process_execution_code ON process_execution (code)'); $this->addSql('CREATE INDEX idx_process_execution_start_date ON process_execution (start_date)'); + $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)\''); $this->addSql('ALTER TABLE log_record ADD CONSTRAINT FK_8ECECC333DAC0075 FOREIGN KEY (process_execution_id) REFERENCES process_execution (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); } if (!$schema->hasTable('process_user')) { diff --git a/src/Migrations/Version20261008120000.php b/src/Migrations/Version20261008120000.php index d77a2ce..119e982 100644 --- a/src/Migrations/Version20261008120000.php +++ b/src/Migrations/Version20261008120000.php @@ -15,45 +15,63 @@ use Doctrine\DBAL\Platforms\MariaDBPlatform; use Doctrine\DBAL\Platforms\MySQLPlatform; +use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; /** - * Remove the (DC2Type:...) column comments created by Version20231006111525 and Version20240729151928, no longer used - * since DBAL 4: the schema was always reported as out of sync. + * Remove the (DC2Type:...) column comments created by Version20231006111525 and Version20240729151928 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. */ final class Version20261008120000 extends AbstractMigration { #[\Override] public function getDescription(): string { - return 'Remove the (DC2Type) column comments'; + return 'Remove the (DC2Type) column comments when the type comments are not used'; } public function up(Schema $schema): void { - $platform = $this->connection->getDatabasePlatform(); - if (!$platform instanceof MariaDBPlatform && !$platform instanceof MySQLPlatform) { + if (!$this->connection->getConfiguration()->getDisableTypeComments()) { return; } - $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'); + $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 { - $platform = $this->connection->getDatabasePlatform(); - if (!$platform instanceof MariaDBPlatform && !$platform instanceof MySQLPlatform) { + if (!$this->connection->getConfiguration()->getDisableTypeComments()) { return; } - $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)\''); + $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)\''); + } } }