Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
------
Expand Down
4 changes: 2 additions & 2 deletions src/Manager/ProcessConfigurationsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<array{'key': int|string, 'value': int|string}>}
* }
*/
final readonly class ProcessConfigurationsManager
Expand Down
77 changes: 77 additions & 0 deletions src/Migrations/Version20261008120000.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

declare(strict_types=1);

/*
* This file is part of the CleverAge/UiProcessBundle package.
*
* Copyright (c) Clever-Age
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace CleverAge\UiProcessBundle\Migrations;

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 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 when the type comments are not used';
}

public function up(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, 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)\'');
}
}
}
Loading