clean dbscripts

pull/58/head
prathabanKavin 2 years ago
parent 66fd492a0f
commit 463f726f82

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2023, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2022, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. * Copyright (c) 2023, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
* *
* Entgra (pvt) Ltd. licenses this file to you under the Apache License, * Entgra (pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except

@ -17,7 +17,7 @@
* *
*/ */
/* /*
* Copyright (c) 2022, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. * Copyright (c) 2023, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
* *
* Entgra (pvt) Ltd. licenses this file to you under the Apache License, * Entgra (pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except

@ -1,3 +1,21 @@
/*
* Copyright (c) 2023, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
*
* Entgra (pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.common.exceptions; package org.wso2.carbon.device.mgt.common.exceptions;
public class DeviceStatusException extends Exception{ public class DeviceStatusException extends Exception{

@ -1,3 +1,21 @@
/*
* Copyright (c) 2023, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
*
* Entgra (pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.common.exceptions; package org.wso2.carbon.device.mgt.common.exceptions;
public class InvalidStatusException extends Exception{ public class InvalidStatusException extends Exception{

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2023, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2023, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2023, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2023, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2023, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2023, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
@ -16,23 +16,6 @@
* under the License. * under the License.
* *
*/ */
/*
* Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
*
* Entgra (pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.core.service; package org.wso2.carbon.device.mgt.core.service;
@ -44,7 +27,7 @@ import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
import java.util.List; import java.util.List;
/** /**
* This interface manages the device lifecycle, such as statuschange and add status to table * This interface manages the device lifecycle, such as status change and add status to table
*/ */
public interface DeviceStateManagementService { public interface DeviceStateManagementService {
@ -53,7 +36,7 @@ public interface DeviceStateManagementService {
* *
* @param enrolmentInfo Enrollment Information about the device * @param enrolmentInfo Enrollment Information about the device
* @param nextStatus Next status of the device * @param nextStatus Next status of the device
* @return LifecycleStateDevice which contain current and previoius status * @return LifecycleStateDevice which contain current and previous status
* @throws InvalidStatusException If there is a invalid status or invalid status change * @throws InvalidStatusException If there is a invalid status or invalid status change
* @throws DeviceManagementDAOException if the device cannot be found * @throws DeviceManagementDAOException if the device cannot be found
*/ */
@ -61,7 +44,7 @@ public interface DeviceStateManagementService {
throws InvalidStatusException, DeviceStatusException; throws InvalidStatusException, DeviceStatusException;
/** /**
* Get the lifecycle history of the relevent device * Get the lifecycle history of the relevant device
* *
* @param device Device * @param device Device
* @return List of LifecycleStateDevice * @return List of LifecycleStateDevice

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2023, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
@ -16,23 +16,6 @@
* under the License. * under the License.
* *
*/ */
/*
* Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
*
* Entgra (pvt) Ltd. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.core.service; package org.wso2.carbon.device.mgt.core.service;

@ -106,13 +106,13 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_STATUS (
STATUS VARCHAR(50) DEFAULT NULL, STATUS VARCHAR(50) DEFAULT NULL,
UPDATE_TIME TIMESTAMP DEFAULT NULL, UPDATE_TIME TIMESTAMP DEFAULT NULL,
CHANGED_BY VARCHAR(255) NOT NULL, CHANGED_BY VARCHAR(255) NOT NULL,
PREVIOUS_STATUS VARCHAR(50) DEFAULT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_dm_device_status_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device_status_device FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_dm_device_status_enrolment FOREIGN KEY (ENROLMENT_ID) REFERENCES CONSTRAINT fk_dm_device_status_enrolment FOREIGN KEY (ENROLMENT_ID) REFERENCES
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
); );
ALTER TABLE DM_DEVICE_STATUS ADD PREVIOUS_STATUS VARCHAR(50) DEFAULT NULL;
CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING ( CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml version="1.0" encoding="ISO-8859-1"?>
<!-- <!--
~ Copyright (c) 2022, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. ~ Copyright (c) 2023, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ ~
~ WSO2 Inc. licenses this file to you under the Apache License, ~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except ~ Version 2.0 (the "License"); you may not use this file except

@ -122,7 +122,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_STATUS (
CONSTRAINT fk_dm_device_status_enrolment FOREIGN KEY (ENROLMENT_ID) REFERENCES CONSTRAINT fk_dm_device_status_enrolment FOREIGN KEY (ENROLMENT_ID) REFERENCES
DM_ENROLMENT (ID) ON DELETE CASCADE ON UPDATE CASCADE DM_ENROLMENT (ID) ON DELETE CASCADE ON UPDATE CASCADE
); );
ALTER TABLE DM_DEVICE_STATUS ADD PREVIOUS_STATUS VARCHAR(50) DEFAULT NULL;
CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING ( CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,

@ -129,6 +129,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_STATUS (
STATUS VARCHAR(50) DEFAULT NULL, STATUS VARCHAR(50) DEFAULT NULL,
UPDATE_TIME TIMESTAMP DEFAULT NULL, UPDATE_TIME TIMESTAMP DEFAULT NULL,
CHANGED_BY VARCHAR(255) NOT NULL, CHANGED_BY VARCHAR(255) NOT NULL,
PREVIOUS_STATUS VARCHAR(50) DEFAULT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT FK_DM_DEVICE_STATUS_DEVICE FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT FK_DM_DEVICE_STATUS_DEVICE FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
@ -138,7 +139,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_STATUS (
CREATE INDEX IDX_ENROLMENT_FK_DEVICE_ID ON DM_ENROLMENT(DEVICE_ID); CREATE INDEX IDX_ENROLMENT_FK_DEVICE_ID ON DM_ENROLMENT(DEVICE_ID);
CREATE INDEX IDX_ENROLMENT_DEVICE_ID_TENANT_ID ON DM_ENROLMENT(DEVICE_ID, TENANT_ID); CREATE INDEX IDX_ENROLMENT_DEVICE_ID_TENANT_ID ON DM_ENROLMENT(DEVICE_ID, TENANT_ID);
CREATE INDEX IDX_ENROLMENT_DEVICE_ID_TENANT_ID_STATUS ON DM_ENROLMENT(DEVICE_ID, TENANT_ID, STATUS); CREATE INDEX IDX_ENROLMENT_DEVICE_ID_TENANT_ID_STATUS ON DM_ENROLMENT(DEVICE_ID, TENANT_ID, STATUS);
ALTER TABLE DM_DEVICE_STATUS ADD PREVIOUS_STATUS VARCHAR(50) DEFAULT NULL;
CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING ( CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,

Loading…
Cancel
Save