CREATE TABLE PROJECT_RELATIONSHIP (
  ID NUMBER(10) NOT NULL, 
  PROJECT NUMBER(10) NOT NULL, 
  PROJECT_RELATIONSHIP NUMBER(10) NOT NULL, 
  TYPE VARCHAR2(1) NOT NULL, 
  ORGANIZATION 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,
  CONSTRAINT PROJECT_RELATIONSHIP_PK PRIMARY KEY(ID)
)
/
CREATE SEQUENCE PROJECT_RELATIONSHIP_ID_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1
/
ALTER TABLE PROJECT_RELATIONSHIP ADD CONSTRAINT PROJ_RELATIONSHIP_PROJECT_FK FOREIGN KEY (PROJECT) REFERENCES PROJECT (ID)
/
ALTER TABLE PROJECT_RELATIONSHIP ADD CONSTRAINT PROJ_RELATIONSHIP_PROJECT_R_FK FOREIGN KEY (PROJECT_RELATIONSHIP) REFERENCES PROJECT (ID)
/

CREATE TABLE CLASSIFICATION_TASK_STATUS (
  ID NUMBER(10) NOT NULL, 
  CLASSIFICATION NUMBER(10) NOT NULL, 
  TASK_STATUS NUMBER(10) NOT NULL, 
  TYPE VARCHAR2(1) DEFAULT 'P' NOT NULL,
  ORGANIZATION 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,
  CONSTRAINT CLASSIFICATION_TASK_STATUS_PK PRIMARY KEY(ID)
)
/
CREATE SEQUENCE CLASSIF_TASK_STATUS_ID_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1
/
ALTER TABLE CLASSIFICATION_TASK_STATUS ADD CONSTRAINT CLASSIF_TASK_STATUS_CLASSIF_FK FOREIGN KEY (CLASSIFICATION) REFERENCES CLASSIFICATION (ID)
/
ALTER TABLE CLASSIFICATION_TASK_STATUS ADD CONSTRAINT CLASSIF_TASK_ST_TASK_STATUS_FK FOREIGN KEY (TASK_STATUS) REFERENCES TASK_STATUS (ID)
/

CREATE TABLE CLASSIFICATION_PROJECT_TYPE (
  ID NUMBER(10) NOT NULL,
  CLASSIFICATION NUMBER(10) NOT NULL, 
  PROJECT_TYPE NUMBER(10) NOT NULL, 
  TYPE VARCHAR2(1) DEFAULT 'P' NOT NULL,
  ORGANIZATION 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,
  CONSTRAINT CLASSIFICATION_PROJECT_TYPE_PK PRIMARY KEY (ID)
)
/
CREATE SEQUENCE CLASSIF_PROJECT_TYPE_ID_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1
/
ALTER TABLE CLASSIFICATION_PROJECT_TYPE ADD CONSTRAINT CLASSIF_PROJ_TYPE_CLASSIF_FK FOREIGN KEY (CLASSIFICATION) REFERENCES CLASSIFICATION (ID)
/
ALTER TABLE CLASSIFICATION_PROJECT_TYPE ADD CONSTRAINT CLASSIF_PROJ_TYPE_PROJ_TYPE_FK FOREIGN KEY (PROJECT_TYPE) REFERENCES PROJECT_TYPE (ID)
/

ALTER TABLE PROJECT_TYPE ADD (
  RESOURCE_CAN_CHANGE_PROJECT VARCHAR2(1) DEFAULT 'Y' NOT NULL
)
/

ALTER TABLE CLASSIFICATION ADD (
  CONTROL VARCHAR2(1) NULL
)
/
