Skip to content

Commit

Permalink
fix: Prevent exception when migration already was applied
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <[email protected]>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Apr 17, 2024
1 parent c8aa495 commit 21d6f17
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 21d6f17

Please sign in to comment.