forked from community/device-mgt-core
* Change method signature of OperationMappingDAO.addOperationMapping to support a list of device id integers * Removed h2.sql and added them to CreateH2TestDB.sql in the test resources * Cleaned up the DeviceManagementBaseTest classrevert-70aa11f8
parent
c40af0de7a
commit
6d7f6767b5
@ -1,58 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
|
|
||||||
ID INT auto_increment NOT NULL,
|
|
||||||
NAME VARCHAR(300) NULL DEFAULT NULL,
|
|
||||||
PRIMARY KEY (ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
|
||||||
ID INTEGER auto_increment NOT NULL,
|
|
||||||
DESCRIPTION TEXT NULL DEFAULT NULL,
|
|
||||||
NAME VARCHAR(100) NULL DEFAULT NULL,
|
|
||||||
DATE_OF_ENROLLMENT BIGINT NULL DEFAULT NULL,
|
|
||||||
DATE_OF_LAST_UPDATE BIGINT NULL DEFAULT NULL,
|
|
||||||
OWNERSHIP VARCHAR(45) NULL DEFAULT NULL,
|
|
||||||
STATUS VARCHAR(15) NULL DEFAULT NULL,
|
|
||||||
DEVICE_TYPE_ID INT(11) NULL DEFAULT NULL,
|
|
||||||
DEVICE_IDENTIFICATION VARCHAR(300) NULL DEFAULT NULL,
|
|
||||||
OWNER VARCHAR(45) NULL DEFAULT NULL,
|
|
||||||
TENANT_ID INTEGER DEFAULT 0,
|
|
||||||
PRIMARY KEY (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
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
|
||||||
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
||||||
TYPE VARCHAR(50) NOT NULL,
|
|
||||||
CREATED_TIMESTAMP TIMESTAMP NOT NULL,
|
|
||||||
RECEIVED_TIMESTAMP TIMESTAMP NULL,
|
|
||||||
STATUS VARCHAR(50) NULL,
|
|
||||||
PRIMARY KEY (ID)
|
|
||||||
)
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION (
|
|
||||||
OPERATION_ID INTEGER NOT NULL,
|
|
||||||
PRIMARY KEY (OPERATION_ID),
|
|
||||||
CONSTRAINT fk_dm_operation_config FOREIGN KEY (OPERATION_ID) REFERENCES
|
|
||||||
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
||||||
)
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_COMMAND_OPERATION (
|
|
||||||
OPERATION_ID INTEGER NOT NULL,
|
|
||||||
ENABLED INTEGER NOT NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY (OPERATION_ID),
|
|
||||||
CONSTRAINT fk_dm_operation_command FOREIGN KEY (OPERATION_ID) REFERENCES
|
|
||||||
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
||||||
)
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_MAPPING (
|
|
||||||
ID INTEGER AUTO_INCREMENT NOT NULL,
|
|
||||||
DEVICE_ID INTEGER NOT NULL,
|
|
||||||
OPERATION_ID INTEGER NOT NULL,
|
|
||||||
PRIMARY KEY (ID),
|
|
||||||
CONSTRAINT fk_dm_device_operation_mapping_device FOREIGN KEY (DEVICE_ID) REFERENCES
|
|
||||||
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
||||||
CONSTRAINT fk_dm_device_operation_mapping_operation FOREIGN KEY (OPERATION_ID) REFERENCES
|
|
||||||
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
||||||
)
|
|
||||||
|
|
@ -1,26 +1,60 @@
|
|||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
|
||||||
(
|
ID INT auto_increment NOT NULL,
|
||||||
ID INT(11) auto_increment NOT NULL,
|
NAME VARCHAR(300) NULL DEFAULT NULL,
|
||||||
NAME VARCHAR(300) NULL DEFAULT NULL,
|
PRIMARY KEY (ID)
|
||||||
PRIMARY KEY (ID)
|
);
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE
|
CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
||||||
(
|
ID INTEGER auto_increment NOT NULL,
|
||||||
ID INT auto_increment NOT NULL,
|
DESCRIPTION TEXT NULL DEFAULT NULL,
|
||||||
DESCRIPTION TEXT NULL DEFAULT NULL,
|
NAME VARCHAR(100) NULL DEFAULT NULL,
|
||||||
NAME VARCHAR(100) NULL DEFAULT NULL,
|
|
||||||
DATE_OF_ENROLLMENT BIGINT NULL DEFAULT NULL,
|
DATE_OF_ENROLLMENT BIGINT NULL DEFAULT NULL,
|
||||||
DATE_OF_LAST_UPDATE BIGINT NULL DEFAULT NULL,
|
DATE_OF_LAST_UPDATE BIGINT NULL DEFAULT NULL,
|
||||||
OWNERSHIP VARCHAR(45) NULL DEFAULT NULL,
|
OWNERSHIP VARCHAR(45) NULL DEFAULT NULL,
|
||||||
STATUS VARCHAR(15) NULL DEFAULT NULL,
|
STATUS VARCHAR(15) NULL DEFAULT NULL,
|
||||||
DEVICE_TYPE_ID INT(11) NULL DEFAULT NULL,
|
DEVICE_TYPE_ID INT(11) NULL DEFAULT NULL,
|
||||||
DEVICE_IDENTIFICATION VARCHAR(300) NULL DEFAULT NULL,
|
DEVICE_IDENTIFICATION VARCHAR(300) NULL DEFAULT NULL,
|
||||||
OWNER VARCHAR(45) NULL DEFAULT NULL,
|
OWNER VARCHAR(45) NULL DEFAULT NULL,
|
||||||
TENANT_ID INTEGER DEFAULT 0,
|
TENANT_ID INTEGER DEFAULT 0,
|
||||||
PRIMARY KEY (ID),
|
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
|
REFERENCES DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
||||||
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
||||||
|
TYPE VARCHAR(50) NOT NULL,
|
||||||
|
CREATED_TIMESTAMP TIMESTAMP NOT NULL,
|
||||||
|
RECEIVED_TIMESTAMP TIMESTAMP NULL,
|
||||||
|
STATUS VARCHAR(50) NULL,
|
||||||
|
PRIMARY KEY (ID)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION (
|
||||||
|
OPERATION_ID INTEGER NOT NULL,
|
||||||
|
PRIMARY KEY (OPERATION_ID),
|
||||||
|
CONSTRAINT fk_dm_operation_config FOREIGN KEY (OPERATION_ID) REFERENCES
|
||||||
|
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS DM_COMMAND_OPERATION (
|
||||||
|
OPERATION_ID INTEGER NOT NULL,
|
||||||
|
ENABLED INTEGER NOT NULL DEFAULT 0,
|
||||||
|
PRIMARY KEY (OPERATION_ID),
|
||||||
|
CONSTRAINT fk_dm_operation_command FOREIGN KEY (OPERATION_ID) REFERENCES
|
||||||
|
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_MAPPING (
|
||||||
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
||||||
|
DEVICE_ID INTEGER NOT NULL,
|
||||||
|
OPERATION_ID INTEGER NOT NULL,
|
||||||
|
PRIMARY KEY (ID),
|
||||||
|
CONSTRAINT fk_dm_device_operation_mapping_device FOREIGN KEY (DEVICE_ID) REFERENCES
|
||||||
|
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT fk_dm_device_operation_mapping_operation FOREIGN KEY (OPERATION_ID) REFERENCES
|
||||||
|
DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||||
|
);
|
||||||
|
|
||||||
-- TO:DO - Remove this INSERT sql statement.
|
-- 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 (1, 'android');
|
||||||
|
Loading…
Reference in new issue