How to overcome if the Migration Failure Due to NULL Value in 'ScheduledTime' Column During UiPath Upgrade"
Issue Description
During an upgrade of UiPath Orchestrator, the following error was identified in the logs:
Migration failed: Cannot insert the value NULL into column 'ScheduledTime', table 'UiPath.dbo.RobotJobsBackgroundTasks'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Microsoft.Data.SqlClient.SqlException (0x80131904): Cannot insert the value NULL into column 'ScheduledTime', table 'UiPath.dbo.RobotJobsBackgroundTasks'; column does not allow nulls. INSERT fails.
Root Cause
The issue was traced to the Quartz table, which is used as part of the UiPath build schedule library process. During the migration, data from the Quartz table was being inserted into the UiPath.dbo.RobotJobsBackgroundTasks table. However, a row in the Quartz table was missing a value for the Next Fire column, resulting in the ScheduledTime column being populated with a NULL value, which is not allowed.
Resolution
Step 1: Identify Invalid Data
Run the following query to identify rows in the ProcessSchedules table linked to Quartz triggers that have a NULL Next Fire value:
SELECT *FROM [UiPath].[dbo].[ProcessSchedules]
WHERE ExternalJobKey
IN (
SELECT JOB_NAME
FROM [UiPath].[quartz].[QRTZ_TRIGGERS]
WHERE NEXT_FIRE_TIME IS NULL
)
Step 2: Delete and Recreate the Affected Triggers
Based on the query results:
- Identify the problematic trigger(s) by reviewing the returned data.
- Delete the invalid triggers using appropriate commands or through the UiPath Orchestrator interface.
- Recreate the triggers with valid configurations and ensure the Next Fire value is populated correctly.
Step 3: Retry the Upgrade
- Restart the UiPath Orchestrator upgrade process.
- Verify that the migration completes successfully and that the RobotJobsBackgroundTasks table is updated without NULL values.