diff --git a/patches/patch20210219-5.0.0-rc1/patch.sql b/patches/patch20210219-5.0.0-rc1/patch.sql
index a087aef5fc5b32594b5aea90b5c8b3c5386b560e..e73bd209f52b640605492399138589483b0097fc 100644
--- a/patches/patch20210219-5.0.0-rc1/patch.sql
+++ b/patches/patch20210219-5.0.0-rc1/patch.sql
@@ -20,12 +20,11 @@ ALTER TABLE archive_files ADD COLUMN IF NOT EXISTS (
     parent_directory INT UNSIGNED DEFAULT NULL,
     mimetype VARBINARY(255) DEFAULT NULL,
     file_storage_id VARBINARY(255) NOT NULL DEFAULT "DEFAULT",
-    file_key VARBINARY(255) DEFAULT NULL,
+    file_key VARBINARY(40000) DEFAULT NULL,
     checked_timestamp BIGINT NOT NULL DEFAULT 0,
     hash_algorithm VARBINARY(255) DEFAULT NULL
 );
 
-
 ALTER TABLE entities MODIFY COLUMN `role` enum('RECORDTYPE','RECORD','FILE','DOMAIN','PROPERTY','DATATYPE','ROLE','QUERYTEMPLATE', 'DIRECTORY') COLLATE utf8_unicode_ci NOT NULL;
 
 INSERT INTO entities (id, description, role, acl) VALUES (9, "The directory role.", "ROLE", 0);
@@ -34,8 +33,11 @@ INSERT INTO name_data (domain_id, entity_id, property_id, value, status, pidx) V
 UPDATE files SET file_key=path;
 UPDATE archive_files SET file_key=path;
 
-ALTER TABLE files MODIFY COLUMN file_key VARBINARY(255) NOT NULL;
-ALTER TABLE archive_files MODIFY COLUMN file_key VARBINARY(255) NOT NULL;
+ALTER TABLE files MODIFY COLUMN size BIGINT NULL DEFAULT NULL;
+ALTER TABLE files MODIFY COLUMN path VARCHAR(5000) NOT NULL;
+ALTER TABLE archive_files MODIFY COLUMN path VARCHAR(5000) NOT NULL;
+ALTER TABLE files MODIFY COLUMN file_key VARBINARY(40000) NOT NULL;
+ALTER TABLE archive_files MODIFY COLUMN file_key VARBINARY(40000) NOT NULL;
 
 DROP PROCEDURE IF EXISTS _create_dirs;
 DELIMITER //
diff --git a/procedures/entityVersioning.sql b/procedures/entityVersioning.sql
index 782cddafa400284b3c6cc4bfed9386e007477ff8..80fcc591f867de71a5b3fd8f6d7e580bcc4e2068 100644
--- a/procedures/entityVersioning.sql
+++ b/procedures/entityVersioning.sql
@@ -422,32 +422,42 @@ DROP PROCEDURE IF EXISTS setFileProperties //
  *
  * Parameters
  * ----------
- * EntityID
- *   The file's id.
- * FilePath
- *   Path of the file in the internal file system.  If NULL, an existing file
- *   entity is simply deleted.
- * FileSize
- *   Size of the file in bytes.
+ * FileID
+ *   The entity's id.
  * FileHash
- *   A Sha512 Hash of the file.
+ *   The SHA512 Hash of the file (or NULL for directories).
+ * FileCheckedTimestamp
+ *   The timestamp when the hash was last checked.
+ * FileSize
+ *   The byte size (or NULL for directories).
+ * FilePath
+ *   The path of the object.
+ * FileMimetype
+ *   The mimetype (use "inode/directory" for directories, use NULL for unknown)
+ * FileStorageID
+ *   The ID of the back-end file storage where this object is located.
+ * FileKey
+ *   The file storage key of this object.
+ * FileParentID
+ *   The entity id of the parent directory (or NULL).
  */
 CREATE PROCEDURE setFileProperties (
-    in EntityID INT UNSIGNED,
-    in FilePath TEXT,
+    in FileID INT UNSIGNED,
+    in FilePath VARCHAR(5000),
     in FileSize BIGINT UNSIGNED,
     in FileHash VARCHAR(255),
     in FileChecked BIGINT,
     in FileMimetype VARBINARY(255),
     in FileStorageId VARBINARY(255),
-    in FileKey VARBINARY(65525)
+    in FileKey VARBINARY(40000),
+    in FileParentID INT UNSIGNED
 )
 BEGIN
     DECLARE IVersion INT UNSIGNED DEFAULT NULL;
     IF is_feature_config("ENTITY_VERSIONING", "ENABLED") THEN
         SELECT max(e._iversion) INTO IVersion
             FROM entity_version AS e
