Skip to content

Commit

Permalink
Merge pull request #2785 from LibreSign/backport/2781/stable28
Browse files Browse the repository at this point in the history
[stable28] Prevent exception when migration already was applied
  • Loading branch information
vitormattos authored Apr 17, 2024
2 parents c8aa495 + 21d6f17 commit 318c86c
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions lib/Migration/Version8000Date20231102215331.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace OCA\Libresign\Migration;

use Closure;
use OC\DB\Exceptions\DbalException;
use OCP\DB\ISchemaWrapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\DB\Types;
Expand Down Expand Up @@ -151,14 +152,20 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array
}
$cursor->closeCursor();

$qb = $this->connection->getQueryBuilder();
$qb->update('libresign_file_element')
->set('sign_request_id', 'file_user_id')
->executeStatement();
try {
$qb = $this->connection->getQueryBuilder();
$qb->update('libresign_file_element')
->set('sign_request_id', 'file_user_id')
->executeStatement();
} catch (DbalException $e) {
}

$qb = $this->connection->getQueryBuilder();
$qb->update('libresign_identify_method')
->set('sign_request_id', 'file_user_id')
->executeStatement();
try {
$qb = $this->connection->getQueryBuilder();
$qb->update('libresign_identify_method')
->set('sign_request_id', 'file_user_id')
->executeStatement();
} catch (DbalException $e) {
}
}
}

0 comments on commit 318c86c

Please sign in to comment.