Skip to content
Snippets Groups Projects
Verified Commit 437a4cdf authored by Timm Fitschen's avatar Timm Fitschen
Browse files

BUG: fix merge errors

parent 5f509b0a
No related branches found
No related tags found
1 merge request!10Draft: ENH: file system: directory
Pipeline #47537 failed
-- USE _caosdb_schema_unit_tests; -- USE _caosdb_schema_unit_tests;
-- REMOVE SQLITE datatype (obsolete)
DELETE FROM name_data WHERE entity_id = 50;
DELETE FROM entities WHERE id = 50;
/* /*
-- Create file_hashes table. -- Create file_hashes table.
-- This table is necessary because not all FSO objects have hashes (e.g. -- This table is necessary because not all FSO objects have hashes (e.g.
...@@ -69,6 +64,7 @@ ALTER TABLE entities MODIFY COLUMN `role` enum('RECORDTYPE','RECORD','FILE','_RE ...@@ -69,6 +64,7 @@ ALTER TABLE entities MODIFY COLUMN `role` enum('RECORDTYPE','RECORD','FILE','_RE
-- Add a new special role "DIRECTORY" -- Add a new special role "DIRECTORY"
INSERT IGNORE INTO entities (id, description, role, acl) VALUES (9, "The directory role.", "ROLE", 0); INSERT IGNORE INTO entities (id, description, role, acl) VALUES (9, "The directory role.", "ROLE", 0);
INSERT IGNORE INTO name_data (domain_id, entity_id, property_id, value, status, pidx) VALUES (0, 9, 20, "DIRECTORY", "FIX", 0); INSERT IGNORE INTO name_data (domain_id, entity_id, property_id, value, status, pidx) VALUES (0, 9, 20, "DIRECTORY", "FIX", 0);
INSERT IGNORE INTO entity_ids (id, internal_id) VALUES (9,9);
-- In the default file storage back-end the key is just the path. -- In the default file storage back-end the key is just the path.
UPDATE files SET file_key=path; UPDATE files SET file_key=path;
...@@ -91,6 +87,7 @@ ALTER TABLE archive_files MODIFY COLUMN path VARCHAR(16000) NOT NULL; ...@@ -91,6 +87,7 @@ ALTER TABLE archive_files MODIFY COLUMN path VARCHAR(16000) NOT NULL;
-- Add a special nameless directory which is used as the root directory of the -- Add a special nameless directory which is used as the root directory of the
-- internal file system. -- internal file system.
INSERT IGNORE INTO entities (id, description, role, acl) VALUES (51, "The root directory of the internal files system", "DIRECTORY", 0); INSERT IGNORE INTO entities (id, description, role, acl) VALUES (51, "The root directory of the internal files system", "DIRECTORY", 0);
INSERT IGNORE INTO entity_ids (id, internal_id) VALUES (51,51);
INSERT IGNORE INTO files INSERT IGNORE INTO files
(file_id, path, checked_timestamp, mimetype, file_storage_id, (file_id, path, checked_timestamp, mimetype, file_storage_id,
file_key, parent_directory) file_key, parent_directory)
......
...@@ -78,7 +78,7 @@ BEGIN ...@@ -78,7 +78,7 @@ BEGIN
INSERT IGNORE INTO referring (id) SELECT entity_id FROM date_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT entity_id FROM date_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
INSERT IGNORE INTO referring (id) SELECT domain_id FROM date_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0; INSERT IGNORE INTO referring (id) SELECT domain_id FROM date_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0;
INSERT IGNORE INTO refering (id) SELECT file_id FROM files WHERE parent_directory=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT file_id FROM files WHERE parent_directory=InternalEntityID;
INSERT IGNORE INTO referring (id) SELECT entity_id FROM null_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID; INSERT IGNORE INTO referring (id) SELECT entity_id FROM null_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
INSERT IGNORE INTO referring (id) SELECT domain_id FROM null_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0; INSERT IGNORE INTO referring (id) SELECT domain_id FROM null_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0;
......
...@@ -87,7 +87,7 @@ BEGIN ...@@ -87,7 +87,7 @@ BEGIN
VALUES (0, InternalEntityID, 20, EntityName, "FIX", 0); VALUES (0, InternalEntityID, 20, EntityName, "FIX", 0);
END IF; END IF;
SELECT Version as Version; SELECT Version as Version, InternalEntityID as InternalEntityID;
END; END;
// //
......
...@@ -80,7 +80,7 @@ insertFSODescriptorBody: BEGIN ...@@ -80,7 +80,7 @@ insertFSODescriptorBody: BEGIN
file_storage_id, file_storage_id,
file_key, file_key,
parent_directory parent_directory
) VALUES (InternalEntityID, unhex(FileHash), FileHashAlgo, FileCheckedTimestamp, FileSize, FilePath, FileMimeType, FileStorageId, FileKey, FileParentID); ) VALUES (InternalEntityID, unhex(FileHash), FileHashAlgo, FileCheckedTimestamp, FileSize, FilePath, FileMimeType, FileStorageId, FileKey, InternalParentID);
END; END;
// //
......
...@@ -38,12 +38,15 @@ DROP PROCEDURE IF EXISTS db_5_0.listFSODescriptorByParentDirectory // ...@@ -38,12 +38,15 @@ DROP PROCEDURE IF EXISTS db_5_0.listFSODescriptorByParentDirectory //
* FileHashChecked, FileMimeType, FileStorageID, FileKey) * FileHashChecked, FileMimeType, FileStorageID, FileKey)
*/ */
CREATE PROCEDURE db_5_0.listFSODescriptorByParentDirectory( CREATE PROCEDURE db_5_0.listFSODescriptorByParentDirectory(
IN ParentDirectory INT UNSIGNED) IN ParentDirectory VARCHAR(255))
listFSODescriptorByParentDirectoryBody: BEGIN listFSODescriptorByParentDirectoryBody: BEGIN
DECLARE InternalParentID INT UNSIGNED DEFAULT NULL;
SELECT internal_id INTO InternalParentID from entity_ids WHERE id = ParentDirectory;
SELECT hash_algorithm AS FileHashAlgo, SELECT hash_algorithm AS FileHashAlgo,
file_id AS FileId, (SELECT id FROM entity_ids WHERE internal_id = file_id) AS FileId,
parent_directory AS FileParentID, ParentDirectory AS FileParentID,
path AS FilePath, path AS FilePath,
size AS FileSize, size AS FileSize,
hex(hash) AS FileHash, hex(hash) AS FileHash,
...@@ -52,7 +55,7 @@ listFSODescriptorByParentDirectoryBody: BEGIN ...@@ -52,7 +55,7 @@ listFSODescriptorByParentDirectoryBody: BEGIN
file_storage_id AS FileStorageID, file_storage_id AS FileStorageID,
file_key AS FileKey file_key AS FileKey
FROM files FROM files
WHERE parent_directory = ParentDirectory; WHERE parent_directory = InternalParentID;
END; END;
// //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment