add DB table scripts

pull/111/head
Thashmi-nil 2 years ago
parent da3644ac5b
commit a198191a8a

@ -358,6 +358,18 @@
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>io.entgra.notification.logger</artifactId> <artifactId>io.entgra.notification.logger</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.wso2.orbit.javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1.wso2v1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.wso2.orbit.javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1.wso2v1</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -417,6 +417,14 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
-- POLICY RELATED TABLES FINISHED -- -- POLICY RELATED TABLES FINISHED --
CREATE TABLE IF NOT EXISTS DM_APP_ICONS (
ID INTEGER AUTO_INCREMENT NOT NULL,
ICON_PATH VARCHAR(150) DEFAULT NULL,
PACKAGE_NAME VARCHAR(150) NOT NULL,
VERSION VARCHAR(50) DEFAULT '1.1.0',
PRIMARY KEY (ID)
);
-- NOTIFICATION TABLE -- -- NOTIFICATION TABLE --
CREATE TABLE IF NOT EXISTS DM_NOTIFICATION ( CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
NOTIFICATION_ID INTEGER AUTO_INCREMENT NOT NULL, NOTIFICATION_ID INTEGER AUTO_INCREMENT NOT NULL,

@ -446,6 +446,15 @@ CREATE INDEX IDX_DM_APPLICATION ON DM_APPLICATION(DEVICE_ID, ENROLMENT_ID, TENAN
-- POLICY RELATED TABLES FINISHED -- -- POLICY RELATED TABLES FINISHED --
IF NOT EXISTS (SELECT * SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_APP_ICONS]') AND TYPE IN (N'U'))
CREATE TABLE DM_APP_ICONS (
ID INTEGER IDENTITY(1,1) NOT NULL,
ICON_PATH VARCHAR(150) DEFAULT NULL,
PACKAGE_NAME VARCHAR(150) NOT NULL,
VERSION VARCHAR(50) DEFAULT '1.1.0',
PRIMARY KEY (ID)
);
-- POLICY AND DEVICE GROUP MAPPING -- -- POLICY AND DEVICE GROUP MAPPING --
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_GROUP_POLICY]') AND TYPE IN (N'U')) IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_GROUP_POLICY]') AND TYPE IN (N'U'))
CREATE TABLE DM_DEVICE_GROUP_POLICY ( CREATE TABLE DM_DEVICE_GROUP_POLICY (

@ -458,6 +458,14 @@ CREATE INDEX IDX_DM_APPLICATION ON DM_APPLICATION(DEVICE_ID, ENROLMENT_ID, TENAN
-- END OF POLICY RELATED TABLES -- -- END OF POLICY RELATED TABLES --
CREATE TABLE IF NOT EXISTS DM_APP_ICONS (
ID INTEGER AUTO_INCREMENT NOT NULL,
ICON_PATH VARCHAR(150) DEFAULT NULL,
PACKAGE_NAME VARCHAR(150) NOT NULL,
VERSION VARCHAR(50) DEFAULT '1.1.0',
PRIMARY KEY (ID)
)ENGINE = InnoDB;
-- POLICY AND DEVICE GROUP MAPPING -- -- POLICY AND DEVICE GROUP MAPPING --
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY ( CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (

@ -748,6 +748,26 @@ WHEN (NEW.ID IS NULL)
-- POLICY RELATED TABLES FINISHED -- -- POLICY RELATED TABLES FINISHED --
CREATE TABLE DM_APP_ICONS (
ID NUMBER(10) NOT NULL,
ICON_PATH VARCHAR2(150) DEFAULT NULL,
PACKAGE_NAME VARCHAR2(150) NOT NULL,
VERSION VARCHAR2(50) DEFAULT '1.1.0',
PRIMARY KEY (ID)
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE DM_APP_ICONS_seq START WITH 1 INCREMENT BY 1 NOCACHE
/
CREATE OR REPLACE TRIGGER DM_APP_ICONS_seq_tr
BEFORE INSERT ON DM_APP_ICONS FOR EACH ROW
WHEN (NEW.ID IS NULL)
BEGIN
SELECT DM_APP_ICONS_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
END;
/
-- NOTIFICATION TABLE -- -- NOTIFICATION TABLE --
CREATE TABLE DM_NOTIFICATION ( CREATE TABLE DM_NOTIFICATION (
NOTIFICATION_ID NUMBER(10) NOT NULL, NOTIFICATION_ID NUMBER(10) NOT NULL,

@ -490,6 +490,17 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION (
-- END OF POLICY RELATED TABLES -- -- END OF POLICY RELATED TABLES --
CREATE SEQUENCE DM_APP_ICONS_seq;
CREATE TABLE IF NOT EXISTS DM_APP_ICONS (
ID INTEGER DEFAULT NEXTVAL ('DM_APP_ICONS_seq') NOT NULL,
ICON_PATH VARCHAR(150) DEFAULT NULL,
PACKAGE_NAME VARCHAR(150) NOT NULL,
VERSION VARCHAR(50) DEFAULT '1.1.0',
PRIMARY KEY (ID)
)
;
-- POLICY AND DEVICE GROUP MAPPING -- -- POLICY AND DEVICE GROUP MAPPING --
CREATE SEQUENCE DM_DEVICE_GROUP_POLICY_seq; CREATE SEQUENCE DM_DEVICE_GROUP_POLICY_seq;

Loading…
Cancel
Save