ALTER TABLE PROJECT_TYPE 
ADD REQUIRES_APPROVAL VARCHAR2(1) DEFAULT 'N' NOT NULL
CONSTRAINT CKC_PROJECT_TYPE_REQ_APPROVAL CHECK (REQUIRES_APPROVAL in ('Y','N'))
/

CREATE TABLE PROJECT_APPROVAL
  (
    ID              NUMBER(10) NOT NULL,
    PROFILE_ID      NUMBER(10) NOT NULL,
    PROJECT_TYPE_ID NUMBER(10) NOT NULL,
    IS_ACTIVE       VARCHAR2(1) DEFAULT 'Y' NOT NULL,
    ORGANIZATION_ID NUMBER(10) NOT NULL,
    CREATED         DATE DEFAULT SYSDATE NOT NULL,
    CREATED_BY      NUMBER(10) NOT NULL,
    UPDATED         DATE DEFAULT SYSDATE NOT NULL,
    UPDATED_BY      NUMBER(10) NOT NULL,
    CONSTRAINT PROJECT_APPROVAL_PK PRIMARY KEY(ID)
  )
/

CREATE INDEX PROJECT_APPROVAL_PROJ_TYPE_FK ON PROJECT_APPROVAL (PROJECT_TYPE_ID)
/
CREATE INDEX PROJECT_APPROVAL_ORG_FK ON PROJECT_APPROVAL (ORGANIZATION_ID)
/
CREATE INDEX PROJECT_APPROVAL_USER_FK1 ON PROJECT_APPROVAL (UPDATED_BY)
/
CREATE INDEX PROJECT_APPROVAL_USER_FK2 ON PROJECT_APPROVAL (CREATED_BY)
/
CREATE SEQUENCE PROJECT_APPROVAL_ID_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1
/

ALTER TABLE PROJECT_APPROVAL
ADD CONSTRAINT PROJECT_APPROVAL_PROJ_TYPE_FK FOREIGN KEY (PROJECT_TYPE_ID)
REFERENCES PROJECT_TYPE (ID)
/
ALTER TABLE PROJECT_APPROVAL
ADD CONSTRAINT PROJECT_APPROVAL_ORG_FK FOREIGN KEY (ORGANIZATION_ID)
REFERENCES ORGANIZATION (ID)
/
ALTER TABLE PROJECT_APPROVAL
ADD CONSTRAINT PROJECT_APPROVAL_USER_FK1 FOREIGN KEY (UPDATED_BY)
REFERENCES ZH_USER (ID)
/
ALTER TABLE PROJECT_APPROVAL
ADD CONSTRAINT PROJECT_APPROVAL_USER_FK2 FOREIGN KEY (CREATED_BY)
REFERENCES ZH_USER (ID)
/
