diff --git a/lib/Db/DiffTaskResult.php b/lib/Db/DiffTaskResult.php index 3050a12..b6865a9 100644 --- a/lib/Db/DiffTaskResult.php +++ b/lib/Db/DiffTaskResult.php @@ -18,6 +18,7 @@ class DiffTaskResult extends Entity implements JsonSerializable { protected $currentFileExists; protected $currentPath; protected $currentSize; + protected $reverted; public function __construct() { $this->addType('id','integer'); @@ -26,6 +27,7 @@ class DiffTaskResult extends Entity implements JsonSerializable { $this->addType('beforeSize','integer'); $this->addType('currentFileExists','boolean'); $this->addType('currentSize','integer'); + $this->addType('reverted','boolean'); } public function jsonSerialize() { @@ -42,7 +44,8 @@ class DiffTaskResult extends Entity implements JsonSerializable { 'fileExists' => $this->currentFileExists, 'path' => $this->currentPath, 'size' => $this->currentSize, - ] + ], + 'reverted' => $this->reverted, ]; } } \ No newline at end of file diff --git a/lib/Db/DiffTaskResultMapper.php b/lib/Db/DiffTaskResultMapper.php index 5937829..882a0e1 100644 --- a/lib/Db/DiffTaskResultMapper.php +++ b/lib/Db/DiffTaskResultMapper.php @@ -33,4 +33,10 @@ class DiffTaskResultMapper extends QBMapper { return $this->findEntities($qb); } + public function markReverted(int $id) { + $taskResult = $this->find($id); + $taskResult->setReverted(True); + return $this->update($taskResult); + } + } \ No newline at end of file diff --git a/lib/Migration/Version100Date20230822153000.php b/lib/Migration/Version100Date20230822153000.php index 256d32c..c65f38b 100644 --- a/lib/Migration/Version100Date20230822153000.php +++ b/lib/Migration/Version100Date20230822153000.php @@ -94,6 +94,10 @@ 'default' => 0 ]); + $table->addColumn('reverted', 'boolean', [ + 'default' => false, + ]); + $table->setPrimaryKey(['id']); $table->addIndex(['task_id'], 'taskid_index'); $table->addForeignKeyConstraint($schema->getTable(self::TASKS_TABLE), ['task_id'], ['id'], ['onDelete' => 'CASCADE'], 'results_taskid_fk');