-            WHERE e.entity_id = EntityID;
+            WHERE e.entity_id = FileID;
 
         INSERT INTO archive_files (file_id, path, size, hash,
                 checked_timestamp, mimetype, file_storage_id, file_key,
@@ -455,15 +465,15 @@ BEGIN
             SELECT file_id, path, size, hash, checked_timestamp, mimetype,
                 file_storage_id, file_key, IVersion AS _iversion
             FROM files
-            WHERE file_id = EntityID;
+            WHERE file_id = FileID;
     END IF;
 
-    DELETE FROM files WHERE file_id = EntityID;
+    DELETE FROM files WHERE file_id = FileID;
 
     IF FilePath IS NOT NULL THEN
         INSERT INTO files (file_id, path, size, hash, checked_timestamp,
                 mimetype, file_storage_id, file_key)
-            VALUES (EntityID, FilePath, FileSize, unhex(FileHash), FileChecked,
+            VALUES (FileID, FilePath, FileSize, unhex(FileHash), FileChecked,
                 FileMimetype, FileStorageId, FileKey);
     END IF;
 
diff --git a/procedures/insertFSODescriptor.sql b/procedures/insertFSODescriptor.sql
new file mode 100644
index 0000000000000000000000000000000000000000..d0e432cab333c47b0aaa15ad92a3f5f6fda46ae0
--- /dev/null
+++ b/procedures/insertFSODescriptor.sql
@@ -0,0 +1,69 @@
+/*
+ * This file is a part of the CaosDB Project.
+ *
+ * Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
+ * Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+
+DROP PROCEDURE IF EXISTS db_2_0.insertFSODescriptor;
+delimiter //
+/**
+ * Insert a FSODescriptor
+ *
+ * Parameters
+ * ----------
+ * FileID
+ *   The entity's id.
+ * FileHash
+ *   The SHA512 Hash of the file (or NULL for directories).
+ * FileCheckedTimestamp
+ *   The timestamp when the hash was last checked.
+ * FileSize
+ *   The byte size (or NULL for directories).
+ * FilePath
+ *   The path of the object.
+ * FileMimetype
+ *   The mimetype (use "inode/directory" for directories, use NULL for unknown)
+ * FileStorageID
+ *   The ID of the back-end file storage where this object is located.
+ * FileKey
+ *   The file storage key of this object.
+ * FileParentID
+ *   The entity id of the parent directory (or NULL).
+ */
+CREATE PROCEDURE db_2_0.insertFSODescriptor(
+    in FileID INT UNSIGNED,
+    in FileHash VARCHAR(255),
+    in FileCheckedTimestamp BIGINT,
+    in FileSize BIGINT UNSIGNED,
+    in FilePath VARCHAR(5000),
+    in FileMimetype VARBINARY(255),
+    in FileStorageID VARBINARY(255),
+    in FileKey VARBINARY(40000),
+    in FileParentID INT UNSIGNED
+)
+BEGIN
+
+    INSERT INTO files
+            (file_id, parent_directory, hash, checked_timestamp, size, path,
+             mimetype, file_storage_id, file_key)
+        VALUES (FileID, FileParentID, unhex(FileHash), FileCheckedTimestamp,
+        FileSize, FilePath, FileMimetype, FileStorageID, FileKey);
+
+END;
+//
+delimiter ;
diff --git a/procedures/retrieveEntity.sql b/procedures/retrieveEntity.sql
index 826f56811e370749fe5fc6b5d4230ef625862b90..e981ad10e658646f429db0e55f4b3d82e797baa0 100644
--- a/procedures/retrieveEntity.sql
+++ b/procedures/retrieveEntity.sql
@@ -53,14 +53,14 @@ create procedure db_2_0.retrieveEntity(
     in EntityID INT UNSIGNED,
     in Version VARBINARY(255))
 retrieveEntityBody: BEGIN
-    DECLARE FilePath VARCHAR(255) DEFAULT NULL;
+    DECLARE FilePath VARCHAR(5000) DEFAULT NULL;
     DECLARE FileParentID INT UNSIGNED DEFAULT NULL;
-    DECLARE FileSize VARCHAR(255) DEFAULT NULL;
+    DECLARE FileSize BIGINT UNSIGNED DEFAULT NULL;
     DECLARE FileHash VARCHAR(255) DEFAULT NULL;
     DECLARE FileHashChecked BIGINT DEFAULT NULL;
     DECLARE FileMimetype VARBINARY(255) DEFAULT NULL;
     DECLARE FileStorageID VARBINARY(255) DEFAULT NULL;
-    DECLARE FileKey VARBINARY(65525) DEFAULT NULL;
+    DECLARE FileKey VARBINARY(40000) DEFAULT NULL;
     DECLARE DatatypeID INT UNSIGNED DEFAULT NULL;
     DECLARE CollectionName VARCHAR(255) DEFAULT NULL;
     DECLARE IsHead BOOLEAN DEFAULT TRUE;