Skip to content

Commit

Permalink
migration attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <[email protected]>
  • Loading branch information
ArtificialOwl committed Nov 28, 2024
1 parent 968cfa6 commit 0617065
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Db/MountRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public function save(Mount $mount): void {
->setValue('single_id', $qb->createNamedParameter($mount->getOwner()->getSingleId()))
->setValue('token', $qb->createNamedParameter($mount->getToken()))
->setValue('parent', $qb->createNamedParameter($mount->getParent()))
->setValue('mountpoint', $qb->createNamedParameter($mount->getMountPoint()))
->setValue('mountpoint_hash', $qb->createNamedParameter(md5($mount->getMountPoint())));
->setValue('mountpoint', $qb->createNamedParameter($mount->getOriginalMountPoint()))
->setValue('mountpoint_hash', $qb->createNamedParameter(md5($mount->getOriginalMountPoint())));

$qb->execute();
}
Expand Down
5 changes: 4 additions & 1 deletion lib/Migration/Version0031Date20241105133904.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
use Closure;
use Doctrine\DBAL\Schema\SchemaException;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\Attributes\AddIndex;
use OCP\Migration\Attributes\IndexType;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
use Psr\Log\LoggerInterface;

#[AddIndex('circles_mountpoint', IndexType::UNIQUE, 'add uniqueness to mountpoint per user')]
class Version0031Date20241105133904 extends SimpleMigrationStep {
public function __construct(
private LoggerInterface $logger,
Expand All @@ -30,7 +33,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt

try {
$table = $schema->getTable('circles_mountpoint');
if (!$table->hasIndex('dname')) {
if (!$table->hasIndex('mp_sid_hash')) {
$table->addUniqueIndex(['single_id', 'mountpoint_hash'], 'mp_sid_hash');
}
} catch (SchemaException $e) {
Expand Down
3 changes: 2 additions & 1 deletion lib/MountManager/CircleMountProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public function __construct(
private MountRequest $mountRequest,
private MountPointRequest $mountPointRequest,
private FederatedUserService $federatedUserService,
private ConfigService $configService
private ConfigService $configService,
private LoggerInterface $logger,
) {
}

Expand Down

0 comments on commit 0617065

Please sign in to comment.