CREATE TABLE DEPLOY_REPOSITORY (
  ORGANIZATION_ID NUMBER(10) NOT NULL, 
  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, 
  STATUS VARCHAR2(1) DEFAULT 'A' NOT NULL, 
  DEPLOY_ID NUMBER(10) NOT NULL, 
  EXTERNAL_REPOSITORY_ID NUMBER(10) NOT NULL, 
  INITIAL_MIGRATION_NUMBER NUMBER(10) NOT NULL,
  CONSTRAINT PK_DEPLOY_REPOSITORY PRIMARY KEY(ID)
)
/
ALTER TABLE DEPLOY_REPOSITORY ADD CONSTRAINT FK_DEPLOY_REPOSITORY_DEPLOY FOREIGN KEY (DEPLOY_ID) REFERENCES DEPLOY (ID)
/
ALTER TABLE DEPLOY_REPOSITORY ADD CONSTRAINT CKC_DEPLOY_REPOSITORY_STATUS CHECK (STATUS IN ('A', 'I', 'D'))
/
CREATE SEQUENCE DEPLOY_REPOSITORY_ID_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1