CREATE TABLE ZH_REPOSITORY_LANGUAGE (
  ID NUMBER(10) NOT NULL, 
  LANGUAGE_ID NUMBER(10) NOT NULL, 
  REPOSITORY_ID NUMBER(10) NOT NULL, 
  CREATED_BY VARCHAR2(255) NOT NULL, 
  UPDATED_BY VARCHAR2(255) NOT NULL, 
  CREATED DATE NOT NULL, 
  UPDATED DATE NOT NULL,
  CONSTRAINT LANGUAGE_REPOSITORY_PK PRIMARY KEY(ID)
)
/
ALTER TABLE ZH_REPOSITORY_LANGUAGE ADD CONSTRAINT LANG_REPOSITORY_REPOSITORY_FK FOREIGN KEY (REPOSITORY_ID) REFERENCES REPOSITORY (ID) ON DELETE CASCADE
/
ALTER TABLE ZH_REPOSITORY_LANGUAGE ADD CONSTRAINT LANG_REPOSITORY_LANGUAGE_FK FOREIGN KEY (LANGUAGE_ID) REFERENCES ZH_LANGUAGE (ID) ON DELETE CASCADE
/
CREATE TABLE ZH_PROJECT_REPOSITORY (
  ID NUMBER(10) NOT NULL, 
  PROJECT_ID NUMBER(10) NOT NULL, 
  REPOSITORY_ID NUMBER(10) NOT NULL, 
  IS_ACTIVE VARCHAR2(1) DEFAULT 'Y' NOT NULL, 
  CREATED_BY VARCHAR2(255) NOT NULL, 
  UPDATED_BY VARCHAR2(255) NOT NULL, 
  CREATED DATE NOT NULL, 
  UPDATED DATE NOT NULL,
  CONSTRAINT PRJ_REP_PK PRIMARY KEY(ID)
)
/
ALTER TABLE ZH_PROJECT_REPOSITORY ADD CONSTRAINT PRJ_REP_PROJECT_FK FOREIGN KEY (PROJECT_ID) REFERENCES PROJECT (ID) ON DELETE CASCADE
/
ALTER TABLE ZH_PROJECT_REPOSITORY ADD CONSTRAINT PRJ_REP_REPOSITORY_FK FOREIGN KEY (REPOSITORY_ID) REFERENCES REPOSITORY (ID) ON DELETE CASCADE
/
ALTER TABLE ZH_PROJECT_REPOSITORY ADD CONSTRAINT CHECK_PROJ_REPO_ACTIVE CHECK ((IS_ACTIVE IN ('Y', 'N')))

