CREATE TABLE lv_firmware (
	serial          VARCHAR(8) NOT NULL,
	firmware        VARCHAR(8),
	loctime		TIMESTAMP,
	FOREIGN KEY (serial) REFERENCES lv_psu
);

INSERT INTO lv_firmware (serial, firmware, loctime) SELECT serial,firmware,(SELECT SYSDATE FROM DUAL) AS timenow FROM lv_psu;

ALTER TABLE lv_psu DROP COLUMN firmware;


CREATE TABLE hv_firmware (
	serial          VARCHAR(8) NOT NULL,
	firmware        VARCHAR(8),
	loctime		TIMESTAMP,
	FOREIGN KEY (serial) REFERENCES hv_psu
);

INSERT INTO hv_firmware (serial, firmware, loctime) SELECT serial,firmware,(SELECT SYSDATE FROM DUAL) AS timenow FROM hv_psu;

ALTER TABLE hv_psu DROP COLUMN firmware;

ALTER TABLE hv_loc DROP PRIMARY KEY CASCADE;

ALTER TABLE cfdat_version MODIFY name VARCHAR(255);
ALTER TABLE cfdat_config MODIFY name VARCHAR(255);
ALTER TABLE cfdat_script MODIFY name VARCHAR(255);
