diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql index 02cfd0d31ee..e0b9135f248 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -1,19 +1,19 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE ( - ID INT auto_increment NOT NULL, + ID INTEGER AUTO_INCREMENT NOT NULL, NAME VARCHAR(300) DEFAULT NULL, PRIMARY KEY (ID) )ENGINE = InnoDB; CREATE TABLE IF NOT EXISTS DM_DEVICE ( - ID INTEGER auto_increment NOT NULL, + ID INTEGER AUTO_INCREMENT NOT NULL, DESCRIPTION TEXT DEFAULT NULL, NAME VARCHAR(100) DEFAULT NULL, DEVICE_TYPE_ID INT(11) DEFAULT NULL, DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL, TENANT_ID INTEGER DEFAULT 0, PRIMARY KEY (ID), - CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID ) + CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID) REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION )ENGINE = InnoDB; @@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION ( OPERATION_ID INTEGER NOT NULL, OPERATION_CONFIG BLOB DEFAULT NULL, PRIMARY KEY (OPERATION_ID), - CONSTRAINT fk_dm_operation_config FOREIGN KEY (OPERATION_ID) REFERENCES + CONSTRAINT FK_DM_OPERATION_CONFIG FOREIGN KEY (OPERATION_ID) REFERENCES DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION )ENGINE = InnoDB; @@ -41,7 +41,7 @@ CREATE TABLE IF NOT EXISTS DM_COMMAND_OPERATION ( OPERATION_ID INTEGER NOT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, PRIMARY KEY (OPERATION_ID), - CONSTRAINT fk_dm_operation_command FOREIGN KEY (OPERATION_ID) REFERENCES + CONSTRAINT FK_DM_OPERATION_COMMAND FOREIGN KEY (OPERATION_ID) REFERENCES DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION )ENGINE = InnoDB; @@ -51,7 +51,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_OPERATION ( ENABLED INTEGER NOT NULL DEFAULT 0, OPERATION_DETAILS BLOB DEFAULT NULL, PRIMARY KEY (OPERATION_ID), - CONSTRAINT fk_dm_operation_policy FOREIGN KEY (OPERATION_ID) REFERENCES + CONSTRAINT FK_DM_OPERATION_POLICY FOREIGN KEY (OPERATION_ID) REFERENCES DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION )ENGINE = InnoDB; @@ -61,7 +61,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_OPERATION ( ENABLED INTEGER NOT NULL DEFAULT 0, OPERATION_DETAILS BLOB DEFAULT NULL, PRIMARY KEY (OPERATION_ID), - CONSTRAINT fk_dm_operation_profile FOREIGN KEY (OPERATION_ID) REFERENCES + CONSTRAINT FK_DM_OPERATION_PROFILE FOREIGN KEY (OPERATION_ID) REFERENCES DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION )ENGINE = InnoDB; @@ -76,7 +76,7 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( DATE_OF_LAST_UPDATE TIMESTAMP NULL DEFAULT NULL, TENANT_ID INT NOT NULL, PRIMARY KEY (ID), - CONSTRAINT fk_dm_device_enrolment FOREIGN KEY (DEVICE_ID) REFERENCES + CONSTRAINT FK_DM_DEVICE_ENROLMENT FOREIGN KEY (DEVICE_ID) REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION )ENGINE = InnoDB; @@ -378,9 +378,10 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING ( DM_APPLICATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION )ENGINE = InnoDB; --- POLICY RELATED TABLES FINISHED -- +-- END OF POLICY RELATED TABLES -- + +-- NOTIFICATION TABLES -- --- NOTIFICATION TABLE -- CREATE TABLE IF NOT EXISTS DM_NOTIFICATION ( NOTIFICATION_ID INTEGER AUTO_INCREMENT NOT NULL, DEVICE_ID INTEGER NOT NULL, @@ -394,9 +395,6 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION ( CONSTRAINT fk_dm_operation_notification FOREIGN KEY (OPERATION_ID) REFERENCES DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION )ENGINE = InnoDB; --- NOTIFICATION TABLE END -- --- TO:DO - Remove this INSERT sql statement. -Insert into DM_DEVICE_TYPE (ID,NAME) VALUES (1, 'android'); -Insert into DM_DEVICE_TYPE (ID,NAME) VALUES (2, 'ios'); +-- END NOTIFICATION TABLES -- diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql index c369bf01498..0b82e2e5259 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -627,7 +627,4 @@ END; / -- NOTIFICATION TABLE END -- --- TO:DO - Remove this INSERT sql statement. -Insert into DM_DEVICE_TYPE (ID,NAME) VALUES (1, 'android'); -Insert into DM_DEVICE_TYPE (ID,NAME) VALUES (2, 'ios'); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql index 2eeef9d8d81..ac0eef4f661 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -344,6 +344,3 @@ CREATE TABLE IF NOT EXISTS DM_NOTIFICATION ( ); -- NOTIFICATION TABLE END -- --- TO:DO - Remove this INSERT sql statement. -Insert into DM_DEVICE_TYPE (ID,NAME) VALUES (1, 'android'); -Insert into DM_DEVICE_TYPE (ID,NAME) VALUES (2, 'ios'); \ No newline at end of file