|
|
|
@ -737,54 +737,27 @@ CREATE TABLE DM_APPLICATION (
|
|
|
|
|
APP_PROPERTIES BLOB NULL,
|
|
|
|
|
MEMORY_USAGE NUMBER(10) NULL,
|
|
|
|
|
IS_ACTIVE NUMBER(10) DEFAULT 0 NOT NULL,
|
|
|
|
|
TENANT_ID NUMBER(10) NOT NULL,
|
|
|
|
|
CONSTRAINT PK_DM_APPLICATION PRIMARY KEY (ID)
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_APPLICATION_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_APPLICATION_seq_tr
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_APPLICATION
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_APPLICATION_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE DM_DEVICE_APPLICATION_MAPPING (
|
|
|
|
|
ID NUMBER(10) NOT NULL,
|
|
|
|
|
DEVICE_ID NUMBER(10) NOT NULL,
|
|
|
|
|
ENROLMENT_ID NUMBER(10 NOT NULL,
|
|
|
|
|
APPLICATION_ID NUMBER(10) NOT NULL,
|
|
|
|
|
APP_PROPERTIES BLOB NULL,
|
|
|
|
|
MEMORY_USAGE NUMBER(10) NULL,
|
|
|
|
|
IS_ACTIVE NUMBER(10) DEFAULT 0 NOT NULL,
|
|
|
|
|
TENANT_ID NUMBER(10) NOT NULL,
|
|
|
|
|
CONSTRAINT PK_DM_DEVICE_APP_MAPPING PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT PK_DM_APPLICATION PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES
|
|
|
|
|
DM_DEVICE (ID),
|
|
|
|
|
CONSTRAINT fk_dm_application FOREIGN KEY (APPLICATION_ID) REFERENCES
|
|
|
|
|
DM_APPLICATION (ID),
|
|
|
|
|
CONSTRAINT FK_DM_APP_MAP_DM_ENROL FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
|
|
|
|
CONSTRAINT fk_dm_enrolment FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
|
|
|
|
DM_ENROLMENT (ID)
|
|
|
|
|
)
|
|
|
|
|
/
|
|
|
|
|
-- Generate ID using sequence and trigger
|
|
|
|
|
CREATE SEQUENCE DM_DEVICE_APP_MAPPING_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
CREATE SEQUENCE DM_APPLICATION_seq START WITH 1 INCREMENT BY 1 NOCACHE
|
|
|
|
|
/
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_DEVICE_APP_MAPPING_seq_tr
|
|
|
|
|
CREATE OR REPLACE TRIGGER DM_APPLICATION_seq_tr
|
|
|
|
|
BEFORE INSERT
|
|
|
|
|
ON DM_DEVICE_APPLICATION_MAPPING
|
|
|
|
|
ON DM_APPLICATION
|
|
|
|
|
REFERENCING NEW AS NEW
|
|
|
|
|
FOR EACH ROW
|
|
|
|
|
WHEN (NEW.ID IS NULL)
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DM_DEVICE_APP_MAPPING_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
SELECT DM_APPLICATION_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
|
|
|
|
|
END;
|
|
|
|
|
/
|
|
|
|
|
|
|
|
|
|