CREATE TABLE TASK_LOG
  (
    ID           NUMBER(10) NOT NULL,
    LOG_TYPE     VARCHAR2(30) NOT NULL,
    TABLE_NAME   VARCHAR2(50) DEFAULT NULL NULL,
    COLUMN_NAME  VARCHAR2(50) DEFAULT NULL NULL,
    OLD_VALUE    VARCHAR2(2500) DEFAULT NULL NULL,
    NEW_VALUE    VARCHAR2(2500) DEFAULT NULL NULL,
    ORGANIZATION NUMBER(10) NOT NULL,
    CREATED_BY   NUMBER(10) DEFAULT NULL NULL,
    CREATED_AT   DATE NOT NULL,
    UPDATED_BY   NUMBER(10) DEFAULT NULL NULL,
    UPDATED_AT   DATE NOT NULL,
    TASK         NUMBER(10) DEFAULT NULL NULL,
    RESOURCE_T   NUMBER(10) DEFAULT NULL NULL,
    constraint TASK_LOG_PK primary key (ID)
  )
/
CREATE INDEX TASK_LOG_TASK_FK on TASK_LOG (TASK asc)
/
CREATE INDEX TASK_LOG_RESOURCE_T_FK ON TASK_LOG (RESOURCE_T)
/
ALTER TABLE TASK_LOG
ADD CONSTRAINT TASK_LOG_TASK_FK FOREIGN KEY (TASK)
REFERENCES TASK (ID);
/
ALTER TABLE TASK_LOG
ADD CONSTRAINT TASK_LOG_RESOURCE_T_FK FOREIGN KEY (RESOURCE_T)
REFERENCES RESOURCE_T (ID);
/
CREATE SEQUENCE TASK_LOG_ID_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1
/