From 82d95da322240c0c3ea7e679ff1c9ff6b5bf33df Mon Sep 17 00:00:00 2001 From: Jonathan Treffler Date: Thu, 31 Oct 2024 17:51:20 +0100 Subject: [PATCH] save fileId for folder resources --- lib/Db/FolderResource.php | 4 ++++ lib/Db/ResourceMapper.php | 2 +- lib/Migration/Version000000Date20241014120000.php | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Db/FolderResource.php b/lib/Db/FolderResource.php index 0725351..837f31f 100644 --- a/lib/Db/FolderResource.php +++ b/lib/Db/FolderResource.php @@ -6,12 +6,14 @@ class FolderResource extends Resource { protected $membersAclPermission; protected $managersAclPermission; protected $inheritedAclPermission; + protected $fileId; public function __construct() { parent::__construct(); $this->addType('membersAclPermission','integer'); $this->addType('managersAclPermission','integer'); $this->addType('inheritedAclPermission','integer'); + $this->addType('fileId','integer'); } public static function fromRow(array $row): static { @@ -26,6 +28,7 @@ class FolderResource extends Resource { $instance->setMembersAclPermission($row["members_acl_permission"]); $instance->setManagersAclPermission($row["managers_acl_permission"]); $instance->setInheritedAclPermission($row["inherited_acl_permission"]); + $instance->setFileId($row["file_id"]); $instance->resetUpdatedFields(); @@ -45,6 +48,7 @@ class FolderResource extends Resource { 'membersAclPermission' => $this->membersAclPermission, 'managersAclPermission' => $this->managersAclPermission, 'inheritedAclPermission' => $this->inheritedAclPermission, + 'fileId' => $this->fileId, ]; } diff --git a/lib/Db/ResourceMapper.php b/lib/Db/ResourceMapper.php index a74c2a7..66d61e0 100644 --- a/lib/Db/ResourceMapper.php +++ b/lib/Db/ResourceMapper.php @@ -18,7 +18,7 @@ class ResourceMapper extends QBMapper { public const FOLDER_RESOURCES_TABLE = "organizationfolders_folder_resources"; private const updateableResourceProperties = ["parentResource", "active", "name", "lastUpdatedTimestamp"]; - private const updateableFolderResourceProperties = ["membersAclPermission", "managersAclPermission", "inheritedAclPermission"]; + private const updateableFolderResourceProperties = ["membersAclPermission", "managersAclPermission", "inheritedAclPermission", "fileId"]; public function __construct(IDBConnection $db) { parent::__construct($db, self::RESOURCES_TABLE, Resource::class); diff --git a/lib/Migration/Version000000Date20241014120000.php b/lib/Migration/Version000000Date20241014120000.php index 0d18385..7fa881a 100644 --- a/lib/Migration/Version000000Date20241014120000.php +++ b/lib/Migration/Version000000Date20241014120000.php @@ -89,6 +89,9 @@ class Version000000Date20241014120000 extends SimpleMigrationStep { 'length' => 11, 'notnull' => true, ]); + $table->addColumn('file_id', Types::INTEGER, [ + 'notnull' => true, + ]); $table->setPrimaryKey(['resource_id']); $table->addForeignKeyConstraint( @@ -97,6 +100,7 @@ class Version000000Date20241014120000 extends SimpleMigrationStep { ['id'], ['onDelete' => 'CASCADE'], 'organizationfolders_folder_resources_resource_id_fk'); + $table->addIndex(['file_id'], 'organizationfolders_folder_resources_file_id_index'); } return $schema;