   ADD COLUMN HIERARCHY VARCHAR(32) NOT NULL
   DEFAULT '';
 
+ALTER TABLE CONF_LOGGERS_EFFECTIVE
+  DROP COLUMN NAME;
+
+ALTER TABLE CONF_LOGGERS_EFFECTIVE
+  DROP COLUMN PARENT_ID;
+
 ALTER TABLE CONF_LOGGERS_EFFECTIVE ALTER COLUMN LEVEL_ID SET NOT NULL;
 
 CALL SYSPROC.ADMIN_CMD ('REORG TABLE CONF_LOGGERS_EFFECTIVE');


ALTER TABLE CONF_LOGGERS ADD CONSTRAINT LOG_LOGGERS_FK_LEVELS FOREIGN KEY (LEVEL_ID) REFERENCES LEVELS (LEVEL_ID) ON DELETE CASCADE;

ALTER TABLE CONF_LOGGERS ADD CONSTRAINT LOG_LOGGERS_FK_PARENT FOREIGN KEY (PARENT_ID) REFERENCES CONF_LOGGERS (LOGGER_ID) ON DELETE CASCADE;

COMMENT ON TABLE CONF_LOGGERS IS 'Configuration table for the logger levels';


ALTER TABLE CONF_LOGGERS_EFFECTIVE ADD CONSTRAINT LOG_LOGGERS_EFF_FK_LEVELS FOREIGN KEY (LEVEL_ID) REFERENCES LEVELS (LEVEL_ID) ON DELETE CASCADE;

ALTER TABLE CONF_LOGGERS_EFFECTIVE ADD CONSTRAINT LOG_LOGGERS_EFF_FK_CNF_LOG FOREIGN KEY (LOGGER_ID) REFERENCES CONF_LOGGERS (LOGGER_ID) ON DELETE CASCADE;

COMMENT ON TABLE CONF_LOGGERS_EFFECTIVE IS 'Configuration table for the effective logger levels';

COMMENT ON CONF_LOGGERS_EFFECTIVE (
  LOGGER_ID IS 'Logger identifier',
  LEVEL_ID IS 'Log level to register',
  HIERARCHY IS 'Comma separated numbers that represents the hierarchy'
  );
