---ABS-148457

CREATE SEQUENCE SEQ_RASTOPACTIONORDER
START WITH 1
INCREMENT BY 1;

--RASTOPACTIONORDER TABLE
CREATE TABLE RASTOPACTIONORDER (
RASTOPACTIONORDER_ID           NUMBER NOT NULL,
DESCRIPTION                    VARCHAR2(40) NOT NULL,
REMARK                         VARCHAR2(200) NULL, 
ORDERNUMBER                    NUMBER NOT NULL,
INTERNALREF                    VARCHAR2(40) NOT NULL,
SYSTEMUSER_ID                  NUMBER NOT NULL,
TIMESTAMP                      DATE NOT NULL);


ALTER TABLE RASTOPACTIONORDER
      ADD CONSTRAINT XPKRASTOPACTIONORDER PRIMARY KEY (RASTOPACTIONORDER_ID);

CREATE UNIQUE INDEX XAK1RASTOPACTIONORDER ON RASTOPACTIONORDER (ORDERNUMBER ASC);


--RASTOPACTIONORDER_DESC TABLE 
CREATE TABLE RASTOPACTIONORDER_DESC (
RASTOPACTIONORDER_ID NUMBER NOT NULL,
DESCRIPTION VARCHAR2(40) NOT NULL,
REMARK VARCHAR2(200) NULL,
LANGUAGE_ID NUMBER NOT NULL,
SYSTEMUSER_ID NUMBER NOT NULL,
TIMESTAMP DATE NOT NULL);

CREATE INDEX XIF1RASTOPACTIONORDER_DESC ON RASTOPACTIONORDER_DESC (RASTOPACTIONORDER_ID);

CREATE INDEX XIF2RASTOPACTIONORDER_DESC ON RASTOPACTIONORDER_DESC (LANGUAGE_ID);


CREATE UNIQUE INDEX XA1RASTOPACTIONORDER ON RASTOPACTIONORDER_DESC (RASTOPACTIONORDER_ID ASC, LANGUAGE_ID ASC);

ALTER TABLE RASTOPACTIONORDER_DESC
      ADD CONSTRAINT FK_RASTACTOR_RASTACTOR_ID FOREIGN KEY (RASTOPACTIONORDER_ID)
      REFERENCES RASTOPACTIONORDER (RASTOPACTIONORDER_ID) ON DELETE CASCADE;

ALTER TABLE RASTOPACTIONORDER_DESC
      ADD CONSTRAINT FK_RASTACTOR_LANGUAGE_ID FOREIGN KEY (LANGUAGE_ID)
      REFERENCES LANGUAGES (LANGUAGE_ID) ON DELETE CASCADE;

