Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:59

0001 /* Create tables and indexes for HV data */
0002 
0003 CREATE TABLE pvss_hv_imon_dat (
0004   logic_id      NUMBER(10),
0005   since         DATE,
0006   till          DATE DEFAULT to_date('9999-12-31 23:59:59', 'YYYY-MM-DD HH24:MI:SS'),
0007   imon          NUMBER
0008 );
0009 
0010 ALTER TABLE pvss_hv_imon_dat ADD CONSTRAINT pvss_hv_imon_pk PRIMARY KEY (logic_id, since, till);
0011 ALTER TABLE pvss_hv_imon_dat ADD CONSTRAINT pvss_hv_imon_uk UNIQUE (since, till);
0012 
0013 
0014 
0015 CREATE TABLE pvss_hv_i0_dat (
0016   logic_id      NUMBER(10),
0017   since         DATE,
0018   till          DATE DEFAULT to_date('9999-12-31 23:59:59', 'YYYY-MM-DD HH24:MI:SS'),
0019   i0            NUMBER
0020 );
0021 
0022 ALTER TABLE pvss_hv_i0_dat ADD CONSTRAINT pvss_hv_i0_pk PRIMARY KEY (logic_id, since, till);
0023 ALTER TABLE pvss_hv_i0_dat ADD CONSTRAINT pvss_hv_i0_uk UNIQUE (since, till);
0024 
0025 
0026  
0027 CREATE TABLE pvss_hv_vmon_dat (
0028   logic_id      NUMBER(10),
0029   since         DATE,
0030   till          DATE DEFAULT to_date('9999-12-31 23:59:59', 'YYYY-MM-DD HH24:MI:SS'),
0031   vmon          NUMBER
0032 );
0033 
0034 ALTER TABLE pvss_hv_vmon_dat ADD CONSTRAINT pvss_hv_vmon_pk PRIMARY KEY (logic_id, since, till);
0035 ALTER TABLE pvss_hv_vmon_dat ADD CONSTRAINT pvss_hv_vmon_uk UNIQUE (since, till);
0036 
0037 
0038 
0039 CREATE TABLE pvss_hv_v0_dat (
0040   logic_id      NUMBER(10),
0041   since         DATE,
0042   till          DATE DEFAULT to_date('9999-12-31 23:59:59', 'YYYY-MM-DD HH24:MI:SS'),
0043   v0            NUMBER
0044 );
0045 
0046 ALTER TABLE pvss_hv_v0_dat ADD CONSTRAINT pvss_hv_v0_pk PRIMARY KEY (logic_id, since, till);
0047 ALTER TABLE pvss_hv_v0_dat ADD CONSTRAINT pvss_hv_v0_uk UNIQUE (since, till);
0048 
0049 
0050 
0051 CREATE TABLE pvss_hv_t_board_dat (
0052   logic_id      NUMBER(10),
0053   since         DATE,
0054   till          DATE DEFAULT to_date('9999-12-31 23:59:59', 'YYYY-MM-DD HH24:MI:SS'),
0055   t_board       NUMBER
0056 );
0057 
0058 ALTER TABLE pvss_hv_t_board_dat ADD CONSTRAINT pvss_hv_t_board_pk PRIMARY KEY (logic_id, since, till);
0059 ALTER TABLE pvss_hv_t_board_dat ADD CONSTRAINT pvss_hv_t_board_uk UNIQUE (since, till);
0060 
0061 
0062 
0063 CREATE TABLE pvss_hv_chan_status_dat (
0064   logic_id      NUMBER(10),
0065   since         DATE,
0066   till          DATE DEFAULT to_date('9999-12-31 23:59:59', 'YYYY-MM-DD HH24:MI:SS'),
0067   status        NUMBER
0068 );
0069 
0070 ALTER TABLE pvss_hv_chan_status_dat ADD CONSTRAINT pvss_hv_chan_status_pk PRIMARY KEY (logic_id, since, till);
0071 ALTER TABLE pvss_hv_chan_status_dat ADD CONSTRAINT pvss_hv_chan_status_uk UNIQUE (since, till);
0072 
0073 
0074 
0075 
0076 /* Function for converting PVSS ID to logic_id */
0077 @pvss_hvchannellogicid_func
0078 @pvss_hvboardlogicid_func
0079 
0080 
0081 /* Triggers for creating seamless IOVs */
0082 CREATE OR REPLACE
0083 TRIGGER pvss_hv_imon_tg
0084   BEFORE INSERT ON pvss_hv_imon_dat
0085   REFERENCING NEW AS newiov
0086   FOR EACH ROW
0087   
0088 begin
0089   update_online_pvss_iov_date('pvss_hv_imon_dat', :newiov.since, :newiov.till,:newiov.logic_id);
0090 end;
0091 /
0092 
0093 CREATE OR REPLACE
0094 TRIGGER pvss_hv_i0_tg
0095   BEFORE INSERT ON pvss_hv_i0_dat
0096   REFERENCING NEW AS newiov
0097   FOR EACH ROW
0098   
0099 begin
0100   update_online_pvss_iov_date('pvss_hv_i0_dat', :newiov.since, :newiov.till,:newiov.logic_id);
0101 end;
0102 /
0103 
0104 CREATE OR REPLACE
0105 TRIGGER pvss_hv_vmon_tg
0106   BEFORE INSERT ON pvss_hv_vmon_dat
0107   REFERENCING NEW AS newiov
0108   FOR EACH ROW
0109   
0110 begin
0111   update_online_pvss_iov_date('pvss_hv_vmon_dat', :newiov.since, :newiov.till,:newiov.logic_id);
0112 end;
0113 /
0114 
0115 CREATE OR REPLACE
0116 TRIGGER pvss_hv_v0_tg
0117   BEFORE INSERT ON pvss_hv_v0_dat
0118   REFERENCING NEW AS newiov
0119   FOR EACH ROW
0120   
0121 begin
0122   update_online_pvss_iov_date('pvss_hv_v0_dat', :newiov.since, :newiov.till,:newiov.logic_id);
0123 end;
0124 /
0125 
0126 CREATE OR REPLACE
0127 TRIGGER pvss_hv_t_board_tg
0128   BEFORE INSERT ON pvss_hv_t_board_dat
0129   REFERENCING NEW AS newiov
0130   FOR EACH ROW
0131   
0132 begin
0133   update_online_pvss_iov_date('pvss_hv_t_board_dat', :newiov.since, :newiov.till,:newiov.logic_id);
0134 end;
0135 /
0136 
0137 CREATE OR REPLACE
0138 TRIGGER pvss_hv_chan_status_tg
0139   BEFORE INSERT ON pvss_hv_chan_status_dat
0140   REFERENCING NEW AS newiov
0141   FOR EACH ROW
0142   
0143 begin
0144   update_online_pvss_iov_date('pvss_hv_chan_status_dat', :newiov.since, :newiov.till,:newiov.logic_id);
0145 end;
0146 /