CREATE TABLE PRODUCT_VERSION_PACKAGES
  (
    ID                 NUMBER(10) NOT NULL,
    NAME               VARCHAR2(120) NOT NULL,
    PATH               VARCHAR2(500) NOT NULL,
    FILE_NAME          VARCHAR2(100) NOT NULL,
    ORGANIZATION_ID    NUMBER(10) NOT NULL,
    IS_ACTIVE          VARCHAR2(1) DEFAULT 'Y' 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,
    PRODUCT_VERSION_ID NUMBER(10) NOT NULL,
    SERVER_ID          NUMBER(10) NOT NULL,
    CONSTRAINT PRODUCT_VERSION_PACKAGES_PK PRIMARY KEY(ID)
  )
/

CREATE INDEX PROD_VERSION_PACKAGES_ORG_FK ON PRODUCT_VERSION_PACKAGES (ORGANIZATION_ID)
/
CREATE INDEX PROD_VERSION_PACKAGES_USER_FK1 ON PRODUCT_VERSION_PACKAGES (UPDATED_BY)
/
CREATE INDEX PROD_VERSION_PACKAGES_USER_FK2 ON PRODUCT_VERSION_PACKAGES (CREATED_BY)
/
CREATE INDEX PROD_VERSION_PACKAGES_SERV_FK ON PRODUCT_VERSION_PACKAGES (SERVER_ID)
/
CREATE INDEX PROD_VERSION_PACKAGES_PRVER_FK ON PRODUCT_VERSION_PACKAGES (PRODUCT_VERSION_ID)
/
CREATE SEQUENCE PROD_VERSION_PACKAGES_ID_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1
/

ALTER TABLE PRODUCT_VERSION_PACKAGES ADD CONSTRAINT PROD_VERSION_PACKAGES_PRVER_FK FOREIGN KEY (PRODUCT_VERSION_ID) REFERENCES PRODUCT_VERSION (ID)
/
ALTER TABLE PRODUCT_VERSION_PACKAGES ADD CONSTRAINT PROD_VERSION_PACKAGES_SERV_FK FOREIGN KEY (SERVER_ID) REFERENCES SERVER (ID)
/
ALTER TABLE PRODUCT_VERSION_PACKAGES ADD CONSTRAINT PROD_VERSION_PACKAGES_ORG_FK FOREIGN KEY (ORGANIZATION_ID) REFERENCES ORGANIZATION (ID)
/
ALTER TABLE PRODUCT_VERSION_PACKAGES ADD CONSTRAINT PROD_VERSION_PACKAGES_USER_FK1 FOREIGN KEY (UPDATED_BY) REFERENCES ZH_USER (ID)
/
ALTER TABLE PRODUCT_VERSION_PACKAGES ADD CONSTRAINT PROD_VERSION_PACKAGES_USER_FK2 FOREIGN KEY (CREATED_BY) REFERENCES ZH_USER (ID)
/