CREATE TABLE TASK_FEATURES (
  ID NUMBER(10) NOT NULL, 
  ORGANIZATION_ID NUMBER(10) NOT NULL, 
  CREATED_BY NUMBER(10) DEFAULT NULL NULL, 
  CREATED_AT DATE DEFAULT SYSDATE NOT NULL, 
  UPDATED_BY NUMBER(10) DEFAULT NULL NULL, 
  UPDATED_AT DATE DEFAULT SYSDATE NOT NULL, 
  DESCRIPTION VARCHAR2(255) NOT NULL, 
  TIME_BASE NUMBER(10) NOT NULL, 
  STATUS VARCHAR2(1) DEFAULT 'A' NOT NULL,
  CONSTRAINT TASK_FEATURES_PK PRIMARY KEY(ID)
)
/
ALTER TABLE TASK_FEATURES ADD CONSTRAINT TASK_FEATURES_ORG_FK FOREIGN KEY (ORGANIZATION_ID) REFERENCES ORGANIZATION (ID)
/
ALTER TABLE TASK_FEATURES ADD CONSTRAINT TASK_FEATURES_USER_FK1 FOREIGN KEY (CREATED_BY) REFERENCES ZH_USER (ID)
/
ALTER TABLE TASK_FEATURES ADD CONSTRAINT TASK_FEATURES_USER_FK2 FOREIGN KEY (UPDATED_BY) REFERENCES ZH_USER (ID)
/
ALTER TABLE TASK_FEATURES ADD CONSTRAINT CKC_TASK_FEATURES_STATUS CHECK (STATUS in ('A','I','D'))
/
CREATE SEQUENCE TASK_FEATURES_ID_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1
/
ALTER TABLE TASK ADD (
  TASK_FEATURES NUMBER(10) DEFAULT NULL NULL
)
/
ALTER TABLE TASK ADD CONSTRAINT TASK_TASK_FEATURES_FK FOREIGN KEY (TASK_FEATURES) REFERENCES TASK_FEATURES (ID)
/
ALTER TABLE TASK ADD (
   TIME_SCORE NUMBER(10) DEFAULT NULL NULL
)
/
ALTER TABLE RESOURCE_T ADD (
  RATING DOUBLE PRECISION DEFAULT 1 NOT NULL
)
/