From 365b073e6a5128af8c51e0513ab0af34d1f60774 Mon Sep 17 00:00:00 2001 From: Pahansith Date: Mon, 19 Apr 2021 08:55:21 +0530 Subject: [PATCH] Fix app schedule installation issue in single node --- .../mgt/common/DeviceSubscriptionData.java | 6 +++--- .../common/dto/ScheduledSubscriptionDTO.java | 8 ++++---- .../mgt/core/dao/SubscriptionDAO.java | 2 +- .../GenericSubscriptionDAOImpl.java | 6 +++--- .../core/impl/SubscriptionManagerImpl.java | 4 ++-- .../ScheduledAppSubscriptionCleanupTask.java | 2 +- .../task/ScheduledAppSubscriptionTask.java | 2 +- .../ScheduledAppSubscriptionTaskManager.java | 19 +++++++++++------- .../application/mgt/core/util/DAOUtil.java | 2 +- .../services/SubscriptionManagementAPI.java | 8 ++++---- .../impl/SubscriptionManagementAPIImpl.java | 20 +++++++++---------- .../impl/RandomlyAssignedScheduleTask.java | 2 ++ .../dbscripts/cdm/application-mgt/h2.sql | 2 +- .../dbscripts/cdm/application-mgt/mssql.sql | 2 +- .../dbscripts/cdm/application-mgt/mysql.sql | 2 +- .../dbscripts/cdm/application-mgt/oracle.sql | 2 +- .../cdm/application-mgt/postgresql.sql | 2 +- 17 files changed, 49 insertions(+), 42 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/DeviceSubscriptionData.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/DeviceSubscriptionData.java index 3afac36acd..550c1c98fc 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/DeviceSubscriptionData.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/DeviceSubscriptionData.java @@ -24,7 +24,7 @@ import java.sql.Timestamp; public class DeviceSubscriptionData { private String action; - private Timestamp actionTriggeredTimestamp; + private long actionTriggeredTimestamp; private String actionTriggeredBy; private String actionType; private String status; @@ -38,11 +38,11 @@ public class DeviceSubscriptionData { this.action = action; } - public Timestamp getActionTriggeredTimestamp() { + public long getActionTriggeredTimestamp() { return actionTriggeredTimestamp; } - public void setActionTriggeredTimestamp(Timestamp actionTriggeredTimestamp) { + public void setActionTriggeredTimestamp(long actionTriggeredTimestamp) { this.actionTriggeredTimestamp = actionTriggeredTimestamp; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/dto/ScheduledSubscriptionDTO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/dto/ScheduledSubscriptionDTO.java index 65801e9415..da3e1e01e0 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/dto/ScheduledSubscriptionDTO.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/dto/ScheduledSubscriptionDTO.java @@ -69,7 +69,7 @@ public class ScheduledSubscriptionDTO { /** * Scheduled time of subscription. */ - private LocalDateTime scheduledAt; + private long scheduledAt; /** * Username of the scheduler. @@ -86,7 +86,7 @@ public class ScheduledSubscriptionDTO { } - public ScheduledSubscriptionDTO(String taskName, String applicationUUID, LocalDateTime scheduledAt, + public ScheduledSubscriptionDTO(String taskName, String applicationUUID, long scheduledAt, List subscriberList, String scheduledBy) { this.taskName = taskName; this.applicationUUID = applicationUUID; @@ -135,11 +135,11 @@ public class ScheduledSubscriptionDTO { this.status = status; } - public LocalDateTime getScheduledAt() { + public long getScheduledAt() { return scheduledAt; } - public void setScheduledAt(LocalDateTime scheduledAt) { + public void setScheduledAt(long scheduledAt) { this.scheduledAt = scheduledAt; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionDAO.java index 4b99420e50..99b7395b1f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionDAO.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/SubscriptionDAO.java @@ -124,7 +124,7 @@ public interface SubscriptionDAO { * @param scheduledBy username of the user who scheduled the subscription * @throws ApplicationManagementDAOException if error occurred while updating the entry */ - boolean updateScheduledSubscription(int id, LocalDateTime scheduledAt, String scheduledBy) + boolean updateScheduledSubscription(int id, long scheduledAt, String scheduledBy) throws ApplicationManagementDAOException; /** diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java index c2f559e96b..7018ca662f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java @@ -765,7 +765,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc stmt.setString(2, subscriptionDTO.getApplicationUUID()); stmt.setString(3, subscriptionDTO.getSubscribersString()); stmt.setString(4, ExecutionStatus.PENDING.toString()); - stmt.setTimestamp(5, Timestamp.valueOf(subscriptionDTO.getScheduledAt())); + stmt.setLong(5, subscriptionDTO.getScheduledAt()); stmt.setTimestamp(6, new Timestamp(calendar.getTime().getTime())); stmt.setString(7, subscriptionDTO.getScheduledBy()); stmt.setBoolean(8, false); @@ -785,7 +785,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc } @Override - public boolean updateScheduledSubscription(int id, LocalDateTime scheduledAt, String scheduledBy) + public boolean updateScheduledSubscription(int id, long scheduledAt, String scheduledBy) throws ApplicationManagementDAOException { String sql = "UPDATE AP_SCHEDULED_SUBSCRIPTION " + "SET " @@ -797,7 +797,7 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { Calendar calendar = Calendar.getInstance(); - stmt.setTimestamp(1, Timestamp.valueOf(scheduledAt)); + stmt.setLong(1, scheduledAt); stmt.setString(2, scheduledBy); stmt.setTimestamp(3, new Timestamp(calendar.getTime().getTime())); stmt.setInt(4, id); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java index 19008cbb0d..dcd641f102 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -1392,12 +1392,12 @@ public class SubscriptionManagerImpl implements SubscriptionManager { deviceSubscriptionData.setAction(Constants.UNSUBSCRIBED); deviceSubscriptionData.setActionTriggeredBy(subscription.getUnsubscribedBy()); deviceSubscriptionData - .setActionTriggeredTimestamp(subscription.getUnsubscribedTimestamp()); + .setActionTriggeredTimestamp(subscription.getUnsubscribedTimestamp().getTime() / 1000); } else { deviceSubscriptionData.setAction(Constants.SUBSCRIBED); deviceSubscriptionData.setActionTriggeredBy(subscription.getSubscribedBy()); deviceSubscriptionData - .setActionTriggeredTimestamp(subscription.getSubscribedTimestamp()); + .setActionTriggeredTimestamp(subscription.getSubscribedTimestamp().getTime() / 1000); } deviceSubscriptionData.setActionType(subscription.getActionTriggeredFrom()); deviceSubscriptionData.setStatus(subscription.getStatus()); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/task/ScheduledAppSubscriptionCleanupTask.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/task/ScheduledAppSubscriptionCleanupTask.java index 113b16cf3f..351a4477b2 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/task/ScheduledAppSubscriptionCleanupTask.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/task/ScheduledAppSubscriptionCleanupTask.java @@ -40,7 +40,7 @@ public class ScheduledAppSubscriptionCleanupTask extends RandomlyAssignedSchedul @Override public void executeRandomlyAssignedTask() { try { - if(super.isQualifiedToExecuteTask()) { + if(isQualifiedToExecuteTask()) { subscriptionManager.cleanScheduledSubscriptions(); } } catch (SubscriptionManagementException e) { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/task/ScheduledAppSubscriptionTask.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/task/ScheduledAppSubscriptionTask.java index caff4ec460..8a95efc0aa 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/task/ScheduledAppSubscriptionTask.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/task/ScheduledAppSubscriptionTask.java @@ -68,7 +68,7 @@ public class ScheduledAppSubscriptionTask extends RandomlyAssignedScheduleTask { @Override public void executeRandomlyAssignedTask() { - if(super.isQualifiedToExecuteTask()) { + if(isQualifiedToExecuteTask()) { try { ScheduledSubscriptionDTO subscriptionDTO = subscriptionManager.getPendingScheduledSubscription( this.taskName); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/task/ScheduledAppSubscriptionTaskManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/task/ScheduledAppSubscriptionTaskManager.java index c07053f3d5..326a358e1b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/task/ScheduledAppSubscriptionTaskManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/task/ScheduledAppSubscriptionTaskManager.java @@ -40,6 +40,8 @@ import org.wso2.carbon.ntask.core.service.TaskService; import java.time.LocalDateTime; import java.time.format.TextStyle; +import java.util.Calendar; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -64,24 +66,27 @@ public class ScheduledAppSubscriptionTaskManager { * either {@link org.wso2.carbon.device.mgt.common.DeviceIdentifier} if {@param subType} is * equal to DEVICE or {@link String} if {@param subType} is USER, ROLE or GROUP * @param subscriptionType subscription type. E.g. DEVICE, USER, ROLE, GROUP - * {@see {@link org.wso2.carbon.device.application.mgt.common.SubscriptionType}} + * {@see {@link SubscriptionType}} * @param action action subscription action. E.g. {@code INSTALL/UNINSTALL} - * {@see {@link org.wso2.carbon.device.application.mgt.common.SubAction}} + * {@see {@link SubAction}} * @param timestamp timestamp to schedule the application subscription * @throws ApplicationOperationTaskException if error occurred while scheduling the subscription */ public void scheduleAppSubscriptionTask(String applicationUUID, List subscribers, - SubscriptionType subscriptionType, SubAction action, LocalDateTime timestamp) + SubscriptionType subscriptionType, SubAction action, long timestamp) throws ApplicationOperationTaskException { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(new Date(timestamp * 1000)); String space = " "; String cronExpression = - String.valueOf(timestamp.getSecond()) + space + timestamp.getMinute() + space + timestamp.getHour() - + space + timestamp.getDayOfMonth() + space + timestamp.getMonth().getDisplayName(TextStyle.SHORT, - Locale.getDefault()).toUpperCase() + " ? " + timestamp.getYear(); + calendar.get(Calendar.SECOND) + space + calendar.get(Calendar.MINUTE) + space + + calendar.get(Calendar.HOUR_OF_DAY) + space + calendar.get(Calendar.DAY_OF_MONTH) + space + + calendar.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.getDefault()).toUpperCase() + " ? " + + calendar.get(Calendar.YEAR); if (!CronExpression.isValidExpression(cronExpression)) { String msg = "The cron expression [" + cronExpression + "] generated by the" + " timestamp [" + timestamp - .toString() + "] is invalid"; + + "] is invalid"; log.error(msg); throw new ApplicationOperationTaskException(msg); } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/DAOUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/DAOUtil.java index c56df53109..56be92ac9b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/DAOUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/DAOUtil.java @@ -274,7 +274,7 @@ public class DAOUtil { } subscription.setStatus(ExecutionStatus.valueOf(rs.getString("STATUS"))); - subscription.setScheduledAt(rs.getTimestamp("SCHEDULED_AT").toLocalDateTime()); + subscription.setScheduledAt(rs.getTimestamp("SCHEDULED_AT").getTime()); subscription.setScheduledBy(rs.getString("SCHEDULED_BY")); subscription.setDeleted(rs.getBoolean("DELETED")); subscriptionDTOS.add(subscription); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/SubscriptionManagementAPI.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/SubscriptionManagementAPI.java index 75a4522d68..85485f1a08 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/SubscriptionManagementAPI.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/SubscriptionManagementAPI.java @@ -129,7 +129,7 @@ public interface SubscriptionManagementAPI { name = "timestamp", value = "Timestamp of scheduled install/uninstall operation" ) - @QueryParam("timestamp") String timestamp + @QueryParam("timestamp") long timestamp ); @POST @@ -182,7 +182,7 @@ public interface SubscriptionManagementAPI { name = "timestamp", value = "Timestamp of scheduled install/uninstall operation" ) - @QueryParam("timestamp") String timestamp + @QueryParam("timestamp") long timestamp ); @POST @@ -229,7 +229,7 @@ public interface SubscriptionManagementAPI { name = "timestamp", value = "Timestamp of scheduled ent. install operation" ) - @QueryParam("timestamp") String timestamp, + @QueryParam("timestamp") long timestamp, @ApiParam( name = "requiresUpdatingExternal", value = "Should external system such as Google EMM APIs need to be updated." @@ -287,7 +287,7 @@ public interface SubscriptionManagementAPI { name = "timestamp", value = "Timestamp of scheduled ent app install operation" ) - @QueryParam("timestamp") String timestamp, + @QueryParam("timestamp") long timestamp, @ApiParam( name = "requiresUpdatingExternal", value = "Should external system such as Google EMM APIs need to be updated." diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java index 984f689d07..4e71aa760c 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java @@ -73,9 +73,9 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{ @PathParam("uuid") String uuid, @PathParam("action") String action, @Valid List deviceIdentifiers, - @QueryParam("timestamp") String timestamp) { + @QueryParam("timestamp") long timestamp) { try { - if (StringUtils.isEmpty(timestamp)) { + if (0 == timestamp) { SubscriptionManager subscriptionManager = APIUtil.getSubscriptionManager(); ApplicationInstallResponse response = subscriptionManager .performBulkAppOperation(uuid, deviceIdentifiers, SubscriptionType.DEVICE.toString(), action); @@ -114,9 +114,9 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{ @PathParam("subType") String subType, @PathParam("action") String action, @Valid List subscribers, - @QueryParam("timestamp") String timestamp) { + @QueryParam("timestamp") long timestamp) { try { - if (StringUtils.isEmpty(timestamp)) { + if (0 == timestamp) { SubscriptionManager subscriptionManager = APIUtil.getSubscriptionManager(); ApplicationInstallResponse response = subscriptionManager .performBulkAppOperation(uuid, subscribers, subType, action); @@ -155,10 +155,10 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{ @PathParam("uuid") String uuid, @PathParam("action") String action, @Valid List deviceIdentifiers, - @QueryParam("timestamp") String timestamp, + @QueryParam("timestamp") long timestamp, @QueryParam("requiresUpdatingExternal") boolean requiresUpdatingExternal) { try { - if (StringUtils.isEmpty(timestamp)) { + if (0 == timestamp) { SubscriptionManager subscriptionManager = APIUtil.getSubscriptionManager(); subscriptionManager .performEntAppSubscription(uuid, deviceIdentifiers, SubscriptionType.DEVICE.toString(), @@ -202,10 +202,10 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{ @PathParam("subType") String subType, @PathParam("action") String action, @Valid List subscribers, - @QueryParam("timestamp") String timestamp, + @QueryParam("timestamp") long timestamp, @QueryParam("requiresUpdatingExternal") boolean requiresUpdatingExternal) { try { - if (StringUtils.isEmpty(timestamp)) { + if (0 == timestamp) { SubscriptionManager subscriptionManager = APIUtil.getSubscriptionManager(); subscriptionManager.performEntAppSubscription(uuid, subscribers, subType, action, requiresUpdatingExternal); String msg = "Application release which has UUID " + uuid + " is installed to subscriber's valid device" @@ -253,11 +253,11 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{ * @return {@link Response} of the operation */ private Response scheduleApplicationOperationTask(String applicationUUID, List subscribers, - SubscriptionType subType, SubAction subAction, String timestamp) { + SubscriptionType subType, SubAction subAction, long timestamp) { try { ScheduledAppSubscriptionTaskManager subscriptionTaskManager = new ScheduledAppSubscriptionTaskManager(); subscriptionTaskManager.scheduleAppSubscriptionTask(applicationUUID, subscribers, subType, subAction, - LocalDateTime.parse(timestamp, DateTimeFormatter.ISO_LOCAL_DATE_TIME)); + timestamp); } catch (ApplicationOperationTaskException e) { String msg = "Error occurred while scheduling the application install operation"; log.error(msg, e); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/RandomlyAssignedScheduleTask.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/RandomlyAssignedScheduleTask.java index 56a1c498a0..fb8a5b9235 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/RandomlyAssignedScheduleTask.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/RandomlyAssignedScheduleTask.java @@ -61,6 +61,8 @@ public abstract class RandomlyAssignedScheduleTask implements Task { log.error("Error refreshing Variables necessary for Randomly Assigned Scheduled Task. " + "Dynamic Tasks will not function.", e); } + } else { + qualifiedToExecuteTask = true; } } diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql index f16927301b..dcbebd74b4 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql @@ -269,7 +269,7 @@ CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION( APPLICATION_UUID VARCHAR(36) NOT NULL, SUBSCRIBER_LIST LONGVARCHAR NOT NULL, STATUS VARCHAR(15) NOT NULL, - SCHEDULED_AT TIMESTAMP NOT NULL, + SCHEDULED_AT BIGINT NOT NULL, SCHEDULED_BY VARCHAR(100) NOT NULL, SCHEDULED_TIMESTAMP TIMESTAMP NOT NULL, DELETED BOOLEAN, diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql index 78e05c1371..25fc47e38e 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql @@ -270,7 +270,7 @@ CREATE TABLE AP_SCHEDULED_SUBSCRIPTION( APPLICATION_UUID VARCHAR(200) NOT NULL, SUBSCRIBER_LIST VARCHAR(MAX) NOT NULL, STATUS VARCHAR(15) NOT NULL, - SCHEDULED_AT DATETIME2(0) NOT NULL, + SCHEDULED_AT BIGINT NOT NULL, SCHEDULED_BY VARCHAR(100) NOT NULL, SCHEDULED_TIMESTAMP DATETIME2(0) NOT NULL, DELETED BIT, diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql index 1daa796858..5d5db38b2d 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql @@ -269,7 +269,7 @@ CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION( APPLICATION_UUID VARCHAR(36) NOT NULL, SUBSCRIBER_LIST TEXT NOT NULL, STATUS VARCHAR(15) NOT NULL, - SCHEDULED_AT TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, + SCHEDULED_AT BIGINT NOT NULL, SCHEDULED_BY VARCHAR(100) NOT NULL, SCHEDULED_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, DELETED BOOLEAN, diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql index c4f2c99f06..edbc277ab2 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/oracle.sql @@ -372,7 +372,7 @@ CREATE TABLE AP_SCHEDULED_SUBSCRIPTION ( APPLICATION_UUID VARCHAR(36) NOT NULL, SUBSCRIBER_LIST VARCHAR(4000) NOT NULL, STATUS VARCHAR(15) NOT NULL, - SCHEDULED_AT TIMESTAMP NOT NULL, + SCHEDULED_AT NUMBER(19) NOT NULL, SCHEDULED_BY VARCHAR(100) NOT NULL, SCHEDULED_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, DELETED NUMBER(1) NOT_NULL DEFAULT 0, diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql index 5c20aa4a75..d871549d89 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql @@ -299,7 +299,7 @@ CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION( APPLICATION_UUID VARCHAR(36) NOT NULL, SUBSCRIBER_LIST TEXT NOT NULL, STATUS VARCHAR(15) NOT NULL, - SCHEDULED_AT TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP NOT NULL, + SCHEDULED_AT BIGINT NOT NULL, SCHEDULED_BY VARCHAR(100) NOT NULL, SCHEDULED_TIMESTAMP TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP NOT NULL, DELETED BOOLEAN,