Skip to content
Snippets Groups Projects
Commit e294a096 authored by Zoltan Mathe's avatar Zoltan Mathe
Browse files

Merge branch 'devel_branch' into 'devel'

change the db schema

See merge request !340
parents 3e6baa19 57848138
No related branches found
No related tags found
No related merge requests found
......@@ -121,21 +121,22 @@ alter table jobs ADD CONSTRAINT FK_Prodcont_prod FOREIGN KEY(production) REFEREN
ALTER TABLE jobs ADD HLT2TCK varchar2(20);
DROP TABLE productionoutputfiles CASCADE constraints;
create table productionoutputfiles(
Production NUMBER,
stepid number,
filetype varchar2(256),
eventtypeid number,
filetypeid number,
visible char(1) default 'Y',
CONSTRAINT PK_productionoutputfiles_p PRIMARY KEY (Production, stepid, filetype),
CONSTRAINT PK_productionoutputfiles_p PRIMARY KEY (Production, filetypeid, eventtypeid, visible),
CONSTRAINT FK_productionoutputfiles_steps FOREIGN KEY (stepid) REFERENCES steps(stepid),
CONSTRAINT FK_productionoutputfiles_evt FOREIGN KEY (eventtypeid) REFERENCES eventtypes(eventtypeid),
CONSTRAINT FK_productionoutputfiles_ft FOREIGN KEY (filetypeid) REFERENCES filetypes(filetypeid),
CONSTRAINT FK_productionoutputfiles_prod FOREIGN KEY (production) REFERENCES productionscontainer(production) ON DELETE CASCADE ENABLE);
grant select on productionoutputfiles to LHCB_DIRACBOOKKEEPING_USERS;
grant select,insert,update on productionoutputfiles to LHCB_DIRACBOOKKEEPING_SERVER;
CREATE SYNONYM productionoutputfiles FOR LHCB_DIRACBOOKKEEPING.productionoutputfiles;
alter table productionoutputfiles add eventtypeid number;
alter table productionoutputfiles add constraint fk_prodoutput_eventtypeid FOREIGN KEY (eventtypeid) references eventtypes(eventtypeid);
ALTER TABLE stepscontainer DROP CONSTRAINT FK_STEPSCONTAINER_EVENTTYPEID;
ALTER TABLE stepscontainer DROP column eventtypeid;
\ No newline at end of file
......@@ -224,7 +224,7 @@ procedure getFileDesJobId(v_Filename varchar2, a_Cursor out udt_RefCursor);
procedure getAllMetadata(v_jobid NUMBER, v_prod number, a_Cursor out udt_RefCursor);
function getProducedEvents(v_prodid number) return number;
procedure bulkgetIdsFromFiles(lfns varchararray, a_Cursor out udt_RefCursor);
PROCEDURE insertProdnOutputFtypes(v_production number, v_stepid number, v_filetype varchar2, v_visible char, v_eventtype varchar2);
PROCEDURE insertProdnOutputFtypes(v_production number, v_stepid number, v_filetypeid number, v_visible char, v_eventtype number);
end;
/
......@@ -2296,13 +2296,15 @@ FOR i in lfns.FIRST .. lfns.LAST LOOP
open a_Cursor for select FILENAME, jobid, fileid, filetypeid from table(lfnmeta);
END;
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
PROCEDURE insertProdnOutputFtypes(v_production number, v_stepid number, v_filetype varchar2, v_visible char, v_eventtype varchar2)IS
PROCEDURE insertProdnOutputFtypes(v_production number, v_stepid number, v_filetypeid number, v_visible char, v_eventtype number)IS
BEGIN
INSERT INTO productionoutputfiles(production, stepid, filetype, visible, eventtypeid)VALUES(v_production,v_stepid, v_filetype, v_visible,v_eventtype);
INSERT INTO productionoutputfiles(production, stepid, filetypeid, visible, eventtypeid)VALUES(v_production,v_stepid, v_filetypeid, v_visible,v_eventtype);
COMMIT;
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
UPDATE productionoutputfiles SET stepid=v_stepid, filetype=v_filetype, visible = v_visible,eventtypeid=v_eventtype WHERE production=v_production;
DBMS_OUTPUT.put_line ('EXISTS:'||v_production||'->'||v_stepid||'->'||v_filetypeid||'->'||v_visible||'->'||v_eventtype);
--NOT: If the production is already in the table, we only change the step!!!
UPDATE productionoutputfiles SET stepid=v_stepid WHERE production=v_production and filetypeid=v_filetypeid and visible =v_visible and eventtypeid=v_eventtype;
END;
END;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment