| 
									
										
										
										
											2025-01-24 09:08:06 +01:00
										 |  |  | UPDATE workflow_definition_entity
 | 
					
						
							| 
									
										
										
										
											2025-01-24 16:56:07 +05:30
										 |  |  | SET json = json - 'type'
 | 
					
						
							| 
									
										
										
										
											2025-03-06 19:49:59 +05:30
										 |  |  | WHERE json->>'type' IS NOT NULL;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-10 05:25:32 -03:00
										 |  |  | -- Add status column to WorkflowInstances and WorkflowInstanceStates
 | 
					
						
							|  |  |  | -- entityLink is generated through variables->global_relatedEntity due to the following reasons:
 | 
					
						
							|  |  |  | -- 1. Flowable shares state through variables that get written into the database and we are persisting those
 | 
					
						
							|  |  |  | -- 2. We are using a namespace system to define from which "Node" the variable should be fetched
 | 
					
						
							|  |  |  | -- 3. We are saving the entityLink that triggers the workflow on the `relatedEntity` variable, within the `global` namespace
 | 
					
						
							|  |  |  | ALTER TABLE workflow_instance_time_series
 | 
					
						
							|  |  |  | ADD COLUMN status VARCHAR(20)
 | 
					
						
							|  |  |  | GENERATED ALWAYS AS (json ->> 'status') STORED;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-24 13:26:05 -03:00
										 |  |  | ALTER TABLE workflow_instance_time_series
 | 
					
						
							|  |  |  | ADD COLUMN exceptionStacktrace TEXT
 | 
					
						
							|  |  |  | GENERATED ALWAYS AS (json ->> 'exception') STORED;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-10 05:25:32 -03:00
										 |  |  | ALTER TABLE workflow_instance_time_series
 | 
					
						
							|  |  |  | ADD COLUMN entityLink VARCHAR(255) GENERATED ALWAYS AS
 | 
					
						
							|  |  |  | ((json -> 'variables' ->> 'global_relatedEntity')) STORED;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ALTER TABLE workflow_instance_state_time_series
 | 
					
						
							|  |  |  | ADD COLUMN status VARCHAR(20)
 | 
					
						
							|  |  |  | GENERATED ALWAYS AS (json ->> 'status') STORED;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-24 13:26:05 -03:00
										 |  |  | ALTER TABLE workflow_instance_state_time_series
 | 
					
						
							|  |  |  | ADD COLUMN exceptionStacktrace TEXT
 | 
					
						
							|  |  |  | GENERATED ALWAYS AS (json ->> 'exception') STORED;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-06 19:49:59 +05:30
										 |  |  | -- Query Cost History Time Series
 | 
					
						
							|  |  |  | CREATE TABLE query_cost_time_series (
 | 
					
						
							|  |  |  |   id varchar(36) GENERATED ALWAYS AS (json ->> 'id') STORED NOT NULL,
 | 
					
						
							| 
									
										
										
										
											2025-03-07 03:00:28 +05:30
										 |  |  |   cost real GENERATED ALWAYS AS ((json ->> 'cost')::real) STORED NOT NULL,
 | 
					
						
							|  |  |  |   count float GENERATED ALWAYS AS ((json ->> 'count')::float) STORED NOT NULL,
 | 
					
						
							| 
									
										
										
										
											2025-03-06 19:49:59 +05:30
										 |  |  |   timestamp bigint GENERATED ALWAYS AS ((json ->> 'timestamp')::bigint) STORED NOT NULL,
 | 
					
						
							|  |  |  |   jsonSchema varchar(256) NOT NULL,
 | 
					
						
							|  |  |  |   json jsonb NOT NULL,
 | 
					
						
							|  |  |  |   entityFQNHash varchar(768) COLLATE "C" DEFAULT NULL,
 | 
					
						
							| 
									
										
										
										
											2025-03-07 03:00:28 +05:30
										 |  |  |   CONSTRAINT query_cost_unique_constraint UNIQUE (timestamp, entityFQNHash)
 | 
					
						
							| 
									
										
										
										
											2025-03-06 19:49:59 +05:30
										 |  |  | );
 | 
					
						
							|  |  |  | CREATE INDEX IF NOT EXISTS query_cost_time_series_id on query_cost_time_series (id);
 | 
					
						
							| 
									
										
										
										
											2025-03-10 05:25:32 -03:00
										 |  |  | CREATE INDEX IF NOT EXISTS query_cost_time_series_id_timestamp  on test_case_resolution_status_time_series  (id, timestamp);
 | 
					
						
							| 
									
										
										
										
											2025-03-20 14:28:23 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |  UPDATE workflow_definition_entity
 | 
					
						
							|  |  |  |  SET json = jsonb_set(json, '{trigger,type}', '"eventBasedEntity"')
 | 
					
						
							|  |  |  |  WHERE json->'trigger'->>'type' in ('eventBasedEntityTrigger', 'eventBasedEntityWorkflow');
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |  UPDATE workflow_definition_entity
 | 
					
						
							|  |  |  |  SET json = jsonb_set(json, '{trigger,type}', '"periodicBatchEntity"')
 | 
					
						
							| 
									
										
										
										
											2025-04-16 14:54:11 +05:30
										 |  |  |  WHERE json->'trigger'->>'type' in ('periodicBatchEntityTrigger', 'periodicBatchEntityWorkflow');
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | DELETE FROM apps_extension_time_series;
 |