
--DROP TABLE ori;
--DROP TABLE oricfg;

CREATE TABLE ori (
	ori_id	NUMBER PRIMARY KEY
);


CREATE TABLE ori_loc (
	ori_id	NUMBER,
	roc_type CHAR(4),
	roc_serial NUMBER,
	side	CHAR(1),
	ori_loctime TIMESTAMP,
	FOREIGN KEY (roc_type,roc_serial) REFERENCES roc(roc_type,roc_serial),
	FOREIGN KEY (ori_id) REFERENCES ori(ori_id)
);

CREATE TABLE oricfg (
	ori_id	NUMBER NOT NULL,
	cpld_version NUMBER,
 	thrshld_curr FLOAT,
 	lsrdiod_rdyn FLOAT,
 	slope_imd_ib FLOAT,
 	ratio_op_imd FLOAT,
	reg00 NUMBER,
	reg01 NUMBER,
	reg02 NUMBER,
	reg03 NUMBER,
	reg04 NUMBER,
	reg05 NUMBER,
	reg06 NUMBER,
	reg07 NUMBER,
	reg08 NUMBER,
	reg09 NUMBER,
	reg10 NUMBER,
	reg11 NUMBER,
	reg12 NUMBER,
	reg13 NUMBER,
	reg14 NUMBER,
	reg15 NUMBER,
	begin_time TIMESTAMP(6) NOT NULL,
	FOREIGN KEY (ori_id) REFERENCES ori(ori_id)
);
