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 @@ -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
------
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/05-scheduler.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/ProcessSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
61 changes: 61 additions & 0 deletions src/Migrations/Version20261005120000.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?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;

/**
* Align log_record.process_execution_id, created as nullable by Version20231006111525, on the entity mapping.
*/
final class Version20261005120000 extends AbstractMigration
{
#[\Override]
public function getDescription(): string
{
return 'Make log_record.process_execution_id NOT NULL';
}

public function up(Schema $schema): void
{
$platform = $this->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');
}
}
Loading