Commit ad6e02b5 authored by Michael Davis's avatar Michael Davis
Browse files

[migration] Updates procedure to rebuild DIRS_FULL_PATH table

parent d4f79281
......@@ -38,11 +38,11 @@ INSERT INTO CTADirsFullPathMigration select a.fileid, a.parent_fileid, '/' || a.
a.csumvalue, a.acl, a.stagertime, a.oncta, b.depth+1, 0 from CTADirsFullPathNames a, CTADirsFullPathMigration b
where a.parent_fileid=b.fileid and b.depth=0;
/* Procedure to prepare the files and segments metadata for export to CTA */
CREATE OR REPLACE PROCEDURE buildCTADirsFullPathMigration AS
Curdepth INTEGER;
/* Table should contain 2 rows at depth 0 and 1 */
SELECT * from CTADirsFullPathMigration;
BEGIN
Curdepth := 1;
FOR Curdepth IN 1..40
LOOP
INSERT INTO CTADirsFullPathMigration
(SELECT a.fileid, a.parent_fileid, b.name || '/' || a.name, a.filemode, a.nlink, a.owner_uid,
......@@ -51,12 +51,10 @@ BEGIN
FROM CTADirsFullPathNames a, CTADirsFullPathMigration b
WHERE a.parent_fileid=b.fileid and b.depth=Curdepth);
EXIT WHEN sql%rowcount = 0;
Curdepth := Curdepth + 1;
END LOOP;
END;
EXECUTE IMMEDIATE ('TRUNCATE TABLE Dirs_Full_Path;');
INSERT INTO Dirs_Full_Path
TRUNCATE TABLE Dirs_Full_Path;
INSERT INTO Dirs_Full_Path
(SELECT fileid, parent_fileid as parent, SUBSTR(name,(INSTR(name,'/',-1,1)+1),length(name)) as name, name as path, depth
FROM CTADirsFullPathMigration);
END;
/
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment