tasker-engine 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (605) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +22 -0
  3. data/README.md +443 -0
  4. data/Rakefile +10 -0
  5. data/app/controllers/tasker/analytics_controller.rb +179 -0
  6. data/app/controllers/tasker/application_controller.rb +45 -0
  7. data/app/controllers/tasker/graphql_controller.rb +193 -0
  8. data/app/controllers/tasker/handlers_controller.rb +217 -0
  9. data/app/controllers/tasker/health_controller.rb +229 -0
  10. data/app/controllers/tasker/metrics_controller.rb +111 -0
  11. data/app/controllers/tasker/page_sort.rb +97 -0
  12. data/app/controllers/tasker/task_diagrams_controller.rb +30 -0
  13. data/app/controllers/tasker/tasks_controller.rb +123 -0
  14. data/app/controllers/tasker/workflow_steps_controller.rb +69 -0
  15. data/app/graphql/examples/all_tasks.graphql +22 -0
  16. data/app/graphql/examples/pending_tasks.graphql +23 -0
  17. data/app/graphql/tasker/graph_ql_types/annotation_type.rb +14 -0
  18. data/app/graphql/tasker/graph_ql_types/base_argument.rb +9 -0
  19. data/app/graphql/tasker/graph_ql_types/base_connection.rb +11 -0
  20. data/app/graphql/tasker/graph_ql_types/base_edge.rb +10 -0
  21. data/app/graphql/tasker/graph_ql_types/base_enum.rb +9 -0
  22. data/app/graphql/tasker/graph_ql_types/base_field.rb +10 -0
  23. data/app/graphql/tasker/graph_ql_types/base_input_object.rb +10 -0
  24. data/app/graphql/tasker/graph_ql_types/base_interface.rb +14 -0
  25. data/app/graphql/tasker/graph_ql_types/base_object.rb +10 -0
  26. data/app/graphql/tasker/graph_ql_types/base_scalar.rb +9 -0
  27. data/app/graphql/tasker/graph_ql_types/base_union.rb +11 -0
  28. data/app/graphql/tasker/graph_ql_types/dependent_system_object_map_type.rb +18 -0
  29. data/app/graphql/tasker/graph_ql_types/dependent_system_type.rb +13 -0
  30. data/app/graphql/tasker/graph_ql_types/mutation_type.rb +16 -0
  31. data/app/graphql/tasker/graph_ql_types/named_step_type.rb +16 -0
  32. data/app/graphql/tasker/graph_ql_types/named_task_type.rb +14 -0
  33. data/app/graphql/tasker/graph_ql_types/named_tasks_named_step_type.rb +19 -0
  34. data/app/graphql/tasker/graph_ql_types/node_type.rb +12 -0
  35. data/app/graphql/tasker/graph_ql_types/query_type.rb +20 -0
  36. data/app/graphql/tasker/graph_ql_types/task_annotation_type.rb +17 -0
  37. data/app/graphql/tasker/graph_ql_types/task_interface.rb +17 -0
  38. data/app/graphql/tasker/graph_ql_types/task_type.rb +26 -0
  39. data/app/graphql/tasker/graph_ql_types/workflow_step_type.rb +154 -0
  40. data/app/graphql/tasker/graph_ql_types.rb +42 -0
  41. data/app/graphql/tasker/mutations/base_mutation.rb +13 -0
  42. data/app/graphql/tasker/mutations/cancel_step.rb +29 -0
  43. data/app/graphql/tasker/mutations/cancel_task.rb +29 -0
  44. data/app/graphql/tasker/mutations/create_task.rb +52 -0
  45. data/app/graphql/tasker/mutations/update_step.rb +36 -0
  46. data/app/graphql/tasker/mutations/update_task.rb +41 -0
  47. data/app/graphql/tasker/queries/all_annotation_types.rb +17 -0
  48. data/app/graphql/tasker/queries/all_tasks.rb +23 -0
  49. data/app/graphql/tasker/queries/base_query.rb +9 -0
  50. data/app/graphql/tasker/queries/helpers.rb +16 -0
  51. data/app/graphql/tasker/queries/one_step.rb +24 -0
  52. data/app/graphql/tasker/queries/one_task.rb +18 -0
  53. data/app/graphql/tasker/queries/tasks_by_annotation.rb +31 -0
  54. data/app/graphql/tasker/queries/tasks_by_status.rb +30 -0
  55. data/app/graphql/tasker/tasker_rails_schema.rb +52 -0
  56. data/app/jobs/tasker/application_job.rb +8 -0
  57. data/app/jobs/tasker/metrics_export_job.rb +252 -0
  58. data/app/jobs/tasker/task_runner_job.rb +224 -0
  59. data/app/models/tasker/annotation_type.rb +26 -0
  60. data/app/models/tasker/application_record.rb +70 -0
  61. data/app/models/tasker/dependent_system.rb +26 -0
  62. data/app/models/tasker/dependent_system_object_map.rb +64 -0
  63. data/app/models/tasker/diagram/edge.rb +106 -0
  64. data/app/models/tasker/diagram/flowchart.rb +137 -0
  65. data/app/models/tasker/diagram/node.rb +99 -0
  66. data/app/models/tasker/named_step.rb +41 -0
  67. data/app/models/tasker/named_task.rb +121 -0
  68. data/app/models/tasker/named_tasks_named_step.rb +82 -0
  69. data/app/models/tasker/step_dag_relationship.rb +65 -0
  70. data/app/models/tasker/step_readiness_status.rb +59 -0
  71. data/app/models/tasker/task.rb +424 -0
  72. data/app/models/tasker/task_annotation.rb +36 -0
  73. data/app/models/tasker/task_diagram.rb +332 -0
  74. data/app/models/tasker/task_execution_context.rb +29 -0
  75. data/app/models/tasker/task_namespace.rb +41 -0
  76. data/app/models/tasker/task_transition.rb +235 -0
  77. data/app/models/tasker/workflow_step.rb +461 -0
  78. data/app/models/tasker/workflow_step_edge.rb +94 -0
  79. data/app/models/tasker/workflow_step_transition.rb +434 -0
  80. data/app/serializers/tasker/annotation_type_serializer.rb +8 -0
  81. data/app/serializers/tasker/handler_serializer.rb +109 -0
  82. data/app/serializers/tasker/task_annotation_serializer.rb +32 -0
  83. data/app/serializers/tasker/task_serializer.rb +168 -0
  84. data/app/serializers/tasker/workflow_step_serializer.rb +27 -0
  85. data/app/services/tasker/analytics_service.rb +409 -0
  86. data/app/views/tasker/task/_diagram.html.erb +32 -0
  87. data/config/initializers/dry_struct.rb +11 -0
  88. data/config/initializers/statesman.rb +6 -0
  89. data/config/initializers/tasker_orchestration.rb +17 -0
  90. data/config/initializers/time_formats.rb +4 -0
  91. data/config/routes.rb +34 -0
  92. data/config/tasker/subscriptions/example_integrations.yml +67 -0
  93. data/config/tasker/system_events.yml +305 -0
  94. data/db/functions/calculate_dependency_levels_v01.sql +45 -0
  95. data/db/functions/get_analytics_metrics_v01.sql +137 -0
  96. data/db/functions/get_slowest_steps_v01.sql +82 -0
  97. data/db/functions/get_slowest_tasks_v01.sql +96 -0
  98. data/db/functions/get_step_readiness_status_batch_v01.sql +140 -0
  99. data/db/functions/get_step_readiness_status_v01.sql +139 -0
  100. data/db/functions/get_system_health_counts_v01.sql +108 -0
  101. data/db/functions/get_task_execution_context_v01.sql +108 -0
  102. data/db/functions/get_task_execution_contexts_batch_v01.sql +104 -0
  103. data/db/init/schema.sql +2277 -0
  104. data/db/migrate/20250701165431_initial_tasker_schema.rb +116 -0
  105. data/db/views/tasker_step_dag_relationships_v01.sql +69 -0
  106. data/docs/APPLICATION_GENERATOR.md +384 -0
  107. data/docs/AUTH.md +1780 -0
  108. data/docs/CIRCUIT_BREAKER.md +224 -0
  109. data/docs/DEVELOPER_GUIDE.md +2665 -0
  110. data/docs/EVENT_SYSTEM.md +637 -0
  111. data/docs/EXECUTION_CONFIGURATION.md +341 -0
  112. data/docs/FLOW_CHART.md +149 -0
  113. data/docs/HEALTH.md +542 -0
  114. data/docs/METRICS.md +731 -0
  115. data/docs/OPTIMIZATION_PLAN.md +1479 -0
  116. data/docs/OVERVIEW.md +552 -0
  117. data/docs/QUICK_START.md +270 -0
  118. data/docs/REGISTRY_SYSTEMS.md +373 -0
  119. data/docs/REST_API.md +632 -0
  120. data/docs/ROADMAP.md +221 -0
  121. data/docs/SQL_FUNCTIONS.md +1408 -0
  122. data/docs/TASK_DIAGRAM.md +252 -0
  123. data/docs/TASK_EXECUTION_CONTROL_FLOW.md +237 -0
  124. data/docs/TELEMETRY.md +795 -0
  125. data/docs/TROUBLESHOOTING.md +756 -0
  126. data/docs/TaskHandlerGenerator.html +255 -0
  127. data/docs/Tasker/Analysis/RuntimeGraphAnalyzer.html +907 -0
  128. data/docs/Tasker/Analysis/TemplateGraphAnalyzer.html +1236 -0
  129. data/docs/Tasker/Analysis.html +117 -0
  130. data/docs/Tasker/AnalyticsController.html +450 -0
  131. data/docs/Tasker/AnalyticsService/BottleneckAnalytics.html +816 -0
  132. data/docs/Tasker/AnalyticsService/PerformanceAnalytics.html +586 -0
  133. data/docs/Tasker/AnalyticsService.html +2221 -0
  134. data/docs/Tasker/AnnotationType.html +137 -0
  135. data/docs/Tasker/AnnotationTypeSerializer.html +124 -0
  136. data/docs/Tasker/ApplicationController.html +147 -0
  137. data/docs/Tasker/ApplicationJob.html +128 -0
  138. data/docs/Tasker/ApplicationRecord.html +378 -0
  139. data/docs/Tasker/Authentication/AuthenticationError.html +124 -0
  140. data/docs/Tasker/Authentication/ConfigurationError.html +124 -0
  141. data/docs/Tasker/Authentication/Coordinator.html +242 -0
  142. data/docs/Tasker/Authentication/Interface.html +560 -0
  143. data/docs/Tasker/Authentication/InterfaceError.html +124 -0
  144. data/docs/Tasker/Authentication/NoneAuthenticator.html +338 -0
  145. data/docs/Tasker/Authentication.html +119 -0
  146. data/docs/Tasker/Authorization/AuthorizationError.html +139 -0
  147. data/docs/Tasker/Authorization/BaseCoordinator.html +927 -0
  148. data/docs/Tasker/Authorization/ConfigurationError.html +153 -0
  149. data/docs/Tasker/Authorization/ResourceConstants/ACTIONS.html +428 -0
  150. data/docs/Tasker/Authorization/ResourceConstants/RESOURCES.html +365 -0
  151. data/docs/Tasker/Authorization/ResourceConstants.html +146 -0
  152. data/docs/Tasker/Authorization/ResourceRegistry.html +882 -0
  153. data/docs/Tasker/Authorization/UnauthorizedError.html +153 -0
  154. data/docs/Tasker/Authorization.html +582 -0
  155. data/docs/Tasker/CacheCapabilities.html +167 -0
  156. data/docs/Tasker/CacheStrategy.html +1297 -0
  157. data/docs/Tasker/Concerns/Authenticatable.html +116 -0
  158. data/docs/Tasker/Concerns/Authorizable/AdminStatusChecker.html +256 -0
  159. data/docs/Tasker/Concerns/Authorizable.html +816 -0
  160. data/docs/Tasker/Concerns/ControllerAuthorizable.html +157 -0
  161. data/docs/Tasker/Concerns/EventPublisher.html +4023 -0
  162. data/docs/Tasker/Concerns/IdempotentStateTransitions.html +806 -0
  163. data/docs/Tasker/Concerns/LifecycleEventHelpers.html +129 -0
  164. data/docs/Tasker/Concerns/OrchestrationPublisher.html +129 -0
  165. data/docs/Tasker/Concerns/StateMachineBase/ClassMethods.html +1075 -0
  166. data/docs/Tasker/Concerns/StateMachineBase/StateMachineBase/ClassMethods.html +191 -0
  167. data/docs/Tasker/Concerns/StateMachineBase/StateMachineBase.html +126 -0
  168. data/docs/Tasker/Concerns/StateMachineBase.html +153 -0
  169. data/docs/Tasker/Concerns/StructuredLogging.html +1413 -0
  170. data/docs/Tasker/Concerns.html +117 -0
  171. data/docs/Tasker/Configuration/AuthConfiguration.html +1023 -0
  172. data/docs/Tasker/Configuration/ConfigurationProxy.html +581 -0
  173. data/docs/Tasker/Configuration/DatabaseConfiguration.html +475 -0
  174. data/docs/Tasker/Configuration/EngineConfiguration.html +1265 -0
  175. data/docs/Tasker/Configuration/HealthConfiguration.html +791 -0
  176. data/docs/Tasker/Configuration/TelemetryConfiguration.html +1308 -0
  177. data/docs/Tasker/Configuration/TelemetryConfigurationProxy.html +388 -0
  178. data/docs/Tasker/Configuration.html +1669 -0
  179. data/docs/Tasker/ConfigurationError.html +143 -0
  180. data/docs/Tasker/ConfiguredTask.html +514 -0
  181. data/docs/Tasker/Constants/EventDefinitions.html +590 -0
  182. data/docs/Tasker/Constants/LifecycleEvents.html +137 -0
  183. data/docs/Tasker/Constants/ObservabilityEvents/Step.html +152 -0
  184. data/docs/Tasker/Constants/ObservabilityEvents/Task.html +142 -0
  185. data/docs/Tasker/Constants/ObservabilityEvents.html +126 -0
  186. data/docs/Tasker/Constants/RegistryEvents.html +285 -0
  187. data/docs/Tasker/Constants/StepEvents.html +177 -0
  188. data/docs/Tasker/Constants/TaskEvents.html +167 -0
  189. data/docs/Tasker/Constants/TaskExecution/ExecutionStatus.html +207 -0
  190. data/docs/Tasker/Constants/TaskExecution/HealthStatus.html +191 -0
  191. data/docs/Tasker/Constants/TaskExecution/RecommendedAction.html +207 -0
  192. data/docs/Tasker/Constants/TaskExecution.html +126 -0
  193. data/docs/Tasker/Constants/TaskFinalization/ErrorMessages.html +132 -0
  194. data/docs/Tasker/Constants/TaskFinalization/PendingReasons.html +207 -0
  195. data/docs/Tasker/Constants/TaskFinalization/ReenqueueReasons.html +239 -0
  196. data/docs/Tasker/Constants/TaskFinalization.html +126 -0
  197. data/docs/Tasker/Constants/TaskStatuses.html +223 -0
  198. data/docs/Tasker/Constants/TestEvents.html +163 -0
  199. data/docs/Tasker/Constants/WorkflowEvents.html +222 -0
  200. data/docs/Tasker/Constants/WorkflowStepStatuses.html +223 -0
  201. data/docs/Tasker/Constants.html +561 -0
  202. data/docs/Tasker/DependentSystem.html +137 -0
  203. data/docs/Tasker/DependentSystemObjectMap.html +250 -0
  204. data/docs/Tasker/DetectorRegistry.html +598 -0
  205. data/docs/Tasker/Diagram/Edge.html +1191 -0
  206. data/docs/Tasker/Diagram/Flowchart.html +1539 -0
  207. data/docs/Tasker/Diagram/Node.html +1165 -0
  208. data/docs/Tasker/Diagram.html +117 -0
  209. data/docs/Tasker/Engine.html +215 -0
  210. data/docs/Tasker/Error.html +139 -0
  211. data/docs/Tasker/Events/Bus.html +1226 -0
  212. data/docs/Tasker/Events/Catalog/CatalogPrinter.html +258 -0
  213. data/docs/Tasker/Events/Catalog/CustomEventRegistrar.html +276 -0
  214. data/docs/Tasker/Events/Catalog/ExamplePayloadGenerator.html +294 -0
  215. data/docs/Tasker/Events/Catalog.html +1291 -0
  216. data/docs/Tasker/Events/CustomRegistry.html +943 -0
  217. data/docs/Tasker/Events/DefinitionLoader.html +575 -0
  218. data/docs/Tasker/Events/EventPayloadBuilder/ErrorInfoExtractor.html +286 -0
  219. data/docs/Tasker/Events/EventPayloadBuilder/StepPayloadBuilder.html +312 -0
  220. data/docs/Tasker/Events/EventPayloadBuilder.html +664 -0
  221. data/docs/Tasker/Events/Publisher.html +365 -0
  222. data/docs/Tasker/Events/Subscribers/BaseSubscriber/ErrorCategorizer/ErrorTypeClassifier.html +1128 -0
  223. data/docs/Tasker/Events/Subscribers/BaseSubscriber/ErrorCategorizer.html +270 -0
  224. data/docs/Tasker/Events/Subscribers/BaseSubscriber/MetricTagsExtractor.html +266 -0
  225. data/docs/Tasker/Events/Subscribers/BaseSubscriber.html +2556 -0
  226. data/docs/Tasker/Events/Subscribers/MetricsSubscriber.html +723 -0
  227. data/docs/Tasker/Events/Subscribers/TelemetrySubscriber.html +2251 -0
  228. data/docs/Tasker/Events/Subscribers.html +117 -0
  229. data/docs/Tasker/Events/SubscriptionLoader.html +493 -0
  230. data/docs/Tasker/Events.html +294 -0
  231. data/docs/Tasker/EventsGenerator.html +459 -0
  232. data/docs/Tasker/Functions/FunctionBasedAnalyticsMetrics/AnalyticsMetrics.html +135 -0
  233. data/docs/Tasker/Functions/FunctionBasedAnalyticsMetrics.html +412 -0
  234. data/docs/Tasker/Functions/FunctionBasedDependencyLevels.html +598 -0
  235. data/docs/Tasker/Functions/FunctionBasedSlowestSteps/SlowestStep.html +135 -0
  236. data/docs/Tasker/Functions/FunctionBasedSlowestSteps.html +453 -0
  237. data/docs/Tasker/Functions/FunctionBasedSlowestTasks/SlowestTask.html +135 -0
  238. data/docs/Tasker/Functions/FunctionBasedSlowestTasks.html +453 -0
  239. data/docs/Tasker/Functions/FunctionBasedStepReadinessStatus.html +1457 -0
  240. data/docs/Tasker/Functions/FunctionBasedSystemHealthCounts/HealthMetrics.html +135 -0
  241. data/docs/Tasker/Functions/FunctionBasedSystemHealthCounts.html +370 -0
  242. data/docs/Tasker/Functions/FunctionBasedTaskExecutionContext.html +1250 -0
  243. data/docs/Tasker/Functions/FunctionWrapper.html +479 -0
  244. data/docs/Tasker/Functions.html +117 -0
  245. data/docs/Tasker/Generators/AuthenticatorGenerator/UsageInstructionsFormatter.html +244 -0
  246. data/docs/Tasker/Generators/AuthenticatorGenerator.html +373 -0
  247. data/docs/Tasker/Generators/AuthorizationCoordinatorGenerator.html +430 -0
  248. data/docs/Tasker/Generators/SubscriberGenerator.html +377 -0
  249. data/docs/Tasker/Generators/TaskHandlerGenerator.html +263 -0
  250. data/docs/Tasker/Generators.html +117 -0
  251. data/docs/Tasker/GraphQLTypes/AnnotationType.html +132 -0
  252. data/docs/Tasker/GraphQLTypes/BaseArgument.html +124 -0
  253. data/docs/Tasker/GraphQLTypes/BaseConnection.html +124 -0
  254. data/docs/Tasker/GraphQLTypes/BaseEdge.html +130 -0
  255. data/docs/Tasker/GraphQLTypes/BaseEnum.html +124 -0
  256. data/docs/Tasker/GraphQLTypes/BaseField.html +124 -0
  257. data/docs/Tasker/GraphQLTypes/BaseInputObject.html +124 -0
  258. data/docs/Tasker/GraphQLTypes/BaseInterface.html +116 -0
  259. data/docs/Tasker/GraphQLTypes/BaseObject.html +128 -0
  260. data/docs/Tasker/GraphQLTypes/BaseScalar.html +124 -0
  261. data/docs/Tasker/GraphQLTypes/BaseUnion.html +124 -0
  262. data/docs/Tasker/GraphQLTypes/DependentSystemObjectMapType.html +132 -0
  263. data/docs/Tasker/GraphQLTypes/DependentSystemType.html +132 -0
  264. data/docs/Tasker/GraphQLTypes/MutationType.html +132 -0
  265. data/docs/Tasker/GraphQLTypes/NamedStepType.html +132 -0
  266. data/docs/Tasker/GraphQLTypes/NamedTaskType.html +132 -0
  267. data/docs/Tasker/GraphQLTypes/NamedTasksNamedStepType.html +132 -0
  268. data/docs/Tasker/GraphQLTypes/NodeType.html +118 -0
  269. data/docs/Tasker/GraphQLTypes/QueryType.html +139 -0
  270. data/docs/Tasker/GraphQLTypes/TaskAnnotationType.html +132 -0
  271. data/docs/Tasker/GraphQLTypes/TaskInterface.html +111 -0
  272. data/docs/Tasker/GraphQLTypes/TaskType.html +201 -0
  273. data/docs/Tasker/GraphQLTypes/WorkflowStepType.html +694 -0
  274. data/docs/Tasker/GraphQLTypes.html +130 -0
  275. data/docs/Tasker/GraphqlController.html +251 -0
  276. data/docs/Tasker/HandlerFactory.html +1518 -0
  277. data/docs/Tasker/HandlerSerializer.html +682 -0
  278. data/docs/Tasker/HandlersController.html +574 -0
  279. data/docs/Tasker/HashIdentityStrategy.html +278 -0
  280. data/docs/Tasker/Health/ReadinessChecker.html +712 -0
  281. data/docs/Tasker/Health/StatusChecker.html +653 -0
  282. data/docs/Tasker/Health.html +117 -0
  283. data/docs/Tasker/HealthController.html +523 -0
  284. data/docs/Tasker/IdentityStrategy.html +276 -0
  285. data/docs/Tasker/InvalidTaskHandlerConfig.html +135 -0
  286. data/docs/Tasker/LifecycleEvents/Events/Step.html +162 -0
  287. data/docs/Tasker/LifecycleEvents/Events/Task.html +162 -0
  288. data/docs/Tasker/LifecycleEvents/Events.html +204 -0
  289. data/docs/Tasker/LifecycleEvents/Publisher.html +132 -0
  290. data/docs/Tasker/LifecycleEvents.html +799 -0
  291. data/docs/Tasker/Logging/CorrelationIdGenerator.html +688 -0
  292. data/docs/Tasker/Logging.html +115 -0
  293. data/docs/Tasker/MetricsController.html +293 -0
  294. data/docs/Tasker/MetricsExportJob.html +414 -0
  295. data/docs/Tasker/Mutations/BaseMutation.html +128 -0
  296. data/docs/Tasker/Mutations/CancelStep.html +219 -0
  297. data/docs/Tasker/Mutations/CancelTask.html +221 -0
  298. data/docs/Tasker/Mutations/CreateTask.html +243 -0
  299. data/docs/Tasker/Mutations/UpdateStep.html +243 -0
  300. data/docs/Tasker/Mutations/UpdateTask.html +243 -0
  301. data/docs/Tasker/Mutations.html +117 -0
  302. data/docs/Tasker/NamedStep.html +216 -0
  303. data/docs/Tasker/NamedTask.html +910 -0
  304. data/docs/Tasker/NamedTasksNamedStep.html +435 -0
  305. data/docs/Tasker/Orchestration/BackoffCalculator.html +404 -0
  306. data/docs/Tasker/Orchestration/ConnectionBuilder/ConfigValidator.html +258 -0
  307. data/docs/Tasker/Orchestration/ConnectionBuilder.html +435 -0
  308. data/docs/Tasker/Orchestration/ConnectionPoolIntelligence.html +513 -0
  309. data/docs/Tasker/Orchestration/Coordinator.html +641 -0
  310. data/docs/Tasker/Orchestration/FutureStateAnalyzer.html +1045 -0
  311. data/docs/Tasker/Orchestration/Orchestrator.html +679 -0
  312. data/docs/Tasker/Orchestration/PluginIntegration.html +1127 -0
  313. data/docs/Tasker/Orchestration/ResponseProcessor.html +504 -0
  314. data/docs/Tasker/Orchestration/RetryHeaderParser.html +304 -0
  315. data/docs/Tasker/Orchestration/StepExecutor.html +995 -0
  316. data/docs/Tasker/Orchestration/StepSequenceFactory.html +644 -0
  317. data/docs/Tasker/Orchestration/TaskFinalizer/BlockageChecker.html +264 -0
  318. data/docs/Tasker/Orchestration/TaskFinalizer/ContextManager.html +254 -0
  319. data/docs/Tasker/Orchestration/TaskFinalizer/DelayCalculator.html +556 -0
  320. data/docs/Tasker/Orchestration/TaskFinalizer/FinalizationDecisionMaker.html +348 -0
  321. data/docs/Tasker/Orchestration/TaskFinalizer/FinalizationProcessor.html +286 -0
  322. data/docs/Tasker/Orchestration/TaskFinalizer/ReasonDeterminer.html +432 -0
  323. data/docs/Tasker/Orchestration/TaskFinalizer/ReenqueueManager.html +296 -0
  324. data/docs/Tasker/Orchestration/TaskFinalizer/UnclearStateHandler.html +314 -0
  325. data/docs/Tasker/Orchestration/TaskFinalizer.html +1212 -0
  326. data/docs/Tasker/Orchestration/TaskInitializer.html +766 -0
  327. data/docs/Tasker/Orchestration/TaskReenqueuer.html +506 -0
  328. data/docs/Tasker/Orchestration/ViableStepDiscovery.html +442 -0
  329. data/docs/Tasker/Orchestration/WorkflowCoordinator.html +510 -0
  330. data/docs/Tasker/Orchestration.html +130 -0
  331. data/docs/Tasker/PageSort/PageSortParamsBuilder.html +296 -0
  332. data/docs/Tasker/PageSort.html +247 -0
  333. data/docs/Tasker/PermanentError.html +518 -0
  334. data/docs/Tasker/ProceduralError.html +147 -0
  335. data/docs/Tasker/Queries/AllAnnotationTypes.html +217 -0
  336. data/docs/Tasker/Queries/AllTasks.html +221 -0
  337. data/docs/Tasker/Queries/BaseQuery.html +128 -0
  338. data/docs/Tasker/Queries/Helpers.html +187 -0
  339. data/docs/Tasker/Queries/OneStep.html +225 -0
  340. data/docs/Tasker/Queries/OneTask.html +217 -0
  341. data/docs/Tasker/Queries/TasksByAnnotation.html +231 -0
  342. data/docs/Tasker/Queries/TasksByStatus.html +233 -0
  343. data/docs/Tasker/Queries.html +119 -0
  344. data/docs/Tasker/Railtie.html +124 -0
  345. data/docs/Tasker/Registry/BaseRegistry.html +1690 -0
  346. data/docs/Tasker/Registry/EventPublisher.html +667 -0
  347. data/docs/Tasker/Registry/InterfaceValidator.html +569 -0
  348. data/docs/Tasker/Registry/RegistrationError.html +132 -0
  349. data/docs/Tasker/Registry/RegistryError.html +139 -0
  350. data/docs/Tasker/Registry/StatisticsCollector.html +841 -0
  351. data/docs/Tasker/Registry/SubscriberRegistry.html +1504 -0
  352. data/docs/Tasker/Registry/ValidationError.html +132 -0
  353. data/docs/Tasker/Registry.html +119 -0
  354. data/docs/Tasker/RetryableError.html +515 -0
  355. data/docs/Tasker/StateMachine/Compatibility.html +282 -0
  356. data/docs/Tasker/StateMachine/InvalidStateTransition.html +135 -0
  357. data/docs/Tasker/StateMachine/StepStateMachine/StandardizedPayloadBuilder.html +260 -0
  358. data/docs/Tasker/StateMachine/StepStateMachine.html +2215 -0
  359. data/docs/Tasker/StateMachine/TaskStateMachine.html +734 -0
  360. data/docs/Tasker/StateMachine.html +602 -0
  361. data/docs/Tasker/StepDagRelationship.html +657 -0
  362. data/docs/Tasker/StepHandler/Api/Config.html +1091 -0
  363. data/docs/Tasker/StepHandler/Api.html +884 -0
  364. data/docs/Tasker/StepHandler/AutomaticEventPublishing.html +321 -0
  365. data/docs/Tasker/StepHandler/Base.html +970 -0
  366. data/docs/Tasker/StepHandler.html +119 -0
  367. data/docs/Tasker/StepReadinessStatus.html +836 -0
  368. data/docs/Tasker/Task.html +2575 -0
  369. data/docs/Tasker/TaskAnnotation.html +137 -0
  370. data/docs/Tasker/TaskAnnotationSerializer.html +124 -0
  371. data/docs/Tasker/TaskBuilder/StepNameValidator.html +264 -0
  372. data/docs/Tasker/TaskBuilder/StepTemplateDefiner.html +264 -0
  373. data/docs/Tasker/TaskBuilder.html +764 -0
  374. data/docs/Tasker/TaskDiagram/StepToStepEdgeBuilder.html +260 -0
  375. data/docs/Tasker/TaskDiagram/TaskToRootStepEdgeBuilder.html +290 -0
  376. data/docs/Tasker/TaskDiagram.html +548 -0
  377. data/docs/Tasker/TaskDiagramsController.html +240 -0
  378. data/docs/Tasker/TaskExecutionContext.html +469 -0
  379. data/docs/Tasker/TaskHandler/ClassMethods/StepTemplateDefiner/ClassBasedEventRegistrar.html +238 -0
  380. data/docs/Tasker/TaskHandler/ClassMethods/StepTemplateDefiner/YamlEventRegistrar.html +254 -0
  381. data/docs/Tasker/TaskHandler/ClassMethods/StepTemplateDefiner.html +988 -0
  382. data/docs/Tasker/TaskHandler/ClassMethods.html +357 -0
  383. data/docs/Tasker/TaskHandler/InstanceMethods.html +1396 -0
  384. data/docs/Tasker/TaskHandler/StepGroup.html +1748 -0
  385. data/docs/Tasker/TaskHandler.html +271 -0
  386. data/docs/Tasker/TaskNamespace.html +312 -0
  387. data/docs/Tasker/TaskRunnerJob.html +406 -0
  388. data/docs/Tasker/TaskSerializer.html +474 -0
  389. data/docs/Tasker/TaskTransition.html +1517 -0
  390. data/docs/Tasker/TaskWorkflowSummary.html +988 -0
  391. data/docs/Tasker/TaskerRailsSchema/InvalidObjectTypeError.html +132 -0
  392. data/docs/Tasker/TaskerRailsSchema/TypeResolutionError.html +139 -0
  393. data/docs/Tasker/TaskerRailsSchema/UnknownInterfaceError.html +132 -0
  394. data/docs/Tasker/TaskerRailsSchema.html +384 -0
  395. data/docs/Tasker/TasksController.html +595 -0
  396. data/docs/Tasker/Telemetry/EventMapping.html +1307 -0
  397. data/docs/Tasker/Telemetry/EventRouter.html +2178 -0
  398. data/docs/Tasker/Telemetry/Events/ExportEvents.html +246 -0
  399. data/docs/Tasker/Telemetry/Events.html +115 -0
  400. data/docs/Tasker/Telemetry/ExportCoordinator/DistributedLockTimeoutError.html +135 -0
  401. data/docs/Tasker/Telemetry/ExportCoordinator.html +2137 -0
  402. data/docs/Tasker/Telemetry/IntelligentCacheManager.html +1083 -0
  403. data/docs/Tasker/Telemetry/LogBackend.html +1088 -0
  404. data/docs/Tasker/Telemetry/MetricTypes/Counter.html +1054 -0
  405. data/docs/Tasker/Telemetry/MetricTypes/Gauge.html +1270 -0
  406. data/docs/Tasker/Telemetry/MetricTypes/Histogram.html +1492 -0
  407. data/docs/Tasker/Telemetry/MetricTypes.html +153 -0
  408. data/docs/Tasker/Telemetry/MetricsBackend.html +2510 -0
  409. data/docs/Tasker/Telemetry/MetricsExportService.html +578 -0
  410. data/docs/Tasker/Telemetry/PluginRegistry.html +1774 -0
  411. data/docs/Tasker/Telemetry/Plugins/BaseExporter.html +1835 -0
  412. data/docs/Tasker/Telemetry/Plugins/CsvExporter.html +768 -0
  413. data/docs/Tasker/Telemetry/Plugins/JsonExporter.html +747 -0
  414. data/docs/Tasker/Telemetry/Plugins.html +117 -0
  415. data/docs/Tasker/Telemetry/PrometheusExporter.html +481 -0
  416. data/docs/Tasker/Telemetry/TraceBackend.html +891 -0
  417. data/docs/Tasker/Telemetry.html +130 -0
  418. data/docs/Tasker/Types/AuthConfig.html +886 -0
  419. data/docs/Tasker/Types/BackoffConfig.html +1063 -0
  420. data/docs/Tasker/Types/BaseConfig.html +227 -0
  421. data/docs/Tasker/Types/CacheConfig.html +1731 -0
  422. data/docs/Tasker/Types/DatabaseConfig.html +388 -0
  423. data/docs/Tasker/Types/DependencyGraph.html +526 -0
  424. data/docs/Tasker/Types/DependencyGraphConfig.html +753 -0
  425. data/docs/Tasker/Types/EngineConfig.html +1181 -0
  426. data/docs/Tasker/Types/ExecutionConfig.html +1963 -0
  427. data/docs/Tasker/Types/GraphEdge.html +517 -0
  428. data/docs/Tasker/Types/GraphMetadata.html +781 -0
  429. data/docs/Tasker/Types/GraphNode.html +694 -0
  430. data/docs/Tasker/Types/HealthConfig.html +784 -0
  431. data/docs/Tasker/Types/StepSequence.html +353 -0
  432. data/docs/Tasker/Types/StepTemplate.html +1193 -0
  433. data/docs/Tasker/Types/TaskRequest.html +1179 -0
  434. data/docs/Tasker/Types/TelemetryConfig.html +2746 -0
  435. data/docs/Tasker/Types.html +154 -0
  436. data/docs/Tasker/WorkflowStep/StepFinder.html +282 -0
  437. data/docs/Tasker/WorkflowStep.html +2724 -0
  438. data/docs/Tasker/WorkflowStepEdge.html +304 -0
  439. data/docs/Tasker/WorkflowStepSerializer.html +305 -0
  440. data/docs/Tasker/WorkflowStepTransition/TransitionDescriptionFormatter.html +282 -0
  441. data/docs/Tasker/WorkflowStepTransition.html +2201 -0
  442. data/docs/Tasker/WorkflowStepsController.html +462 -0
  443. data/docs/Tasker.html +452 -0
  444. data/docs/VISION.md +584 -0
  445. data/docs/WHY.md +21 -0
  446. data/docs/_index.html +2375 -0
  447. data/docs/class_list.html +54 -0
  448. data/docs/css/common.css +1 -0
  449. data/docs/css/full_list.css +58 -0
  450. data/docs/css/style.css +503 -0
  451. data/docs/events/migration_plan_outcomes.md +80 -0
  452. data/docs/file.README.html +541 -0
  453. data/docs/file_list.html +59 -0
  454. data/docs/frames.html +22 -0
  455. data/docs/index.html +541 -0
  456. data/docs/js/app.js +344 -0
  457. data/docs/js/full_list.js +242 -0
  458. data/docs/js/jquery.js +4 -0
  459. data/docs/method_list.html +9182 -0
  460. data/docs/top-level-namespace.html +110 -0
  461. data/lib/generators/tasker/authenticator_generator.rb +301 -0
  462. data/lib/generators/tasker/authorization_coordinator_generator.rb +139 -0
  463. data/lib/generators/tasker/events_generator.rb +91 -0
  464. data/lib/generators/tasker/subscriber_generator.rb +107 -0
  465. data/lib/generators/tasker/task_handler_generator.rb +138 -0
  466. data/lib/generators/tasker/templates/api_token_authenticator.rb.erb +113 -0
  467. data/lib/generators/tasker/templates/api_token_authenticator_spec.rb.erb +144 -0
  468. data/lib/generators/tasker/templates/authorization_coordinator.rb.erb +95 -0
  469. data/lib/generators/tasker/templates/authorization_coordinator_spec.rb.erb +142 -0
  470. data/lib/generators/tasker/templates/custom_authenticator.rb.erb +108 -0
  471. data/lib/generators/tasker/templates/custom_authenticator_spec.rb.erb +162 -0
  472. data/lib/generators/tasker/templates/custom_events.yml.erb +62 -0
  473. data/lib/generators/tasker/templates/custom_subscriber.rb.erb +72 -0
  474. data/lib/generators/tasker/templates/devise_authenticator.rb.erb +101 -0
  475. data/lib/generators/tasker/templates/devise_authenticator_spec.rb.erb +126 -0
  476. data/lib/generators/tasker/templates/initialize.rb.erb +202 -0
  477. data/lib/generators/tasker/templates/jwt_authenticator.rb.erb +144 -0
  478. data/lib/generators/tasker/templates/jwt_authenticator_spec.rb.erb +298 -0
  479. data/lib/generators/tasker/templates/metrics_subscriber.rb.erb +258 -0
  480. data/lib/generators/tasker/templates/metrics_subscriber_spec.rb.erb +308 -0
  481. data/lib/generators/tasker/templates/omniauth_authenticator.rb.erb +135 -0
  482. data/lib/generators/tasker/templates/omniauth_authenticator_spec.rb.erb +196 -0
  483. data/lib/generators/tasker/templates/opentelemetry_initializer.rb +52 -0
  484. data/lib/generators/tasker/templates/subscriber.rb.erb +64 -0
  485. data/lib/generators/tasker/templates/subscriber_spec.rb.erb +80 -0
  486. data/lib/generators/tasker/templates/task_config.yaml.erb +117 -0
  487. data/lib/generators/tasker/templates/task_handler.rb.erb +59 -0
  488. data/lib/generators/tasker/templates/task_handler_spec.rb.erb +159 -0
  489. data/lib/tasker/analysis/runtime_graph_analyzer.rb +1168 -0
  490. data/lib/tasker/analysis/template_graph_analyzer.rb +328 -0
  491. data/lib/tasker/authentication/coordinator.rb +78 -0
  492. data/lib/tasker/authentication/errors.rb +9 -0
  493. data/lib/tasker/authentication/interface.rb +36 -0
  494. data/lib/tasker/authentication/none_authenticator.rb +26 -0
  495. data/lib/tasker/authorization/base_coordinator.rb +112 -0
  496. data/lib/tasker/authorization/errors.rb +26 -0
  497. data/lib/tasker/authorization/resource_constants.rb +74 -0
  498. data/lib/tasker/authorization/resource_registry.rb +143 -0
  499. data/lib/tasker/authorization.rb +75 -0
  500. data/lib/tasker/cache_capabilities.rb +131 -0
  501. data/lib/tasker/cache_strategy.rb +469 -0
  502. data/lib/tasker/concerns/authenticatable.rb +41 -0
  503. data/lib/tasker/concerns/authorizable.rb +204 -0
  504. data/lib/tasker/concerns/controller_authorizable.rb +124 -0
  505. data/lib/tasker/concerns/event_publisher.rb +716 -0
  506. data/lib/tasker/concerns/idempotent_state_transitions.rb +128 -0
  507. data/lib/tasker/concerns/state_machine_base.rb +218 -0
  508. data/lib/tasker/concerns/structured_logging.rb +387 -0
  509. data/lib/tasker/configuration.rb +325 -0
  510. data/lib/tasker/constants/event_definitions.rb +147 -0
  511. data/lib/tasker/constants/registry_events.rb +54 -0
  512. data/lib/tasker/constants.rb +417 -0
  513. data/lib/tasker/engine.rb +90 -0
  514. data/lib/tasker/errors.rb +90 -0
  515. data/lib/tasker/events/catalog.rb +432 -0
  516. data/lib/tasker/events/custom_registry.rb +175 -0
  517. data/lib/tasker/events/definition_loader.rb +199 -0
  518. data/lib/tasker/events/event_payload_builder.rb +461 -0
  519. data/lib/tasker/events/publisher.rb +149 -0
  520. data/lib/tasker/events/subscribers/base_subscriber.rb +601 -0
  521. data/lib/tasker/events/subscribers/metrics_subscriber.rb +120 -0
  522. data/lib/tasker/events/subscribers/telemetry_subscriber.rb +462 -0
  523. data/lib/tasker/events/subscription_loader.rb +161 -0
  524. data/lib/tasker/events.rb +37 -0
  525. data/lib/tasker/functions/function_based_analytics_metrics.rb +103 -0
  526. data/lib/tasker/functions/function_based_dependency_levels.rb +54 -0
  527. data/lib/tasker/functions/function_based_slowest_steps.rb +84 -0
  528. data/lib/tasker/functions/function_based_slowest_tasks.rb +84 -0
  529. data/lib/tasker/functions/function_based_step_readiness_status.rb +183 -0
  530. data/lib/tasker/functions/function_based_system_health_counts.rb +94 -0
  531. data/lib/tasker/functions/function_based_task_execution_context.rb +148 -0
  532. data/lib/tasker/functions/function_wrapper.rb +42 -0
  533. data/lib/tasker/functions.rb +12 -0
  534. data/lib/tasker/handler_factory.rb +322 -0
  535. data/lib/tasker/health/readiness_checker.rb +186 -0
  536. data/lib/tasker/health/status_checker.rb +203 -0
  537. data/lib/tasker/identity_strategy.rb +38 -0
  538. data/lib/tasker/logging/correlation_id_generator.rb +120 -0
  539. data/lib/tasker/orchestration/backoff_calculator.rb +184 -0
  540. data/lib/tasker/orchestration/connection_builder.rb +122 -0
  541. data/lib/tasker/orchestration/connection_pool_intelligence.rb +177 -0
  542. data/lib/tasker/orchestration/coordinator.rb +119 -0
  543. data/lib/tasker/orchestration/future_state_analyzer.rb +137 -0
  544. data/lib/tasker/orchestration/plugin_integration.rb +124 -0
  545. data/lib/tasker/orchestration/response_processor.rb +168 -0
  546. data/lib/tasker/orchestration/retry_header_parser.rb +78 -0
  547. data/lib/tasker/orchestration/step_executor.rb +941 -0
  548. data/lib/tasker/orchestration/step_sequence_factory.rb +67 -0
  549. data/lib/tasker/orchestration/task_finalizer.rb +564 -0
  550. data/lib/tasker/orchestration/task_initializer.rb +140 -0
  551. data/lib/tasker/orchestration/task_reenqueuer.rb +71 -0
  552. data/lib/tasker/orchestration/viable_step_discovery.rb +65 -0
  553. data/lib/tasker/orchestration/workflow_coordinator.rb +294 -0
  554. data/lib/tasker/orchestration.rb +45 -0
  555. data/lib/tasker/railtie.rb +9 -0
  556. data/lib/tasker/registry/base_registry.rb +177 -0
  557. data/lib/tasker/registry/event_publisher.rb +91 -0
  558. data/lib/tasker/registry/interface_validator.rb +140 -0
  559. data/lib/tasker/registry/statistics_collector.rb +381 -0
  560. data/lib/tasker/registry/subscriber_registry.rb +285 -0
  561. data/lib/tasker/registry.rb +22 -0
  562. data/lib/tasker/state_machine/step_state_machine.rb +508 -0
  563. data/lib/tasker/state_machine/task_state_machine.rb +192 -0
  564. data/lib/tasker/state_machine.rb +83 -0
  565. data/lib/tasker/step_handler/api.rb +410 -0
  566. data/lib/tasker/step_handler/base.rb +206 -0
  567. data/lib/tasker/task_builder.rb +432 -0
  568. data/lib/tasker/task_handler/class_methods.rb +324 -0
  569. data/lib/tasker/task_handler/instance_methods.rb +293 -0
  570. data/lib/tasker/task_handler/step_group.rb +182 -0
  571. data/lib/tasker/task_handler.rb +43 -0
  572. data/lib/tasker/telemetry/event_mapping.rb +126 -0
  573. data/lib/tasker/telemetry/event_router.rb +318 -0
  574. data/lib/tasker/telemetry/events/export_events.rb +38 -0
  575. data/lib/tasker/telemetry/export_coordinator.rb +497 -0
  576. data/lib/tasker/telemetry/intelligent_cache_manager.rb +508 -0
  577. data/lib/tasker/telemetry/log_backend.rb +224 -0
  578. data/lib/tasker/telemetry/metric_types.rb +368 -0
  579. data/lib/tasker/telemetry/metrics_backend.rb +1227 -0
  580. data/lib/tasker/telemetry/metrics_export_service.rb +392 -0
  581. data/lib/tasker/telemetry/plugin_registry.rb +333 -0
  582. data/lib/tasker/telemetry/plugins/base_exporter.rb +246 -0
  583. data/lib/tasker/telemetry/plugins/csv_exporter.rb +198 -0
  584. data/lib/tasker/telemetry/plugins/json_exporter.rb +141 -0
  585. data/lib/tasker/telemetry/prometheus_exporter.rb +249 -0
  586. data/lib/tasker/telemetry/trace_backend.rb +186 -0
  587. data/lib/tasker/telemetry.rb +59 -0
  588. data/lib/tasker/types/auth_config.rb +81 -0
  589. data/lib/tasker/types/backoff_config.rb +142 -0
  590. data/lib/tasker/types/cache_config.rb +257 -0
  591. data/lib/tasker/types/database_config.rb +39 -0
  592. data/lib/tasker/types/dependency_graph.rb +225 -0
  593. data/lib/tasker/types/dependency_graph_config.rb +149 -0
  594. data/lib/tasker/types/engine_config.rb +131 -0
  595. data/lib/tasker/types/execution_config.rb +289 -0
  596. data/lib/tasker/types/health_config.rb +84 -0
  597. data/lib/tasker/types/step_sequence.rb +24 -0
  598. data/lib/tasker/types/step_template.rb +63 -0
  599. data/lib/tasker/types/task_request.rb +60 -0
  600. data/lib/tasker/types/telemetry_config.rb +273 -0
  601. data/lib/tasker/types.rb +64 -0
  602. data/lib/tasker/version.rb +7 -0
  603. data/lib/tasker.rb +82 -0
  604. data/lib/tasks/tasker_tasks.rake +302 -0
  605. metadata +958 -0
@@ -0,0 +1,2277 @@
1
+ SET statement_timeout = 0;
2
+ SET lock_timeout = 0;
3
+ SET idle_in_transaction_session_timeout = 0;
4
+ SET client_encoding = 'UTF8';
5
+ SET standard_conforming_strings = on;
6
+ SELECT pg_catalog.set_config('search_path', '', false);
7
+ SET check_function_bodies = false;
8
+ SET xmloption = content;
9
+ SET client_min_messages = warning;
10
+ SET row_security = off;
11
+
12
+ --
13
+ -- Name: calculate_dependency_levels(bigint); Type: FUNCTION; Schema: public; Owner: -
14
+ --
15
+
16
+ CREATE FUNCTION public.calculate_dependency_levels(input_task_id bigint) RETURNS TABLE(workflow_step_id bigint, dependency_level integer)
17
+ LANGUAGE plpgsql STABLE
18
+ AS $$
19
+ BEGIN
20
+ RETURN QUERY
21
+ WITH RECURSIVE dependency_levels AS (
22
+ -- Base case: Find root nodes (steps with no dependencies)
23
+ SELECT
24
+ ws.workflow_step_id,
25
+ 0 as level
26
+ FROM tasker_workflow_steps ws
27
+ WHERE ws.task_id = input_task_id
28
+ AND NOT EXISTS (
29
+ SELECT 1
30
+ FROM tasker_workflow_step_edges wse
31
+ WHERE wse.to_step_id = ws.workflow_step_id
32
+ )
33
+
34
+ UNION ALL
35
+
36
+ -- Recursive case: Find children of current level nodes
37
+ SELECT
38
+ wse.to_step_id as workflow_step_id,
39
+ dl.level + 1 as level
40
+ FROM dependency_levels dl
41
+ JOIN tasker_workflow_step_edges wse ON wse.from_step_id = dl.workflow_step_id
42
+ JOIN tasker_workflow_steps ws ON ws.workflow_step_id = wse.to_step_id
43
+ WHERE ws.task_id = input_task_id
44
+ )
45
+ SELECT
46
+ dl.workflow_step_id,
47
+ MAX(dl.level) as dependency_level -- Use MAX to handle multiple paths to same node
48
+ FROM dependency_levels dl
49
+ GROUP BY dl.workflow_step_id
50
+ ORDER BY dependency_level, workflow_step_id;
51
+ END;
52
+ $$;
53
+
54
+
55
+ --
56
+ -- Name: get_analytics_metrics_v01(timestamp with time zone); Type: FUNCTION; Schema: public; Owner: -
57
+ --
58
+
59
+ CREATE FUNCTION public.get_analytics_metrics_v01(since_timestamp timestamp with time zone DEFAULT NULL::timestamp with time zone) RETURNS TABLE(active_tasks_count bigint, total_namespaces_count bigint, unique_task_types_count bigint, system_health_score numeric, task_throughput bigint, completion_count bigint, error_count bigint, completion_rate numeric, error_rate numeric, avg_task_duration numeric, avg_step_duration numeric, step_throughput bigint, analysis_period_start timestamp with time zone, calculated_at timestamp with time zone)
60
+ LANGUAGE plpgsql STABLE
61
+ AS $$
62
+ DECLARE
63
+ analysis_start TIMESTAMPTZ;
64
+ BEGIN
65
+ -- Set analysis start time (default to 1 hour ago if not provided)
66
+ analysis_start := COALESCE(since_timestamp, NOW() - INTERVAL '1 hour');
67
+
68
+ RETURN QUERY
69
+ WITH active_tasks AS (
70
+ SELECT COUNT(DISTINCT t.task_id) as active_count
71
+ FROM tasker_tasks t
72
+ INNER JOIN tasker_workflow_steps ws ON ws.task_id = t.task_id
73
+ INNER JOIN tasker_workflow_step_transitions wst ON wst.workflow_step_id = ws.workflow_step_id
74
+ WHERE wst.most_recent = true
75
+ AND wst.to_state NOT IN ('complete', 'error', 'skipped', 'resolved_manually')
76
+ ),
77
+ namespace_summary AS (
78
+ SELECT COUNT(DISTINCT tn.name) as namespace_count
79
+ FROM tasker_task_namespaces tn
80
+ INNER JOIN tasker_named_tasks nt ON nt.task_namespace_id = tn.task_namespace_id
81
+ INNER JOIN tasker_tasks t ON t.named_task_id = nt.named_task_id
82
+ ),
83
+ task_type_summary AS (
84
+ SELECT COUNT(DISTINCT nt.name) as task_type_count
85
+ FROM tasker_named_tasks nt
86
+ INNER JOIN tasker_tasks t ON t.named_task_id = nt.named_task_id
87
+ ),
88
+ recent_task_health AS (
89
+ SELECT
90
+ COUNT(DISTINCT t.task_id) as total_recent_tasks,
91
+ COUNT(DISTINCT t.task_id) FILTER (
92
+ WHERE wst.to_state = 'complete' AND wst.most_recent = true
93
+ ) as completed_tasks,
94
+ COUNT(DISTINCT t.task_id) FILTER (
95
+ WHERE wst.to_state = 'error' AND wst.most_recent = true
96
+ ) as error_tasks
97
+ FROM tasker_tasks t
98
+ INNER JOIN tasker_workflow_steps ws ON ws.task_id = t.task_id
99
+ INNER JOIN tasker_workflow_step_transitions wst ON wst.workflow_step_id = ws.workflow_step_id
100
+ WHERE t.created_at > NOW() - INTERVAL '1 hour'
101
+ ),
102
+ period_metrics AS (
103
+ SELECT
104
+ COUNT(DISTINCT t.task_id) as throughput,
105
+ COUNT(DISTINCT t.task_id) FILTER (
106
+ WHERE completed_wst.to_state = 'complete' AND completed_wst.most_recent = true
107
+ ) as completions,
108
+ COUNT(DISTINCT t.task_id) FILTER (
109
+ WHERE error_wst.to_state = 'error' AND error_wst.most_recent = true
110
+ ) as errors,
111
+ COUNT(DISTINCT ws.workflow_step_id) as step_count,
112
+ AVG(
113
+ CASE
114
+ WHEN completed_wst.to_state = 'complete' AND completed_wst.most_recent = true
115
+ THEN EXTRACT(EPOCH FROM (completed_wst.created_at - t.created_at))
116
+ ELSE NULL
117
+ END
118
+ ) as avg_task_seconds,
119
+ AVG(
120
+ CASE
121
+ WHEN step_completed.to_state = 'complete' AND step_completed.most_recent = true
122
+ THEN EXTRACT(EPOCH FROM (step_completed.created_at - ws.created_at))
123
+ ELSE NULL
124
+ END
125
+ ) as avg_step_seconds
126
+ FROM tasker_tasks t
127
+ LEFT JOIN tasker_workflow_steps ws ON ws.task_id = t.task_id
128
+ LEFT JOIN tasker_workflow_step_transitions completed_wst ON completed_wst.workflow_step_id = ws.workflow_step_id
129
+ AND completed_wst.to_state = 'complete' AND completed_wst.most_recent = true
130
+ LEFT JOIN tasker_workflow_step_transitions error_wst ON error_wst.workflow_step_id = ws.workflow_step_id
131
+ AND error_wst.to_state = 'error' AND error_wst.most_recent = true
132
+ LEFT JOIN tasker_workflow_step_transitions step_completed ON step_completed.workflow_step_id = ws.workflow_step_id
133
+ AND step_completed.to_state = 'complete' AND step_completed.most_recent = true
134
+ WHERE t.created_at > analysis_start
135
+ )
136
+ SELECT
137
+ at.active_count,
138
+ ns.namespace_count,
139
+ tts.task_type_count,
140
+ CASE
141
+ WHEN (rth.completed_tasks + rth.error_tasks) > 0
142
+ THEN ROUND((rth.completed_tasks::NUMERIC / (rth.completed_tasks + rth.error_tasks)), 3)
143
+ ELSE 1.0
144
+ END as health_score,
145
+ pm.throughput,
146
+ pm.completions,
147
+ pm.errors,
148
+ CASE
149
+ WHEN pm.throughput > 0
150
+ THEN ROUND((pm.completions::NUMERIC / pm.throughput * 100), 2)
151
+ ELSE 0.0
152
+ END as completion_rate_pct,
153
+ CASE
154
+ WHEN pm.throughput > 0
155
+ THEN ROUND((pm.errors::NUMERIC / pm.throughput * 100), 2)
156
+ ELSE 0.0
157
+ END as error_rate_pct,
158
+ ROUND(COALESCE(pm.avg_task_seconds, 0), 3),
159
+ ROUND(COALESCE(pm.avg_step_seconds, 0), 3),
160
+ pm.step_count,
161
+ analysis_start,
162
+ NOW()
163
+ FROM active_tasks at
164
+ CROSS JOIN namespace_summary ns
165
+ CROSS JOIN task_type_summary tts
166
+ CROSS JOIN recent_task_health rth
167
+ CROSS JOIN period_metrics pm;
168
+ END;
169
+ $$;
170
+
171
+
172
+ --
173
+ -- Name: get_slowest_steps_v01(timestamp with time zone, integer, text, text, text); Type: FUNCTION; Schema: public; Owner: -
174
+ --
175
+
176
+ CREATE FUNCTION public.get_slowest_steps_v01(since_timestamp timestamp with time zone DEFAULT NULL::timestamp with time zone, limit_count integer DEFAULT 10, namespace_filter text DEFAULT NULL::text, task_name_filter text DEFAULT NULL::text, version_filter text DEFAULT NULL::text) RETURNS TABLE(workflow_step_id bigint, task_id bigint, step_name character varying, task_name character varying, namespace_name character varying, version character varying, duration_seconds numeric, attempts integer, created_at timestamp with time zone, completed_at timestamp with time zone, retryable boolean, step_status character varying)
177
+ LANGUAGE plpgsql STABLE
178
+ AS $$
179
+ DECLARE
180
+ analysis_start TIMESTAMPTZ;
181
+ BEGIN
182
+ -- Set analysis start time (default to 24 hours ago if not provided)
183
+ analysis_start := COALESCE(since_timestamp, NOW() - INTERVAL '24 hours');
184
+
185
+ RETURN QUERY
186
+ WITH step_durations AS (
187
+ SELECT
188
+ ws.workflow_step_id,
189
+ ws.task_id,
190
+ ns.name as step_name,
191
+ nt.name as task_name,
192
+ tn.name as namespace_name,
193
+ nt.version,
194
+ ws.created_at,
195
+ ws.attempts,
196
+ ws.retryable,
197
+ -- Find the completion time
198
+ wst.created_at as completion_time,
199
+ wst.to_state as final_state,
200
+ -- Calculate duration from step creation to completion
201
+ EXTRACT(EPOCH FROM (wst.created_at - ws.created_at)) as duration_seconds
202
+ FROM tasker_workflow_steps ws
203
+ INNER JOIN tasker_named_steps ns ON ns.named_step_id = ws.named_step_id
204
+ INNER JOIN tasker_tasks t ON t.task_id = ws.task_id
205
+ INNER JOIN tasker_named_tasks nt ON nt.named_task_id = t.named_task_id
206
+ INNER JOIN tasker_task_namespaces tn ON tn.task_namespace_id = nt.task_namespace_id
207
+ INNER JOIN tasker_workflow_step_transitions wst ON wst.workflow_step_id = ws.workflow_step_id
208
+ WHERE ws.created_at > analysis_start
209
+ AND wst.most_recent = true
210
+ AND wst.to_state = 'complete' -- Only include completed steps for accurate duration
211
+ AND (namespace_filter IS NULL OR tn.name = namespace_filter)
212
+ AND (task_name_filter IS NULL OR nt.name = task_name_filter)
213
+ AND (version_filter IS NULL OR nt.version = version_filter)
214
+ )
215
+ SELECT
216
+ sd.workflow_step_id,
217
+ sd.task_id,
218
+ sd.step_name,
219
+ sd.task_name,
220
+ sd.namespace_name,
221
+ sd.version,
222
+ ROUND(sd.duration_seconds, 3),
223
+ sd.attempts,
224
+ sd.created_at,
225
+ sd.completion_time,
226
+ sd.retryable,
227
+ sd.final_state
228
+ FROM step_durations sd
229
+ WHERE sd.duration_seconds IS NOT NULL
230
+ AND sd.duration_seconds > 0 -- Filter out negative durations (data integrity check)
231
+ ORDER BY sd.duration_seconds DESC
232
+ LIMIT limit_count;
233
+ END;
234
+ $$;
235
+
236
+
237
+ --
238
+ -- Name: get_slowest_tasks_v01(timestamp with time zone, integer, text, text, text); Type: FUNCTION; Schema: public; Owner: -
239
+ --
240
+
241
+ CREATE FUNCTION public.get_slowest_tasks_v01(since_timestamp timestamp with time zone DEFAULT NULL::timestamp with time zone, limit_count integer DEFAULT 10, namespace_filter text DEFAULT NULL::text, task_name_filter text DEFAULT NULL::text, version_filter text DEFAULT NULL::text) RETURNS TABLE(task_id bigint, task_name character varying, namespace_name character varying, version character varying, duration_seconds numeric, step_count bigint, completed_steps bigint, error_steps bigint, created_at timestamp with time zone, completed_at timestamp with time zone, initiator character varying, source_system character varying)
242
+ LANGUAGE plpgsql STABLE
243
+ AS $$
244
+ DECLARE
245
+ analysis_start TIMESTAMPTZ;
246
+ BEGIN
247
+ -- Set analysis start time (default to 24 hours ago if not provided)
248
+ analysis_start := COALESCE(since_timestamp, NOW() - INTERVAL '24 hours');
249
+
250
+ RETURN QUERY
251
+ WITH task_durations AS (
252
+ SELECT
253
+ t.task_id,
254
+ nt.name as task_name,
255
+ tn.name as namespace_name,
256
+ nt.version,
257
+ t.created_at,
258
+ t.initiator,
259
+ t.source_system,
260
+ -- Find the latest completion time across all steps
261
+ MAX(wst.created_at) FILTER (
262
+ WHERE wst.to_state IN ('complete', 'error') AND wst.most_recent = true
263
+ ) as latest_completion,
264
+ -- Calculate duration from task creation to latest step completion
265
+ EXTRACT(EPOCH FROM (
266
+ MAX(wst.created_at) FILTER (
267
+ WHERE wst.to_state IN ('complete', 'error') AND wst.most_recent = true
268
+ ) - t.created_at
269
+ )) as duration_seconds,
270
+ COUNT(ws.workflow_step_id) as total_steps,
271
+ COUNT(ws.workflow_step_id) FILTER (
272
+ WHERE complete_wst.to_state = 'complete' AND complete_wst.most_recent = true
273
+ ) as completed_step_count,
274
+ COUNT(ws.workflow_step_id) FILTER (
275
+ WHERE error_wst.to_state = 'error' AND error_wst.most_recent = true
276
+ ) as error_step_count
277
+ FROM tasker_tasks t
278
+ INNER JOIN tasker_named_tasks nt ON nt.named_task_id = t.named_task_id
279
+ INNER JOIN tasker_task_namespaces tn ON tn.task_namespace_id = nt.task_namespace_id
280
+ INNER JOIN tasker_workflow_steps ws ON ws.task_id = t.task_id
281
+ LEFT JOIN tasker_workflow_step_transitions wst ON wst.workflow_step_id = ws.workflow_step_id
282
+ LEFT JOIN tasker_workflow_step_transitions complete_wst ON complete_wst.workflow_step_id = ws.workflow_step_id
283
+ AND complete_wst.to_state = 'complete' AND complete_wst.most_recent = true
284
+ LEFT JOIN tasker_workflow_step_transitions error_wst ON error_wst.workflow_step_id = ws.workflow_step_id
285
+ AND error_wst.to_state = 'error' AND error_wst.most_recent = true
286
+ WHERE t.created_at > analysis_start
287
+ AND (namespace_filter IS NULL OR tn.name = namespace_filter)
288
+ AND (task_name_filter IS NULL OR nt.name = task_name_filter)
289
+ AND (version_filter IS NULL OR nt.version = version_filter)
290
+ GROUP BY t.task_id, nt.name, tn.name, nt.version, t.created_at, t.initiator, t.source_system
291
+ HAVING MAX(wst.created_at) FILTER (
292
+ WHERE wst.to_state IN ('complete', 'error') AND wst.most_recent = true
293
+ ) IS NOT NULL -- Only include tasks that have at least one completed/failed step
294
+ )
295
+ SELECT
296
+ td.task_id,
297
+ td.task_name,
298
+ td.namespace_name,
299
+ td.version,
300
+ ROUND(td.duration_seconds, 3),
301
+ td.total_steps,
302
+ td.completed_step_count,
303
+ td.error_step_count,
304
+ td.created_at,
305
+ td.latest_completion,
306
+ td.initiator,
307
+ td.source_system
308
+ FROM task_durations td
309
+ WHERE td.duration_seconds IS NOT NULL
310
+ ORDER BY td.duration_seconds DESC
311
+ LIMIT limit_count;
312
+ END;
313
+ $$;
314
+
315
+
316
+ --
317
+ -- Name: get_step_readiness_status(bigint, bigint[]); Type: FUNCTION; Schema: public; Owner: -
318
+ --
319
+
320
+ CREATE FUNCTION public.get_step_readiness_status(input_task_id bigint, step_ids bigint[] DEFAULT NULL::bigint[]) RETURNS TABLE(workflow_step_id bigint, task_id bigint, named_step_id integer, name text, current_state text, dependencies_satisfied boolean, retry_eligible boolean, ready_for_execution boolean, last_failure_at timestamp without time zone, next_retry_at timestamp without time zone, total_parents integer, completed_parents integer, attempts integer, retry_limit integer, backoff_request_seconds integer, last_attempted_at timestamp without time zone)
321
+ LANGUAGE plpgsql STABLE
322
+ AS $$
323
+ BEGIN
324
+ RETURN QUERY
325
+ SELECT
326
+ ws.workflow_step_id,
327
+ ws.task_id,
328
+ ws.named_step_id,
329
+ ns.name::TEXT,
330
+
331
+ -- Current State Information (optimized using most_recent flag)
332
+ COALESCE(current_state.to_state, 'pending')::TEXT as current_state,
333
+
334
+ -- Dependency Analysis (calculated from direct joins)
335
+ CASE
336
+ WHEN dep_edges.to_step_id IS NULL THEN true -- Root steps (no parents)
337
+ WHEN COUNT(dep_edges.from_step_id) = 0 THEN true -- Steps with zero dependencies
338
+ WHEN COUNT(CASE WHEN parent_states.to_state IN ('complete', 'resolved_manually') THEN 1 END) = COUNT(dep_edges.from_step_id) THEN true
339
+ ELSE false
340
+ END as dependencies_satisfied,
341
+
342
+ -- Simplified Retry & Backoff Analysis
343
+ CASE
344
+ WHEN ws.attempts >= COALESCE(ws.retry_limit, 3) THEN false
345
+ WHEN ws.attempts > 0 AND COALESCE(ws.retryable, true) = false THEN false
346
+ WHEN last_failure.created_at IS NULL THEN true
347
+ WHEN ws.backoff_request_seconds IS NOT NULL AND ws.last_attempted_at IS NOT NULL THEN
348
+ ws.last_attempted_at + (ws.backoff_request_seconds * interval '1 second') <= NOW()
349
+ WHEN last_failure.created_at IS NOT NULL THEN
350
+ last_failure.created_at + (
351
+ LEAST(power(2, COALESCE(ws.attempts, 1)) * interval '1 second', interval '30 seconds')
352
+ ) <= NOW()
353
+ ELSE true
354
+ END as retry_eligible,
355
+
356
+ -- Simplified Final Readiness Calculation
357
+ CASE
358
+ WHEN COALESCE(current_state.to_state, 'pending') IN ('pending', 'error')
359
+ AND (ws.processed = false OR ws.processed IS NULL) -- CRITICAL: Only unprocessed steps can be ready
360
+ AND (dep_edges.to_step_id IS NULL OR
361
+ COUNT(dep_edges.from_step_id) = 0 OR
362
+ COUNT(CASE WHEN parent_states.to_state IN ('complete', 'resolved_manually') THEN 1 END) = COUNT(dep_edges.from_step_id))
363
+ AND (ws.attempts < COALESCE(ws.retry_limit, 3))
364
+ AND (COALESCE(ws.retryable, true) = true)
365
+ AND (ws.in_process = false OR ws.in_process IS NULL)
366
+ AND (
367
+ -- Check explicit backoff timing (most restrictive)
368
+ -- If backoff is set, the backoff period must have expired
369
+ CASE
370
+ WHEN ws.backoff_request_seconds IS NOT NULL AND ws.last_attempted_at IS NOT NULL THEN
371
+ ws.last_attempted_at + (ws.backoff_request_seconds * interval '1 second') <= NOW()
372
+ ELSE true -- No explicit backoff set
373
+ END
374
+ AND
375
+ -- Then check failure-based backoff
376
+ (last_failure.created_at IS NULL OR
377
+ last_failure.created_at + (LEAST(power(2, COALESCE(ws.attempts, 1)) * interval '1 second', interval '30 seconds')) <= NOW())
378
+ )
379
+ THEN true
380
+ ELSE false
381
+ END as ready_for_execution,
382
+
383
+ -- Timing Information
384
+ last_failure.created_at as last_failure_at,
385
+ CASE
386
+ WHEN ws.backoff_request_seconds IS NOT NULL AND ws.last_attempted_at IS NOT NULL THEN
387
+ ws.last_attempted_at + (ws.backoff_request_seconds * interval '1 second')
388
+ WHEN last_failure.created_at IS NOT NULL THEN
389
+ last_failure.created_at + (LEAST(power(2, COALESCE(ws.attempts, 1)) * interval '1 second', interval '30 seconds'))
390
+ ELSE NULL
391
+ END as next_retry_at,
392
+
393
+ -- Dependency Context (calculated from joins)
394
+ COALESCE(COUNT(dep_edges.from_step_id), 0)::INTEGER as total_parents,
395
+ COALESCE(COUNT(CASE WHEN parent_states.to_state IN ('complete', 'resolved_manually') THEN 1 END), 0)::INTEGER as completed_parents,
396
+
397
+ -- Retry Context
398
+ ws.attempts,
399
+ COALESCE(ws.retry_limit, 3) as retry_limit,
400
+ ws.backoff_request_seconds,
401
+ ws.last_attempted_at
402
+
403
+ FROM tasker_workflow_steps ws
404
+ JOIN tasker_named_steps ns ON ns.named_step_id = ws.named_step_id
405
+
406
+ -- OPTIMIZED: Current State using most_recent flag instead of DISTINCT ON
407
+ LEFT JOIN tasker_workflow_step_transitions current_state
408
+ ON current_state.workflow_step_id = ws.workflow_step_id
409
+ AND current_state.most_recent = true
410
+
411
+ -- OPTIMIZED: Dependency check using direct joins (no subquery)
412
+ LEFT JOIN tasker_workflow_step_edges dep_edges
413
+ ON dep_edges.to_step_id = ws.workflow_step_id
414
+ LEFT JOIN tasker_workflow_step_transitions parent_states
415
+ ON parent_states.workflow_step_id = dep_edges.from_step_id
416
+ AND parent_states.most_recent = true
417
+
418
+ -- OPTIMIZED: Last failure using index-optimized approach
419
+ LEFT JOIN tasker_workflow_step_transitions last_failure
420
+ ON last_failure.workflow_step_id = ws.workflow_step_id
421
+ AND last_failure.to_state = 'error'
422
+ AND last_failure.most_recent = true
423
+
424
+ -- KEY PERFORMANCE IMPROVEMENT: Filter by task first, then optionally by step IDs
425
+ -- CRITICAL FIX: Include ALL steps for task execution context calculation
426
+ -- Only filter by processed status when specifically querying for ready steps
427
+ WHERE ws.task_id = input_task_id
428
+ AND (step_ids IS NULL OR ws.workflow_step_id = ANY(step_ids))
429
+
430
+ GROUP BY
431
+ ws.workflow_step_id, ws.task_id, ws.named_step_id, ns.name,
432
+ current_state.to_state, last_failure.created_at,
433
+ ws.attempts, ws.retry_limit, ws.backoff_request_seconds, ws.last_attempted_at,
434
+ ws.in_process, ws.processed, ws.retryable, dep_edges.to_step_id,
435
+ current_state.workflow_step_id, last_failure.workflow_step_id;
436
+ END;
437
+ $$;
438
+
439
+
440
+ --
441
+ -- Name: get_step_readiness_status_batch(bigint[]); Type: FUNCTION; Schema: public; Owner: -
442
+ --
443
+
444
+ CREATE FUNCTION public.get_step_readiness_status_batch(input_task_ids bigint[]) RETURNS TABLE(workflow_step_id bigint, task_id bigint, named_step_id integer, name text, current_state text, dependencies_satisfied boolean, retry_eligible boolean, ready_for_execution boolean, last_failure_at timestamp without time zone, next_retry_at timestamp without time zone, total_parents integer, completed_parents integer, attempts integer, retry_limit integer, backoff_request_seconds integer, last_attempted_at timestamp without time zone)
445
+ LANGUAGE plpgsql STABLE
446
+ AS $$
447
+ BEGIN
448
+ RETURN QUERY
449
+ SELECT
450
+ ws.workflow_step_id,
451
+ ws.task_id,
452
+ ws.named_step_id,
453
+ ns.name::TEXT,
454
+
455
+ -- Current State Information (optimized using most_recent flag)
456
+ COALESCE(current_state.to_state, 'pending')::TEXT as current_state,
457
+
458
+ -- Dependency Analysis (calculated from direct joins)
459
+ CASE
460
+ WHEN dep_edges.to_step_id IS NULL THEN true -- Root steps (no parents)
461
+ WHEN COUNT(dep_edges.from_step_id) = 0 THEN true -- Steps with zero dependencies
462
+ WHEN COUNT(CASE WHEN parent_states.to_state IN ('complete', 'resolved_manually') THEN 1 END) = COUNT(dep_edges.from_step_id) THEN true
463
+ ELSE false
464
+ END as dependencies_satisfied,
465
+
466
+ -- Simplified Retry & Backoff Analysis
467
+ CASE
468
+ WHEN ws.attempts >= COALESCE(ws.retry_limit, 3) THEN false
469
+ WHEN ws.attempts > 0 AND COALESCE(ws.retryable, true) = false THEN false
470
+ WHEN last_failure.created_at IS NULL THEN true
471
+ WHEN ws.backoff_request_seconds IS NOT NULL AND ws.last_attempted_at IS NOT NULL THEN
472
+ ws.last_attempted_at + (ws.backoff_request_seconds * interval '1 second') <= NOW()
473
+ WHEN last_failure.created_at IS NOT NULL THEN
474
+ last_failure.created_at + (
475
+ LEAST(power(2, COALESCE(ws.attempts, 1)) * interval '1 second', interval '30 seconds')
476
+ ) <= NOW()
477
+ ELSE true
478
+ END as retry_eligible,
479
+
480
+ -- Simplified Final Readiness Calculation
481
+ CASE
482
+ WHEN COALESCE(current_state.to_state, 'pending') IN ('pending', 'error')
483
+ AND (ws.processed = false OR ws.processed IS NULL) -- CRITICAL: Only unprocessed steps can be ready
484
+ AND (dep_edges.to_step_id IS NULL OR
485
+ COUNT(dep_edges.from_step_id) = 0 OR
486
+ COUNT(CASE WHEN parent_states.to_state IN ('complete', 'resolved_manually') THEN 1 END) = COUNT(dep_edges.from_step_id))
487
+ AND (ws.attempts < COALESCE(ws.retry_limit, 3))
488
+ AND (COALESCE(ws.retryable, true) = true)
489
+ AND (ws.in_process = false OR ws.in_process IS NULL)
490
+ AND (
491
+ -- Check explicit backoff timing (most restrictive)
492
+ -- If backoff is set, the backoff period must have expired
493
+ CASE
494
+ WHEN ws.backoff_request_seconds IS NOT NULL AND ws.last_attempted_at IS NOT NULL THEN
495
+ ws.last_attempted_at + (ws.backoff_request_seconds * interval '1 second') <= NOW()
496
+ ELSE true -- No explicit backoff set
497
+ END
498
+ AND
499
+ -- Then check failure-based backoff
500
+ (last_failure.created_at IS NULL OR
501
+ last_failure.created_at + (LEAST(power(2, COALESCE(ws.attempts, 1)) * interval '1 second', interval '30 seconds')) <= NOW())
502
+ )
503
+ THEN true
504
+ ELSE false
505
+ END as ready_for_execution,
506
+
507
+ -- Timing Information
508
+ last_failure.created_at as last_failure_at,
509
+ CASE
510
+ WHEN ws.backoff_request_seconds IS NOT NULL AND ws.last_attempted_at IS NOT NULL THEN
511
+ ws.last_attempted_at + (ws.backoff_request_seconds * interval '1 second')
512
+ WHEN last_failure.created_at IS NOT NULL THEN
513
+ last_failure.created_at + (LEAST(power(2, COALESCE(ws.attempts, 1)) * interval '1 second', interval '30 seconds'))
514
+ ELSE NULL
515
+ END as next_retry_at,
516
+
517
+ -- Dependency Context (calculated from joins)
518
+ COALESCE(COUNT(dep_edges.from_step_id), 0)::INTEGER as total_parents,
519
+ COALESCE(COUNT(CASE WHEN parent_states.to_state IN ('complete', 'resolved_manually') THEN 1 END), 0)::INTEGER as completed_parents,
520
+
521
+ -- Retry Context
522
+ ws.attempts,
523
+ COALESCE(ws.retry_limit, 3) as retry_limit,
524
+ ws.backoff_request_seconds,
525
+ ws.last_attempted_at
526
+
527
+ FROM tasker_workflow_steps ws
528
+ JOIN tasker_named_steps ns ON ns.named_step_id = ws.named_step_id
529
+
530
+ -- OPTIMIZED: Current State using most_recent flag instead of DISTINCT ON
531
+ LEFT JOIN tasker_workflow_step_transitions current_state
532
+ ON current_state.workflow_step_id = ws.workflow_step_id
533
+ AND current_state.most_recent = true
534
+
535
+ -- OPTIMIZED: Dependency check using direct joins (no subquery)
536
+ LEFT JOIN tasker_workflow_step_edges dep_edges
537
+ ON dep_edges.to_step_id = ws.workflow_step_id
538
+ LEFT JOIN tasker_workflow_step_transitions parent_states
539
+ ON parent_states.workflow_step_id = dep_edges.from_step_id
540
+ AND parent_states.most_recent = true
541
+
542
+ -- OPTIMIZED: Last failure using index-optimized approach
543
+ LEFT JOIN tasker_workflow_step_transitions last_failure
544
+ ON last_failure.workflow_step_id = ws.workflow_step_id
545
+ AND last_failure.to_state = 'error'
546
+ AND last_failure.most_recent = true
547
+
548
+ -- KEY PERFORMANCE IMPROVEMENT: Filter by multiple tasks at once
549
+ -- CRITICAL FIX: Include ALL steps for task execution context calculation
550
+ -- Only filter by processed status when specifically querying for ready steps
551
+ WHERE ws.task_id = ANY(input_task_ids)
552
+
553
+ GROUP BY
554
+ ws.workflow_step_id, ws.task_id, ws.named_step_id, ns.name,
555
+ current_state.to_state, last_failure.created_at,
556
+ ws.attempts, ws.retry_limit, ws.backoff_request_seconds, ws.last_attempted_at,
557
+ ws.in_process, ws.processed, ws.retryable, dep_edges.to_step_id
558
+
559
+ -- IMPORTANT: Order by task_id, then workflow_step_id for consistent grouping
560
+ ORDER BY ws.task_id, ws.workflow_step_id;
561
+ END;
562
+ $$;
563
+
564
+
565
+ --
566
+ -- Name: get_system_health_counts_v01(); Type: FUNCTION; Schema: public; Owner: -
567
+ --
568
+
569
+ CREATE FUNCTION public.get_system_health_counts_v01() RETURNS TABLE(total_tasks bigint, pending_tasks bigint, in_progress_tasks bigint, complete_tasks bigint, error_tasks bigint, cancelled_tasks bigint, total_steps bigint, pending_steps bigint, in_progress_steps bigint, complete_steps bigint, error_steps bigint, retryable_error_steps bigint, exhausted_retry_steps bigint, in_backoff_steps bigint, active_connections bigint, max_connections bigint)
570
+ LANGUAGE plpgsql STABLE
571
+ AS $$
572
+ BEGIN
573
+ RETURN QUERY
574
+ WITH task_counts AS (
575
+ SELECT
576
+ COUNT(*) as total_tasks,
577
+ COUNT(*) FILTER (WHERE task_state.to_state = 'pending') as pending_tasks,
578
+ COUNT(*) FILTER (WHERE task_state.to_state = 'in_progress') as in_progress_tasks,
579
+ COUNT(*) FILTER (WHERE task_state.to_state = 'complete') as complete_tasks,
580
+ COUNT(*) FILTER (WHERE task_state.to_state = 'error') as error_tasks,
581
+ COUNT(*) FILTER (WHERE task_state.to_state = 'cancelled') as cancelled_tasks
582
+ FROM tasker_tasks t
583
+ LEFT JOIN tasker_task_transitions task_state ON task_state.task_id = t.task_id
584
+ AND task_state.most_recent = true
585
+ ),
586
+ step_counts AS (
587
+ SELECT
588
+ COUNT(*) as total_steps,
589
+ COUNT(*) FILTER (WHERE step_state.to_state = 'pending') as pending_steps,
590
+ COUNT(*) FILTER (WHERE step_state.to_state = 'in_progress') as in_progress_steps,
591
+ COUNT(*) FILTER (WHERE step_state.to_state = 'complete') as complete_steps,
592
+ COUNT(*) FILTER (WHERE step_state.to_state = 'error') as error_steps,
593
+
594
+ -- Retry-specific logic - retryable errors
595
+ COUNT(*) FILTER (
596
+ WHERE step_state.to_state = 'error'
597
+ AND ws.attempts < ws.retry_limit
598
+ AND COALESCE(ws.retryable, true) = true
599
+ ) as retryable_error_steps,
600
+
601
+ -- Exhausted retries
602
+ COUNT(*) FILTER (
603
+ WHERE step_state.to_state = 'error'
604
+ AND ws.attempts >= ws.retry_limit
605
+ ) as exhausted_retry_steps,
606
+
607
+ -- In backoff (error state but not exhausted retries and has last_attempted_at)
608
+ COUNT(*) FILTER (
609
+ WHERE step_state.to_state = 'error'
610
+ AND ws.attempts < ws.retry_limit
611
+ AND COALESCE(ws.retryable, true) = true
612
+ AND ws.last_attempted_at IS NOT NULL
613
+ ) as in_backoff_steps
614
+
615
+ FROM tasker_workflow_steps ws
616
+ LEFT JOIN tasker_workflow_step_transitions step_state ON step_state.workflow_step_id = ws.workflow_step_id
617
+ AND step_state.most_recent = true
618
+ ),
619
+ connection_info AS (
620
+ SELECT
621
+ COUNT(*) as active_connections,
622
+ COALESCE((SELECT setting::BIGINT FROM pg_settings WHERE name = 'max_connections'), 0) as max_connections
623
+ FROM pg_stat_activity
624
+ WHERE datname = current_database()
625
+ AND state = 'active'
626
+ )
627
+ SELECT
628
+ tc.total_tasks,
629
+ tc.pending_tasks,
630
+ tc.in_progress_tasks,
631
+ tc.complete_tasks,
632
+ tc.error_tasks,
633
+ tc.cancelled_tasks,
634
+ sc.total_steps,
635
+ sc.pending_steps,
636
+ sc.in_progress_steps,
637
+ sc.complete_steps,
638
+ sc.error_steps,
639
+ sc.retryable_error_steps,
640
+ sc.exhausted_retry_steps,
641
+ sc.in_backoff_steps,
642
+ ci.active_connections,
643
+ ci.max_connections
644
+ FROM task_counts tc
645
+ CROSS JOIN step_counts sc
646
+ CROSS JOIN connection_info ci;
647
+ END;
648
+ $$;
649
+
650
+
651
+ --
652
+ -- Name: get_task_execution_context(bigint); Type: FUNCTION; Schema: public; Owner: -
653
+ --
654
+
655
+ CREATE FUNCTION public.get_task_execution_context(input_task_id bigint) RETURNS TABLE(task_id bigint, named_task_id integer, status text, total_steps bigint, pending_steps bigint, in_progress_steps bigint, completed_steps bigint, failed_steps bigint, ready_steps bigint, execution_status text, recommended_action text, completion_percentage numeric, health_status text)
656
+ LANGUAGE plpgsql STABLE
657
+ AS $$
658
+ BEGIN
659
+ -- Use the step readiness function to get step data, then aggregate
660
+ -- The step readiness function handles the case where no steps exist
661
+ RETURN QUERY
662
+ WITH step_data AS (
663
+ SELECT * FROM get_step_readiness_status(input_task_id, NULL)
664
+ ),
665
+ task_info AS (
666
+ SELECT
667
+ t.task_id,
668
+ t.named_task_id,
669
+ COALESCE(task_state.to_state, 'pending')::TEXT as current_status
670
+ FROM tasker_tasks t
671
+ LEFT JOIN tasker_task_transitions task_state
672
+ ON task_state.task_id = t.task_id
673
+ AND task_state.most_recent = true
674
+ WHERE t.task_id = input_task_id
675
+ ),
676
+ aggregated_stats AS (
677
+ SELECT
678
+ COUNT(*) as total_steps,
679
+ COUNT(CASE WHEN sd.current_state = 'pending' THEN 1 END) as pending_steps,
680
+ COUNT(CASE WHEN sd.current_state = 'in_progress' THEN 1 END) as in_progress_steps,
681
+ COUNT(CASE WHEN sd.current_state IN ('complete', 'resolved_manually') THEN 1 END) as completed_steps,
682
+ COUNT(CASE WHEN sd.current_state = 'error' THEN 1 END) as failed_steps,
683
+ COUNT(CASE WHEN sd.ready_for_execution = true THEN 1 END) as ready_steps,
684
+ -- Count PERMANENTLY blocked failures (exhausted retries OR explicitly marked as not retryable)
685
+ COUNT(CASE WHEN sd.current_state = 'error'
686
+ AND (sd.attempts >= sd.retry_limit) THEN 1 END) as permanently_blocked_steps
687
+ FROM step_data sd
688
+ )
689
+ SELECT
690
+ ti.task_id,
691
+ ti.named_task_id,
692
+ ti.current_status as status,
693
+
694
+ -- Step Statistics
695
+ COALESCE(ast.total_steps, 0) as total_steps,
696
+ COALESCE(ast.pending_steps, 0) as pending_steps,
697
+ COALESCE(ast.in_progress_steps, 0) as in_progress_steps,
698
+ COALESCE(ast.completed_steps, 0) as completed_steps,
699
+ COALESCE(ast.failed_steps, 0) as failed_steps,
700
+ COALESCE(ast.ready_steps, 0) as ready_steps,
701
+
702
+ -- FIXED: Execution State Logic
703
+ CASE
704
+ WHEN COALESCE(ast.ready_steps, 0) > 0 THEN 'has_ready_steps'
705
+ WHEN COALESCE(ast.in_progress_steps, 0) > 0 THEN 'processing'
706
+ -- OLD BUG: WHEN COALESCE(ast.failed_steps, 0) > 0 AND COALESCE(ast.ready_steps, 0) = 0 THEN 'blocked_by_failures'
707
+ -- NEW FIX: Only blocked if failed steps are NOT retry-eligible
708
+ WHEN COALESCE(ast.permanently_blocked_steps, 0) > 0 AND COALESCE(ast.ready_steps, 0) = 0 THEN 'blocked_by_failures'
709
+ WHEN COALESCE(ast.completed_steps, 0) = COALESCE(ast.total_steps, 0) AND COALESCE(ast.total_steps, 0) > 0 THEN 'all_complete'
710
+ ELSE 'waiting_for_dependencies'
711
+ END as execution_status,
712
+
713
+ -- FIXED: Recommended Action Logic
714
+ CASE
715
+ WHEN COALESCE(ast.ready_steps, 0) > 0 THEN 'execute_ready_steps'
716
+ WHEN COALESCE(ast.in_progress_steps, 0) > 0 THEN 'wait_for_completion'
717
+ -- OLD BUG: WHEN COALESCE(ast.failed_steps, 0) > 0 AND COALESCE(ast.ready_steps, 0) = 0 THEN 'handle_failures'
718
+ -- NEW FIX: Only handle failures if they're truly blocked
719
+ WHEN COALESCE(ast.permanently_blocked_steps, 0) > 0 AND COALESCE(ast.ready_steps, 0) = 0 THEN 'handle_failures'
720
+ WHEN COALESCE(ast.completed_steps, 0) = COALESCE(ast.total_steps, 0) AND COALESCE(ast.total_steps, 0) > 0 THEN 'finalize_task'
721
+ ELSE 'wait_for_dependencies'
722
+ END as recommended_action,
723
+
724
+ -- Progress Metrics
725
+ CASE
726
+ WHEN COALESCE(ast.total_steps, 0) = 0 THEN 0.0
727
+ ELSE ROUND((COALESCE(ast.completed_steps, 0)::decimal / COALESCE(ast.total_steps, 1)::decimal) * 100, 2)
728
+ END as completion_percentage,
729
+
730
+ -- FIXED: Health Status Logic
731
+ CASE
732
+ WHEN COALESCE(ast.failed_steps, 0) = 0 THEN 'healthy'
733
+ WHEN COALESCE(ast.failed_steps, 0) > 0 AND COALESCE(ast.ready_steps, 0) > 0 THEN 'recovering'
734
+ -- NEW FIX: Only blocked if failures are truly not retry-eligible
735
+ WHEN COALESCE(ast.permanently_blocked_steps, 0) > 0 AND COALESCE(ast.ready_steps, 0) = 0 THEN 'blocked'
736
+ -- NEW: Waiting state for retry-eligible failures with backoff
737
+ WHEN COALESCE(ast.failed_steps, 0) > 0 AND COALESCE(ast.permanently_blocked_steps, 0) = 0 AND COALESCE(ast.ready_steps, 0) = 0 THEN 'recovering'
738
+ ELSE 'unknown'
739
+ END as health_status
740
+
741
+ FROM task_info ti
742
+ CROSS JOIN aggregated_stats ast;
743
+ END;
744
+ $$;
745
+
746
+
747
+ --
748
+ -- Name: get_task_execution_contexts_batch(bigint[]); Type: FUNCTION; Schema: public; Owner: -
749
+ --
750
+
751
+ CREATE FUNCTION public.get_task_execution_contexts_batch(input_task_ids bigint[]) RETURNS TABLE(task_id bigint, named_task_id integer, status text, total_steps bigint, pending_steps bigint, in_progress_steps bigint, completed_steps bigint, failed_steps bigint, ready_steps bigint, execution_status text, recommended_action text, completion_percentage numeric, health_status text)
752
+ LANGUAGE plpgsql STABLE
753
+ AS $$
754
+ BEGIN
755
+ RETURN QUERY
756
+ WITH step_data AS (
757
+ -- Get step readiness data for all tasks at once using batch function
758
+ SELECT * FROM get_step_readiness_status_batch(input_task_ids)
759
+ ),
760
+ task_info AS (
761
+ SELECT
762
+ t.task_id,
763
+ t.named_task_id,
764
+ COALESCE(task_state.to_state, 'pending')::TEXT as current_status
765
+ FROM unnest(input_task_ids) AS task_list(task_id)
766
+ JOIN tasker_tasks t ON t.task_id = task_list.task_id
767
+ LEFT JOIN tasker_task_transitions task_state
768
+ ON task_state.task_id = t.task_id
769
+ AND task_state.most_recent = true
770
+ ),
771
+ aggregated_stats AS (
772
+ SELECT
773
+ sd.task_id,
774
+ COUNT(*) as total_steps,
775
+ COUNT(CASE WHEN sd.current_state = 'pending' THEN 1 END) as pending_steps,
776
+ COUNT(CASE WHEN sd.current_state = 'in_progress' THEN 1 END) as in_progress_steps,
777
+ COUNT(CASE WHEN sd.current_state IN ('complete', 'resolved_manually') THEN 1 END) as completed_steps,
778
+ COUNT(CASE WHEN sd.current_state = 'error' THEN 1 END) as failed_steps,
779
+ COUNT(CASE WHEN sd.ready_for_execution = true THEN 1 END) as ready_steps,
780
+ -- Count PERMANENTLY blocked failures (exhausted retries)
781
+ COUNT(CASE WHEN sd.current_state = 'error'
782
+ AND (sd.attempts >= sd.retry_limit) THEN 1 END) as permanently_blocked_steps
783
+ FROM step_data sd
784
+ GROUP BY sd.task_id
785
+ )
786
+ SELECT
787
+ ti.task_id,
788
+ ti.named_task_id,
789
+ ti.current_status as status,
790
+
791
+ -- Step Statistics
792
+ COALESCE(ast.total_steps, 0) as total_steps,
793
+ COALESCE(ast.pending_steps, 0) as pending_steps,
794
+ COALESCE(ast.in_progress_steps, 0) as in_progress_steps,
795
+ COALESCE(ast.completed_steps, 0) as completed_steps,
796
+ COALESCE(ast.failed_steps, 0) as failed_steps,
797
+ COALESCE(ast.ready_steps, 0) as ready_steps,
798
+
799
+ -- Execution State Logic
800
+ CASE
801
+ WHEN COALESCE(ast.ready_steps, 0) > 0 THEN 'has_ready_steps'
802
+ WHEN COALESCE(ast.in_progress_steps, 0) > 0 THEN 'processing'
803
+ WHEN COALESCE(ast.permanently_blocked_steps, 0) > 0 AND COALESCE(ast.ready_steps, 0) = 0 THEN 'blocked_by_failures'
804
+ WHEN COALESCE(ast.completed_steps, 0) = COALESCE(ast.total_steps, 0) AND COALESCE(ast.total_steps, 0) > 0 THEN 'all_complete'
805
+ ELSE 'waiting_for_dependencies'
806
+ END as execution_status,
807
+
808
+ -- Recommended Action Logic
809
+ CASE
810
+ WHEN COALESCE(ast.ready_steps, 0) > 0 THEN 'execute_ready_steps'
811
+ WHEN COALESCE(ast.in_progress_steps, 0) > 0 THEN 'wait_for_completion'
812
+ WHEN COALESCE(ast.permanently_blocked_steps, 0) > 0 AND COALESCE(ast.ready_steps, 0) = 0 THEN 'handle_failures'
813
+ WHEN COALESCE(ast.completed_steps, 0) = COALESCE(ast.total_steps, 0) AND COALESCE(ast.total_steps, 0) > 0 THEN 'finalize_task'
814
+ ELSE 'wait_for_dependencies'
815
+ END as recommended_action,
816
+
817
+ -- Progress Metrics
818
+ CASE
819
+ WHEN COALESCE(ast.total_steps, 0) = 0 THEN 0.0
820
+ ELSE ROUND((COALESCE(ast.completed_steps, 0)::decimal / COALESCE(ast.total_steps, 1)::decimal) * 100, 2)
821
+ END as completion_percentage,
822
+
823
+ -- Health Status Logic
824
+ CASE
825
+ WHEN COALESCE(ast.failed_steps, 0) = 0 THEN 'healthy'
826
+ WHEN COALESCE(ast.failed_steps, 0) > 0 AND COALESCE(ast.ready_steps, 0) > 0 THEN 'recovering'
827
+ WHEN COALESCE(ast.permanently_blocked_steps, 0) > 0 AND COALESCE(ast.ready_steps, 0) = 0 THEN 'blocked'
828
+ WHEN COALESCE(ast.failed_steps, 0) > 0 AND COALESCE(ast.permanently_blocked_steps, 0) = 0 AND COALESCE(ast.ready_steps, 0) = 0 THEN 'recovering'
829
+ ELSE 'unknown'
830
+ END as health_status
831
+
832
+ FROM task_info ti
833
+ LEFT JOIN aggregated_stats ast ON ast.task_id = ti.task_id
834
+ ORDER BY ti.task_id;
835
+ END;
836
+ $$;
837
+
838
+
839
+ SET default_tablespace = '';
840
+
841
+ SET default_table_access_method = heap;
842
+
843
+ --
844
+ -- Name: tasker_annotation_types; Type: TABLE; Schema: public; Owner: -
845
+ --
846
+
847
+ CREATE TABLE public.tasker_annotation_types (
848
+ annotation_type_id integer NOT NULL,
849
+ name character varying(64) NOT NULL,
850
+ description character varying(255),
851
+ created_at timestamp(6) without time zone NOT NULL,
852
+ updated_at timestamp(6) without time zone NOT NULL
853
+ );
854
+
855
+
856
+ --
857
+ -- Name: tasker_annotation_types_annotation_type_id_seq; Type: SEQUENCE; Schema: public; Owner: -
858
+ --
859
+
860
+ CREATE SEQUENCE public.tasker_annotation_types_annotation_type_id_seq
861
+ AS integer
862
+ START WITH 1
863
+ INCREMENT BY 1
864
+ NO MINVALUE
865
+ NO MAXVALUE
866
+ CACHE 1;
867
+
868
+
869
+ --
870
+ -- Name: tasker_annotation_types_annotation_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
871
+ --
872
+
873
+ ALTER SEQUENCE public.tasker_annotation_types_annotation_type_id_seq OWNED BY public.tasker_annotation_types.annotation_type_id;
874
+
875
+
876
+ --
877
+ -- Name: tasker_dependent_system_object_maps; Type: TABLE; Schema: public; Owner: -
878
+ --
879
+
880
+ CREATE TABLE public.tasker_dependent_system_object_maps (
881
+ dependent_system_object_map_id bigint NOT NULL,
882
+ dependent_system_one_id integer NOT NULL,
883
+ dependent_system_two_id integer NOT NULL,
884
+ remote_id_one character varying(128) NOT NULL,
885
+ remote_id_two character varying(128) NOT NULL,
886
+ created_at timestamp(6) without time zone NOT NULL,
887
+ updated_at timestamp(6) without time zone NOT NULL
888
+ );
889
+
890
+
891
+ --
892
+ -- Name: tasker_dependent_system_objec_dependent_system_object_map_i_seq; Type: SEQUENCE; Schema: public; Owner: -
893
+ --
894
+
895
+ CREATE SEQUENCE public.tasker_dependent_system_objec_dependent_system_object_map_i_seq
896
+ START WITH 1
897
+ INCREMENT BY 1
898
+ NO MINVALUE
899
+ NO MAXVALUE
900
+ CACHE 1;
901
+
902
+
903
+ --
904
+ -- Name: tasker_dependent_system_objec_dependent_system_object_map_i_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
905
+ --
906
+
907
+ ALTER SEQUENCE public.tasker_dependent_system_objec_dependent_system_object_map_i_seq OWNED BY public.tasker_dependent_system_object_maps.dependent_system_object_map_id;
908
+
909
+
910
+ --
911
+ -- Name: tasker_dependent_systems; Type: TABLE; Schema: public; Owner: -
912
+ --
913
+
914
+ CREATE TABLE public.tasker_dependent_systems (
915
+ dependent_system_id integer NOT NULL,
916
+ name character varying(64) NOT NULL,
917
+ description character varying(255),
918
+ created_at timestamp(6) without time zone NOT NULL,
919
+ updated_at timestamp(6) without time zone NOT NULL
920
+ );
921
+
922
+
923
+ --
924
+ -- Name: tasker_dependent_systems_dependent_system_id_seq; Type: SEQUENCE; Schema: public; Owner: -
925
+ --
926
+
927
+ CREATE SEQUENCE public.tasker_dependent_systems_dependent_system_id_seq
928
+ AS integer
929
+ START WITH 1
930
+ INCREMENT BY 1
931
+ NO MINVALUE
932
+ NO MAXVALUE
933
+ CACHE 1;
934
+
935
+
936
+ --
937
+ -- Name: tasker_dependent_systems_dependent_system_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
938
+ --
939
+
940
+ ALTER SEQUENCE public.tasker_dependent_systems_dependent_system_id_seq OWNED BY public.tasker_dependent_systems.dependent_system_id;
941
+
942
+
943
+ --
944
+ -- Name: tasker_named_steps; Type: TABLE; Schema: public; Owner: -
945
+ --
946
+
947
+ CREATE TABLE public.tasker_named_steps (
948
+ named_step_id integer NOT NULL,
949
+ dependent_system_id integer NOT NULL,
950
+ name character varying(128) NOT NULL,
951
+ description character varying(255),
952
+ created_at timestamp(6) without time zone NOT NULL,
953
+ updated_at timestamp(6) without time zone NOT NULL
954
+ );
955
+
956
+
957
+ --
958
+ -- Name: tasker_named_steps_named_step_id_seq; Type: SEQUENCE; Schema: public; Owner: -
959
+ --
960
+
961
+ CREATE SEQUENCE public.tasker_named_steps_named_step_id_seq
962
+ AS integer
963
+ START WITH 1
964
+ INCREMENT BY 1
965
+ NO MINVALUE
966
+ NO MAXVALUE
967
+ CACHE 1;
968
+
969
+
970
+ --
971
+ -- Name: tasker_named_steps_named_step_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
972
+ --
973
+
974
+ ALTER SEQUENCE public.tasker_named_steps_named_step_id_seq OWNED BY public.tasker_named_steps.named_step_id;
975
+
976
+
977
+ --
978
+ -- Name: tasker_named_tasks; Type: TABLE; Schema: public; Owner: -
979
+ --
980
+
981
+ CREATE TABLE public.tasker_named_tasks (
982
+ named_task_id integer NOT NULL,
983
+ name character varying(64) NOT NULL,
984
+ description character varying(255),
985
+ created_at timestamp(6) without time zone NOT NULL,
986
+ updated_at timestamp(6) without time zone NOT NULL,
987
+ task_namespace_id bigint DEFAULT 1 NOT NULL,
988
+ version character varying(16) DEFAULT '0.1.0'::character varying NOT NULL,
989
+ configuration jsonb DEFAULT '"{}"'::jsonb
990
+ );
991
+
992
+
993
+ --
994
+ -- Name: tasker_named_tasks_named_steps; Type: TABLE; Schema: public; Owner: -
995
+ --
996
+
997
+ CREATE TABLE public.tasker_named_tasks_named_steps (
998
+ id integer NOT NULL,
999
+ named_task_id integer NOT NULL,
1000
+ named_step_id integer NOT NULL,
1001
+ skippable boolean DEFAULT false NOT NULL,
1002
+ default_retryable boolean DEFAULT true NOT NULL,
1003
+ default_retry_limit integer DEFAULT 3 NOT NULL,
1004
+ created_at timestamp(6) without time zone NOT NULL,
1005
+ updated_at timestamp(6) without time zone NOT NULL
1006
+ );
1007
+
1008
+
1009
+ --
1010
+ -- Name: tasker_named_tasks_named_steps_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1011
+ --
1012
+
1013
+ CREATE SEQUENCE public.tasker_named_tasks_named_steps_id_seq
1014
+ AS integer
1015
+ START WITH 1
1016
+ INCREMENT BY 1
1017
+ NO MINVALUE
1018
+ NO MAXVALUE
1019
+ CACHE 1;
1020
+
1021
+
1022
+ --
1023
+ -- Name: tasker_named_tasks_named_steps_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1024
+ --
1025
+
1026
+ ALTER SEQUENCE public.tasker_named_tasks_named_steps_id_seq OWNED BY public.tasker_named_tasks_named_steps.id;
1027
+
1028
+
1029
+ --
1030
+ -- Name: tasker_named_tasks_named_task_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1031
+ --
1032
+
1033
+ CREATE SEQUENCE public.tasker_named_tasks_named_task_id_seq
1034
+ AS integer
1035
+ START WITH 1
1036
+ INCREMENT BY 1
1037
+ NO MINVALUE
1038
+ NO MAXVALUE
1039
+ CACHE 1;
1040
+
1041
+
1042
+ --
1043
+ -- Name: tasker_named_tasks_named_task_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1044
+ --
1045
+
1046
+ ALTER SEQUENCE public.tasker_named_tasks_named_task_id_seq OWNED BY public.tasker_named_tasks.named_task_id;
1047
+
1048
+
1049
+ --
1050
+ -- Name: tasker_workflow_step_edges; Type: TABLE; Schema: public; Owner: -
1051
+ --
1052
+
1053
+ CREATE TABLE public.tasker_workflow_step_edges (
1054
+ id bigint NOT NULL,
1055
+ from_step_id bigint NOT NULL,
1056
+ to_step_id bigint NOT NULL,
1057
+ name character varying NOT NULL,
1058
+ created_at timestamp(6) without time zone NOT NULL,
1059
+ updated_at timestamp(6) without time zone NOT NULL
1060
+ );
1061
+
1062
+
1063
+ --
1064
+ -- Name: tasker_workflow_steps; Type: TABLE; Schema: public; Owner: -
1065
+ --
1066
+
1067
+ CREATE TABLE public.tasker_workflow_steps (
1068
+ workflow_step_id bigint NOT NULL,
1069
+ task_id bigint NOT NULL,
1070
+ named_step_id integer NOT NULL,
1071
+ retryable boolean DEFAULT true NOT NULL,
1072
+ retry_limit integer DEFAULT 3,
1073
+ in_process boolean DEFAULT false NOT NULL,
1074
+ processed boolean DEFAULT false NOT NULL,
1075
+ processed_at timestamp without time zone,
1076
+ attempts integer,
1077
+ last_attempted_at timestamp without time zone,
1078
+ backoff_request_seconds integer,
1079
+ inputs jsonb,
1080
+ results jsonb,
1081
+ created_at timestamp(6) without time zone NOT NULL,
1082
+ updated_at timestamp(6) without time zone NOT NULL,
1083
+ skippable boolean DEFAULT false NOT NULL
1084
+ );
1085
+
1086
+
1087
+ --
1088
+ -- Name: tasker_step_dag_relationships; Type: VIEW; Schema: public; Owner: -
1089
+ --
1090
+
1091
+ CREATE VIEW public.tasker_step_dag_relationships AS
1092
+ SELECT ws.workflow_step_id,
1093
+ ws.task_id,
1094
+ ws.named_step_id,
1095
+ COALESCE(parent_data.parent_ids, '[]'::jsonb) AS parent_step_ids,
1096
+ COALESCE(child_data.child_ids, '[]'::jsonb) AS child_step_ids,
1097
+ COALESCE(parent_data.parent_count, (0)::bigint) AS parent_count,
1098
+ COALESCE(child_data.child_count, (0)::bigint) AS child_count,
1099
+ CASE
1100
+ WHEN (COALESCE(parent_data.parent_count, (0)::bigint) = 0) THEN true
1101
+ ELSE false
1102
+ END AS is_root_step,
1103
+ CASE
1104
+ WHEN (COALESCE(child_data.child_count, (0)::bigint) = 0) THEN true
1105
+ ELSE false
1106
+ END AS is_leaf_step,
1107
+ depth_info.min_depth_from_root
1108
+ FROM (((public.tasker_workflow_steps ws
1109
+ LEFT JOIN ( SELECT tasker_workflow_step_edges.to_step_id,
1110
+ jsonb_agg(tasker_workflow_step_edges.from_step_id ORDER BY tasker_workflow_step_edges.from_step_id) AS parent_ids,
1111
+ count(*) AS parent_count
1112
+ FROM public.tasker_workflow_step_edges
1113
+ GROUP BY tasker_workflow_step_edges.to_step_id) parent_data ON ((parent_data.to_step_id = ws.workflow_step_id)))
1114
+ LEFT JOIN ( SELECT tasker_workflow_step_edges.from_step_id,
1115
+ jsonb_agg(tasker_workflow_step_edges.to_step_id ORDER BY tasker_workflow_step_edges.to_step_id) AS child_ids,
1116
+ count(*) AS child_count
1117
+ FROM public.tasker_workflow_step_edges
1118
+ GROUP BY tasker_workflow_step_edges.from_step_id) child_data ON ((child_data.from_step_id = ws.workflow_step_id)))
1119
+ LEFT JOIN ( WITH RECURSIVE step_depths AS (
1120
+ SELECT ws_inner.workflow_step_id,
1121
+ 0 AS depth_from_root,
1122
+ ws_inner.task_id
1123
+ FROM public.tasker_workflow_steps ws_inner
1124
+ WHERE (NOT (EXISTS ( SELECT 1
1125
+ FROM public.tasker_workflow_step_edges e
1126
+ WHERE (e.to_step_id = ws_inner.workflow_step_id))))
1127
+ UNION ALL
1128
+ SELECT e.to_step_id,
1129
+ (sd.depth_from_root + 1),
1130
+ sd.task_id
1131
+ FROM (step_depths sd
1132
+ JOIN public.tasker_workflow_step_edges e ON ((e.from_step_id = sd.workflow_step_id)))
1133
+ WHERE (sd.depth_from_root < 50)
1134
+ )
1135
+ SELECT step_depths.workflow_step_id,
1136
+ min(step_depths.depth_from_root) AS min_depth_from_root
1137
+ FROM step_depths
1138
+ GROUP BY step_depths.workflow_step_id) depth_info ON ((depth_info.workflow_step_id = ws.workflow_step_id)));
1139
+
1140
+
1141
+ --
1142
+ -- Name: tasker_task_annotations; Type: TABLE; Schema: public; Owner: -
1143
+ --
1144
+
1145
+ CREATE TABLE public.tasker_task_annotations (
1146
+ task_annotation_id bigint NOT NULL,
1147
+ task_id bigint NOT NULL,
1148
+ annotation_type_id integer NOT NULL,
1149
+ annotation jsonb,
1150
+ created_at timestamp(6) without time zone NOT NULL,
1151
+ updated_at timestamp(6) without time zone NOT NULL
1152
+ );
1153
+
1154
+
1155
+ --
1156
+ -- Name: tasker_task_annotations_task_annotation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1157
+ --
1158
+
1159
+ CREATE SEQUENCE public.tasker_task_annotations_task_annotation_id_seq
1160
+ START WITH 1
1161
+ INCREMENT BY 1
1162
+ NO MINVALUE
1163
+ NO MAXVALUE
1164
+ CACHE 1;
1165
+
1166
+
1167
+ --
1168
+ -- Name: tasker_task_annotations_task_annotation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1169
+ --
1170
+
1171
+ ALTER SEQUENCE public.tasker_task_annotations_task_annotation_id_seq OWNED BY public.tasker_task_annotations.task_annotation_id;
1172
+
1173
+
1174
+ --
1175
+ -- Name: tasker_task_namespaces; Type: TABLE; Schema: public; Owner: -
1176
+ --
1177
+
1178
+ CREATE TABLE public.tasker_task_namespaces (
1179
+ task_namespace_id integer NOT NULL,
1180
+ name character varying(64) NOT NULL,
1181
+ description character varying(255),
1182
+ created_at timestamp(6) without time zone NOT NULL,
1183
+ updated_at timestamp(6) without time zone NOT NULL
1184
+ );
1185
+
1186
+
1187
+ --
1188
+ -- Name: tasker_task_namespaces_task_namespace_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1189
+ --
1190
+
1191
+ CREATE SEQUENCE public.tasker_task_namespaces_task_namespace_id_seq
1192
+ AS integer
1193
+ START WITH 1
1194
+ INCREMENT BY 1
1195
+ NO MINVALUE
1196
+ NO MAXVALUE
1197
+ CACHE 1;
1198
+
1199
+
1200
+ --
1201
+ -- Name: tasker_task_namespaces_task_namespace_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1202
+ --
1203
+
1204
+ ALTER SEQUENCE public.tasker_task_namespaces_task_namespace_id_seq OWNED BY public.tasker_task_namespaces.task_namespace_id;
1205
+
1206
+
1207
+ --
1208
+ -- Name: tasker_task_transitions; Type: TABLE; Schema: public; Owner: -
1209
+ --
1210
+
1211
+ CREATE TABLE public.tasker_task_transitions (
1212
+ id bigint NOT NULL,
1213
+ to_state character varying NOT NULL,
1214
+ from_state character varying,
1215
+ metadata jsonb DEFAULT '{}'::jsonb,
1216
+ sort_key integer NOT NULL,
1217
+ most_recent boolean DEFAULT true NOT NULL,
1218
+ task_id bigint NOT NULL,
1219
+ created_at timestamp(6) without time zone NOT NULL,
1220
+ updated_at timestamp(6) without time zone NOT NULL
1221
+ );
1222
+
1223
+
1224
+ --
1225
+ -- Name: tasker_task_transitions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1226
+ --
1227
+
1228
+ CREATE SEQUENCE public.tasker_task_transitions_id_seq
1229
+ START WITH 1
1230
+ INCREMENT BY 1
1231
+ NO MINVALUE
1232
+ NO MAXVALUE
1233
+ CACHE 1;
1234
+
1235
+
1236
+ --
1237
+ -- Name: tasker_task_transitions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1238
+ --
1239
+
1240
+ ALTER SEQUENCE public.tasker_task_transitions_id_seq OWNED BY public.tasker_task_transitions.id;
1241
+
1242
+
1243
+ --
1244
+ -- Name: tasker_tasks; Type: TABLE; Schema: public; Owner: -
1245
+ --
1246
+
1247
+ CREATE TABLE public.tasker_tasks (
1248
+ task_id bigint NOT NULL,
1249
+ named_task_id integer NOT NULL,
1250
+ complete boolean DEFAULT false NOT NULL,
1251
+ requested_at timestamp without time zone NOT NULL,
1252
+ initiator character varying(128),
1253
+ source_system character varying(128),
1254
+ reason character varying(128),
1255
+ bypass_steps json,
1256
+ tags jsonb,
1257
+ context jsonb,
1258
+ identity_hash character varying(128) NOT NULL,
1259
+ created_at timestamp(6) without time zone NOT NULL,
1260
+ updated_at timestamp(6) without time zone NOT NULL
1261
+ );
1262
+
1263
+
1264
+ --
1265
+ -- Name: tasker_tasks_task_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1266
+ --
1267
+
1268
+ CREATE SEQUENCE public.tasker_tasks_task_id_seq
1269
+ START WITH 1
1270
+ INCREMENT BY 1
1271
+ NO MINVALUE
1272
+ NO MAXVALUE
1273
+ CACHE 1;
1274
+
1275
+
1276
+ --
1277
+ -- Name: tasker_tasks_task_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1278
+ --
1279
+
1280
+ ALTER SEQUENCE public.tasker_tasks_task_id_seq OWNED BY public.tasker_tasks.task_id;
1281
+
1282
+
1283
+ --
1284
+ -- Name: tasker_workflow_step_edges_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1285
+ --
1286
+
1287
+ CREATE SEQUENCE public.tasker_workflow_step_edges_id_seq
1288
+ START WITH 1
1289
+ INCREMENT BY 1
1290
+ NO MINVALUE
1291
+ NO MAXVALUE
1292
+ CACHE 1;
1293
+
1294
+
1295
+ --
1296
+ -- Name: tasker_workflow_step_edges_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1297
+ --
1298
+
1299
+ ALTER SEQUENCE public.tasker_workflow_step_edges_id_seq OWNED BY public.tasker_workflow_step_edges.id;
1300
+
1301
+
1302
+ --
1303
+ -- Name: tasker_workflow_step_transitions; Type: TABLE; Schema: public; Owner: -
1304
+ --
1305
+
1306
+ CREATE TABLE public.tasker_workflow_step_transitions (
1307
+ id bigint NOT NULL,
1308
+ to_state character varying NOT NULL,
1309
+ from_state character varying,
1310
+ metadata jsonb DEFAULT '{}'::jsonb,
1311
+ sort_key integer NOT NULL,
1312
+ most_recent boolean DEFAULT true NOT NULL,
1313
+ workflow_step_id bigint NOT NULL,
1314
+ created_at timestamp(6) without time zone NOT NULL,
1315
+ updated_at timestamp(6) without time zone NOT NULL
1316
+ );
1317
+
1318
+
1319
+ --
1320
+ -- Name: tasker_workflow_step_transitions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1321
+ --
1322
+
1323
+ CREATE SEQUENCE public.tasker_workflow_step_transitions_id_seq
1324
+ START WITH 1
1325
+ INCREMENT BY 1
1326
+ NO MINVALUE
1327
+ NO MAXVALUE
1328
+ CACHE 1;
1329
+
1330
+
1331
+ --
1332
+ -- Name: tasker_workflow_step_transitions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1333
+ --
1334
+
1335
+ ALTER SEQUENCE public.tasker_workflow_step_transitions_id_seq OWNED BY public.tasker_workflow_step_transitions.id;
1336
+
1337
+
1338
+ --
1339
+ -- Name: tasker_workflow_steps_workflow_step_id_seq; Type: SEQUENCE; Schema: public; Owner: -
1340
+ --
1341
+
1342
+ CREATE SEQUENCE public.tasker_workflow_steps_workflow_step_id_seq
1343
+ START WITH 1
1344
+ INCREMENT BY 1
1345
+ NO MINVALUE
1346
+ NO MAXVALUE
1347
+ CACHE 1;
1348
+
1349
+
1350
+ --
1351
+ -- Name: tasker_workflow_steps_workflow_step_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
1352
+ --
1353
+
1354
+ ALTER SEQUENCE public.tasker_workflow_steps_workflow_step_id_seq OWNED BY public.tasker_workflow_steps.workflow_step_id;
1355
+
1356
+
1357
+ --
1358
+ -- Name: tasker_annotation_types annotation_type_id; Type: DEFAULT; Schema: public; Owner: -
1359
+ --
1360
+
1361
+ ALTER TABLE ONLY public.tasker_annotation_types ALTER COLUMN annotation_type_id SET DEFAULT nextval('public.tasker_annotation_types_annotation_type_id_seq'::regclass);
1362
+
1363
+
1364
+ --
1365
+ -- Name: tasker_dependent_system_object_maps dependent_system_object_map_id; Type: DEFAULT; Schema: public; Owner: -
1366
+ --
1367
+
1368
+ ALTER TABLE ONLY public.tasker_dependent_system_object_maps ALTER COLUMN dependent_system_object_map_id SET DEFAULT nextval('public.tasker_dependent_system_objec_dependent_system_object_map_i_seq'::regclass);
1369
+
1370
+
1371
+ --
1372
+ -- Name: tasker_dependent_systems dependent_system_id; Type: DEFAULT; Schema: public; Owner: -
1373
+ --
1374
+
1375
+ ALTER TABLE ONLY public.tasker_dependent_systems ALTER COLUMN dependent_system_id SET DEFAULT nextval('public.tasker_dependent_systems_dependent_system_id_seq'::regclass);
1376
+
1377
+
1378
+ --
1379
+ -- Name: tasker_named_steps named_step_id; Type: DEFAULT; Schema: public; Owner: -
1380
+ --
1381
+
1382
+ ALTER TABLE ONLY public.tasker_named_steps ALTER COLUMN named_step_id SET DEFAULT nextval('public.tasker_named_steps_named_step_id_seq'::regclass);
1383
+
1384
+
1385
+ --
1386
+ -- Name: tasker_named_tasks named_task_id; Type: DEFAULT; Schema: public; Owner: -
1387
+ --
1388
+
1389
+ ALTER TABLE ONLY public.tasker_named_tasks ALTER COLUMN named_task_id SET DEFAULT nextval('public.tasker_named_tasks_named_task_id_seq'::regclass);
1390
+
1391
+
1392
+ --
1393
+ -- Name: tasker_named_tasks_named_steps id; Type: DEFAULT; Schema: public; Owner: -
1394
+ --
1395
+
1396
+ ALTER TABLE ONLY public.tasker_named_tasks_named_steps ALTER COLUMN id SET DEFAULT nextval('public.tasker_named_tasks_named_steps_id_seq'::regclass);
1397
+
1398
+
1399
+ --
1400
+ -- Name: tasker_task_annotations task_annotation_id; Type: DEFAULT; Schema: public; Owner: -
1401
+ --
1402
+
1403
+ ALTER TABLE ONLY public.tasker_task_annotations ALTER COLUMN task_annotation_id SET DEFAULT nextval('public.tasker_task_annotations_task_annotation_id_seq'::regclass);
1404
+
1405
+
1406
+ --
1407
+ -- Name: tasker_task_namespaces task_namespace_id; Type: DEFAULT; Schema: public; Owner: -
1408
+ --
1409
+
1410
+ ALTER TABLE ONLY public.tasker_task_namespaces ALTER COLUMN task_namespace_id SET DEFAULT nextval('public.tasker_task_namespaces_task_namespace_id_seq'::regclass);
1411
+
1412
+
1413
+ --
1414
+ -- Name: tasker_task_transitions id; Type: DEFAULT; Schema: public; Owner: -
1415
+ --
1416
+
1417
+ ALTER TABLE ONLY public.tasker_task_transitions ALTER COLUMN id SET DEFAULT nextval('public.tasker_task_transitions_id_seq'::regclass);
1418
+
1419
+
1420
+ --
1421
+ -- Name: tasker_tasks task_id; Type: DEFAULT; Schema: public; Owner: -
1422
+ --
1423
+
1424
+ ALTER TABLE ONLY public.tasker_tasks ALTER COLUMN task_id SET DEFAULT nextval('public.tasker_tasks_task_id_seq'::regclass);
1425
+
1426
+
1427
+ --
1428
+ -- Name: tasker_workflow_step_edges id; Type: DEFAULT; Schema: public; Owner: -
1429
+ --
1430
+
1431
+ ALTER TABLE ONLY public.tasker_workflow_step_edges ALTER COLUMN id SET DEFAULT nextval('public.tasker_workflow_step_edges_id_seq'::regclass);
1432
+
1433
+
1434
+ --
1435
+ -- Name: tasker_workflow_step_transitions id; Type: DEFAULT; Schema: public; Owner: -
1436
+ --
1437
+
1438
+ ALTER TABLE ONLY public.tasker_workflow_step_transitions ALTER COLUMN id SET DEFAULT nextval('public.tasker_workflow_step_transitions_id_seq'::regclass);
1439
+
1440
+
1441
+ --
1442
+ -- Name: tasker_workflow_steps workflow_step_id; Type: DEFAULT; Schema: public; Owner: -
1443
+ --
1444
+
1445
+ ALTER TABLE ONLY public.tasker_workflow_steps ALTER COLUMN workflow_step_id SET DEFAULT nextval('public.tasker_workflow_steps_workflow_step_id_seq'::regclass);
1446
+
1447
+ --
1448
+ -- Name: tasker_annotation_types tasker_annotation_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1449
+ --
1450
+
1451
+ ALTER TABLE ONLY public.tasker_annotation_types
1452
+ ADD CONSTRAINT tasker_annotation_types_pkey PRIMARY KEY (annotation_type_id);
1453
+
1454
+
1455
+ --
1456
+ -- Name: tasker_dependent_system_object_maps tasker_dependent_system_object_maps_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1457
+ --
1458
+
1459
+ ALTER TABLE ONLY public.tasker_dependent_system_object_maps
1460
+ ADD CONSTRAINT tasker_dependent_system_object_maps_pkey PRIMARY KEY (dependent_system_object_map_id);
1461
+
1462
+
1463
+ --
1464
+ -- Name: tasker_dependent_systems tasker_dependent_systems_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1465
+ --
1466
+
1467
+ ALTER TABLE ONLY public.tasker_dependent_systems
1468
+ ADD CONSTRAINT tasker_dependent_systems_pkey PRIMARY KEY (dependent_system_id);
1469
+
1470
+
1471
+ --
1472
+ -- Name: tasker_named_steps tasker_named_steps_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1473
+ --
1474
+
1475
+ ALTER TABLE ONLY public.tasker_named_steps
1476
+ ADD CONSTRAINT tasker_named_steps_pkey PRIMARY KEY (named_step_id);
1477
+
1478
+
1479
+ --
1480
+ -- Name: tasker_named_tasks_named_steps tasker_named_tasks_named_steps_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1481
+ --
1482
+
1483
+ ALTER TABLE ONLY public.tasker_named_tasks_named_steps
1484
+ ADD CONSTRAINT tasker_named_tasks_named_steps_pkey PRIMARY KEY (id);
1485
+
1486
+
1487
+ --
1488
+ -- Name: tasker_named_tasks tasker_named_tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1489
+ --
1490
+
1491
+ ALTER TABLE ONLY public.tasker_named_tasks
1492
+ ADD CONSTRAINT tasker_named_tasks_pkey PRIMARY KEY (named_task_id);
1493
+
1494
+
1495
+ --
1496
+ -- Name: tasker_task_annotations tasker_task_annotations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1497
+ --
1498
+
1499
+ ALTER TABLE ONLY public.tasker_task_annotations
1500
+ ADD CONSTRAINT tasker_task_annotations_pkey PRIMARY KEY (task_annotation_id);
1501
+
1502
+
1503
+ --
1504
+ -- Name: tasker_task_namespaces tasker_task_namespaces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1505
+ --
1506
+
1507
+ ALTER TABLE ONLY public.tasker_task_namespaces
1508
+ ADD CONSTRAINT tasker_task_namespaces_pkey PRIMARY KEY (task_namespace_id);
1509
+
1510
+
1511
+ --
1512
+ -- Name: tasker_task_transitions tasker_task_transitions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1513
+ --
1514
+
1515
+ ALTER TABLE ONLY public.tasker_task_transitions
1516
+ ADD CONSTRAINT tasker_task_transitions_pkey PRIMARY KEY (id);
1517
+
1518
+
1519
+ --
1520
+ -- Name: tasker_tasks tasker_tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1521
+ --
1522
+
1523
+ ALTER TABLE ONLY public.tasker_tasks
1524
+ ADD CONSTRAINT tasker_tasks_pkey PRIMARY KEY (task_id);
1525
+
1526
+
1527
+ --
1528
+ -- Name: tasker_workflow_step_edges tasker_workflow_step_edges_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1529
+ --
1530
+
1531
+ ALTER TABLE ONLY public.tasker_workflow_step_edges
1532
+ ADD CONSTRAINT tasker_workflow_step_edges_pkey PRIMARY KEY (id);
1533
+
1534
+
1535
+ --
1536
+ -- Name: tasker_workflow_step_transitions tasker_workflow_step_transitions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1537
+ --
1538
+
1539
+ ALTER TABLE ONLY public.tasker_workflow_step_transitions
1540
+ ADD CONSTRAINT tasker_workflow_step_transitions_pkey PRIMARY KEY (id);
1541
+
1542
+
1543
+ --
1544
+ -- Name: tasker_workflow_steps tasker_workflow_steps_pkey; Type: CONSTRAINT; Schema: public; Owner: -
1545
+ --
1546
+
1547
+ ALTER TABLE ONLY public.tasker_workflow_steps
1548
+ ADD CONSTRAINT tasker_workflow_steps_pkey PRIMARY KEY (workflow_step_id);
1549
+
1550
+
1551
+ --
1552
+ -- Name: annotation_types_name_index; Type: INDEX; Schema: public; Owner: -
1553
+ --
1554
+
1555
+ CREATE INDEX annotation_types_name_index ON public.tasker_annotation_types USING btree (name);
1556
+
1557
+
1558
+ --
1559
+ -- Name: annotation_types_name_unique; Type: INDEX; Schema: public; Owner: -
1560
+ --
1561
+
1562
+ CREATE UNIQUE INDEX annotation_types_name_unique ON public.tasker_annotation_types USING btree (name);
1563
+
1564
+
1565
+ --
1566
+ -- Name: dependent_system_object_maps_dependent_system_one_id_dependent_; Type: INDEX; Schema: public; Owner: -
1567
+ --
1568
+
1569
+ CREATE UNIQUE INDEX dependent_system_object_maps_dependent_system_one_id_dependent_ ON public.tasker_dependent_system_object_maps USING btree (dependent_system_one_id, dependent_system_two_id, remote_id_one, remote_id_two);
1570
+
1571
+
1572
+ --
1573
+ -- Name: dependent_system_object_maps_dependent_system_one_id_index; Type: INDEX; Schema: public; Owner: -
1574
+ --
1575
+
1576
+ CREATE INDEX dependent_system_object_maps_dependent_system_one_id_index ON public.tasker_dependent_system_object_maps USING btree (dependent_system_one_id);
1577
+
1578
+
1579
+ --
1580
+ -- Name: dependent_system_object_maps_dependent_system_two_id_index; Type: INDEX; Schema: public; Owner: -
1581
+ --
1582
+
1583
+ CREATE INDEX dependent_system_object_maps_dependent_system_two_id_index ON public.tasker_dependent_system_object_maps USING btree (dependent_system_two_id);
1584
+
1585
+
1586
+ --
1587
+ -- Name: dependent_system_object_maps_remote_id_one_index; Type: INDEX; Schema: public; Owner: -
1588
+ --
1589
+
1590
+ CREATE INDEX dependent_system_object_maps_remote_id_one_index ON public.tasker_dependent_system_object_maps USING btree (remote_id_one);
1591
+
1592
+
1593
+ --
1594
+ -- Name: dependent_system_object_maps_remote_id_two_index; Type: INDEX; Schema: public; Owner: -
1595
+ --
1596
+
1597
+ CREATE INDEX dependent_system_object_maps_remote_id_two_index ON public.tasker_dependent_system_object_maps USING btree (remote_id_two);
1598
+
1599
+
1600
+ --
1601
+ -- Name: dependent_systems_name_index; Type: INDEX; Schema: public; Owner: -
1602
+ --
1603
+
1604
+ CREATE INDEX dependent_systems_name_index ON public.tasker_dependent_systems USING btree (name);
1605
+
1606
+
1607
+ --
1608
+ -- Name: dependent_systems_name_unique; Type: INDEX; Schema: public; Owner: -
1609
+ --
1610
+
1611
+ CREATE UNIQUE INDEX dependent_systems_name_unique ON public.tasker_dependent_systems USING btree (name);
1612
+
1613
+
1614
+ --
1615
+ -- Name: idx_on_workflow_step_id_most_recent_97d5374ad6; Type: INDEX; Schema: public; Owner: -
1616
+ --
1617
+
1618
+ CREATE UNIQUE INDEX idx_on_workflow_step_id_most_recent_97d5374ad6 ON public.tasker_workflow_step_transitions USING btree (workflow_step_id, most_recent) WHERE (most_recent = true);
1619
+
1620
+
1621
+ --
1622
+ -- Name: idx_on_workflow_step_id_sort_key_4d476d7adb; Type: INDEX; Schema: public; Owner: -
1623
+ --
1624
+
1625
+ CREATE UNIQUE INDEX idx_on_workflow_step_id_sort_key_4d476d7adb ON public.tasker_workflow_step_transitions USING btree (workflow_step_id, sort_key);
1626
+
1627
+
1628
+ --
1629
+ -- Name: idx_step_edges_from_to; Type: INDEX; Schema: public; Owner: -
1630
+ --
1631
+
1632
+ CREATE INDEX idx_step_edges_from_to ON public.tasker_workflow_step_edges USING btree (from_step_id, to_step_id);
1633
+
1634
+
1635
+ --
1636
+ -- Name: idx_step_edges_to_from; Type: INDEX; Schema: public; Owner: -
1637
+ --
1638
+
1639
+ CREATE INDEX idx_step_edges_to_from ON public.tasker_workflow_step_edges USING btree (to_step_id, from_step_id);
1640
+
1641
+
1642
+ --
1643
+ -- Name: idx_step_transitions_current_state; Type: INDEX; Schema: public; Owner: -
1644
+ --
1645
+
1646
+ CREATE INDEX idx_step_transitions_current_state ON public.tasker_workflow_step_transitions USING btree (workflow_step_id, most_recent, to_state) WHERE (most_recent = true);
1647
+
1648
+
1649
+ --
1650
+ -- Name: idx_step_transitions_most_recent; Type: INDEX; Schema: public; Owner: -
1651
+ --
1652
+
1653
+ CREATE INDEX idx_step_transitions_most_recent ON public.tasker_workflow_step_transitions USING btree (workflow_step_id, most_recent) WHERE (most_recent = true);
1654
+
1655
+
1656
+ --
1657
+ -- Name: idx_steps_active_operations; Type: INDEX; Schema: public; Owner: -
1658
+ --
1659
+
1660
+ CREATE INDEX idx_steps_active_operations ON public.tasker_workflow_steps USING btree (workflow_step_id, task_id) WHERE ((processed = false) OR (processed IS NULL));
1661
+
1662
+
1663
+ --
1664
+ -- Name: idx_task_transitions_most_recent; Type: INDEX; Schema: public; Owner: -
1665
+ --
1666
+
1667
+ CREATE INDEX idx_task_transitions_most_recent ON public.tasker_task_transitions USING btree (task_id, most_recent) WHERE (most_recent = true);
1668
+
1669
+
1670
+ --
1671
+ -- Name: idx_tasks_active_operations; Type: INDEX; Schema: public; Owner: -
1672
+ --
1673
+
1674
+ CREATE INDEX idx_tasks_active_operations ON public.tasker_tasks USING btree (task_id) WHERE ((complete = false) OR (complete IS NULL));
1675
+
1676
+
1677
+ --
1678
+ -- Name: idx_tasks_active_workflow_summary; Type: INDEX; Schema: public; Owner: -
1679
+ --
1680
+
1681
+ CREATE INDEX idx_tasks_active_workflow_summary ON public.tasker_tasks USING btree (task_id, complete) WHERE ((complete = false) OR (complete IS NULL));
1682
+
1683
+
1684
+ --
1685
+ -- Name: idx_tasks_completion_status_created; Type: INDEX; Schema: public; Owner: -
1686
+ --
1687
+
1688
+ CREATE INDEX idx_tasks_completion_status_created ON public.tasker_tasks USING btree (complete, created_at, task_id);
1689
+
1690
+
1691
+ --
1692
+ -- Name: idx_workflow_step_edges_dependency_lookup; Type: INDEX; Schema: public; Owner: -
1693
+ --
1694
+
1695
+ CREATE INDEX idx_workflow_step_edges_dependency_lookup ON public.tasker_workflow_step_edges USING btree (to_step_id, from_step_id);
1696
+
1697
+
1698
+ --
1699
+ -- Name: idx_workflow_steps_task_grouping_active; Type: INDEX; Schema: public; Owner: -
1700
+ --
1701
+
1702
+ CREATE INDEX idx_workflow_steps_task_grouping_active ON public.tasker_workflow_steps USING btree (task_id, workflow_step_id) WHERE ((processed = false) OR (processed IS NULL));
1703
+
1704
+
1705
+ --
1706
+ -- Name: idx_workflow_steps_task_readiness; Type: INDEX; Schema: public; Owner: -
1707
+ --
1708
+
1709
+ CREATE INDEX idx_workflow_steps_task_readiness ON public.tasker_workflow_steps USING btree (task_id, processed, workflow_step_id) WHERE (processed = false);
1710
+
1711
+
1712
+ --
1713
+ -- Name: index_step_edges_child_lookup; Type: INDEX; Schema: public; Owner: -
1714
+ --
1715
+
1716
+ CREATE INDEX index_step_edges_child_lookup ON public.tasker_workflow_step_edges USING btree (to_step_id);
1717
+
1718
+
1719
+ --
1720
+ -- Name: index_step_edges_dependency_pair; Type: INDEX; Schema: public; Owner: -
1721
+ --
1722
+
1723
+ CREATE INDEX index_step_edges_dependency_pair ON public.tasker_workflow_step_edges USING btree (to_step_id, from_step_id);
1724
+
1725
+
1726
+ --
1727
+ -- Name: index_step_edges_from_step_for_children; Type: INDEX; Schema: public; Owner: -
1728
+ --
1729
+
1730
+ CREATE INDEX index_step_edges_from_step_for_children ON public.tasker_workflow_step_edges USING btree (from_step_id);
1731
+
1732
+
1733
+ --
1734
+ -- Name: index_step_edges_from_to_composite; Type: INDEX; Schema: public; Owner: -
1735
+ --
1736
+
1737
+ CREATE INDEX index_step_edges_from_to_composite ON public.tasker_workflow_step_edges USING btree (from_step_id, to_step_id);
1738
+
1739
+
1740
+ --
1741
+ -- Name: index_step_edges_parent_lookup; Type: INDEX; Schema: public; Owner: -
1742
+ --
1743
+
1744
+ CREATE INDEX index_step_edges_parent_lookup ON public.tasker_workflow_step_edges USING btree (from_step_id);
1745
+
1746
+
1747
+ --
1748
+ -- Name: index_step_edges_to_from_composite; Type: INDEX; Schema: public; Owner: -
1749
+ --
1750
+
1751
+ CREATE INDEX index_step_edges_to_from_composite ON public.tasker_workflow_step_edges USING btree (to_step_id, from_step_id);
1752
+
1753
+
1754
+ --
1755
+ -- Name: index_step_edges_to_step_for_parents; Type: INDEX; Schema: public; Owner: -
1756
+ --
1757
+
1758
+ CREATE INDEX index_step_edges_to_step_for_parents ON public.tasker_workflow_step_edges USING btree (to_step_id);
1759
+
1760
+
1761
+ --
1762
+ -- Name: index_step_transitions_completed; Type: INDEX; Schema: public; Owner: -
1763
+ --
1764
+
1765
+ CREATE INDEX index_step_transitions_completed ON public.tasker_workflow_step_transitions USING btree (workflow_step_id, to_state) WHERE ((to_state)::text = 'complete'::text);
1766
+
1767
+
1768
+ --
1769
+ -- Name: index_step_transitions_completed_parents; Type: INDEX; Schema: public; Owner: -
1770
+ --
1771
+
1772
+ CREATE INDEX index_step_transitions_completed_parents ON public.tasker_workflow_step_transitions USING btree (workflow_step_id, most_recent) WHERE (((to_state)::text = ANY ((ARRAY['complete'::character varying, 'resolved_manually'::character varying])::text[])) AND (most_recent = true));
1773
+
1774
+
1775
+ --
1776
+ -- Name: index_step_transitions_current_errors; Type: INDEX; Schema: public; Owner: -
1777
+ --
1778
+
1779
+ CREATE INDEX index_step_transitions_current_errors ON public.tasker_workflow_step_transitions USING btree (workflow_step_id, most_recent, created_at) WHERE (((to_state)::text = 'error'::text) AND (most_recent = true));
1780
+
1781
+
1782
+ --
1783
+ -- Name: index_step_transitions_current_state_optimized; Type: INDEX; Schema: public; Owner: -
1784
+ --
1785
+
1786
+ CREATE INDEX index_step_transitions_current_state_optimized ON public.tasker_workflow_step_transitions USING btree (workflow_step_id, most_recent) WHERE (most_recent = true);
1787
+
1788
+
1789
+ --
1790
+ -- Name: index_step_transitions_failures_with_timing; Type: INDEX; Schema: public; Owner: -
1791
+ --
1792
+
1793
+ CREATE INDEX index_step_transitions_failures_with_timing ON public.tasker_workflow_step_transitions USING btree (workflow_step_id, to_state, created_at) WHERE ((to_state)::text = 'failed'::text);
1794
+
1795
+
1796
+ --
1797
+ -- Name: index_step_transitions_for_current_state; Type: INDEX; Schema: public; Owner: -
1798
+ --
1799
+
1800
+ CREATE INDEX index_step_transitions_for_current_state ON public.tasker_workflow_step_transitions USING btree (workflow_step_id, created_at);
1801
+
1802
+
1803
+ --
1804
+ -- Name: index_task_transitions_current_state; Type: INDEX; Schema: public; Owner: -
1805
+ --
1806
+
1807
+ CREATE INDEX index_task_transitions_current_state ON public.tasker_task_transitions USING btree (task_id, created_at);
1808
+
1809
+
1810
+ --
1811
+ -- Name: index_task_transitions_current_state_optimized; Type: INDEX; Schema: public; Owner: -
1812
+ --
1813
+
1814
+ CREATE INDEX index_task_transitions_current_state_optimized ON public.tasker_task_transitions USING btree (task_id, most_recent) WHERE (most_recent = true);
1815
+
1816
+
1817
+ --
1818
+ -- Name: index_tasker_task_transitions_on_sort_key; Type: INDEX; Schema: public; Owner: -
1819
+ --
1820
+
1821
+ CREATE INDEX index_tasker_task_transitions_on_sort_key ON public.tasker_task_transitions USING btree (sort_key);
1822
+
1823
+
1824
+ --
1825
+ -- Name: index_tasker_task_transitions_on_task_id; Type: INDEX; Schema: public; Owner: -
1826
+ --
1827
+
1828
+ CREATE INDEX index_tasker_task_transitions_on_task_id ON public.tasker_task_transitions USING btree (task_id);
1829
+
1830
+
1831
+ --
1832
+ -- Name: index_tasker_task_transitions_on_task_id_and_most_recent; Type: INDEX; Schema: public; Owner: -
1833
+ --
1834
+
1835
+ CREATE UNIQUE INDEX index_tasker_task_transitions_on_task_id_and_most_recent ON public.tasker_task_transitions USING btree (task_id, most_recent) WHERE (most_recent = true);
1836
+
1837
+
1838
+ --
1839
+ -- Name: index_tasker_task_transitions_on_task_id_and_sort_key; Type: INDEX; Schema: public; Owner: -
1840
+ --
1841
+
1842
+ CREATE UNIQUE INDEX index_tasker_task_transitions_on_task_id_and_sort_key ON public.tasker_task_transitions USING btree (task_id, sort_key);
1843
+
1844
+
1845
+ --
1846
+ -- Name: index_tasker_workflow_step_edges_on_from_step_id; Type: INDEX; Schema: public; Owner: -
1847
+ --
1848
+
1849
+ CREATE INDEX index_tasker_workflow_step_edges_on_from_step_id ON public.tasker_workflow_step_edges USING btree (from_step_id);
1850
+
1851
+
1852
+ --
1853
+ -- Name: index_tasker_workflow_step_edges_on_to_step_id; Type: INDEX; Schema: public; Owner: -
1854
+ --
1855
+
1856
+ CREATE INDEX index_tasker_workflow_step_edges_on_to_step_id ON public.tasker_workflow_step_edges USING btree (to_step_id);
1857
+
1858
+
1859
+ --
1860
+ -- Name: index_tasker_workflow_step_transitions_on_sort_key; Type: INDEX; Schema: public; Owner: -
1861
+ --
1862
+
1863
+ CREATE INDEX index_tasker_workflow_step_transitions_on_sort_key ON public.tasker_workflow_step_transitions USING btree (sort_key);
1864
+
1865
+
1866
+ --
1867
+ -- Name: index_tasker_workflow_step_transitions_on_workflow_step_id; Type: INDEX; Schema: public; Owner: -
1868
+ --
1869
+
1870
+ CREATE INDEX index_tasker_workflow_step_transitions_on_workflow_step_id ON public.tasker_workflow_step_transitions USING btree (workflow_step_id);
1871
+
1872
+
1873
+ --
1874
+ -- Name: index_tasks_on_identity_hash; Type: INDEX; Schema: public; Owner: -
1875
+ --
1876
+
1877
+ CREATE UNIQUE INDEX index_tasks_on_identity_hash ON public.tasker_tasks USING btree (identity_hash);
1878
+
1879
+
1880
+ --
1881
+ -- Name: index_workflow_step_edges_dependency_lookup; Type: INDEX; Schema: public; Owner: -
1882
+ --
1883
+
1884
+ CREATE INDEX index_workflow_step_edges_dependency_lookup ON public.tasker_workflow_step_edges USING btree (to_step_id, from_step_id);
1885
+
1886
+
1887
+ --
1888
+ -- Name: index_workflow_steps_backoff_timing; Type: INDEX; Schema: public; Owner: -
1889
+ --
1890
+
1891
+ CREATE INDEX index_workflow_steps_backoff_timing ON public.tasker_workflow_steps USING btree (last_attempted_at, backoff_request_seconds) WHERE (backoff_request_seconds IS NOT NULL);
1892
+
1893
+
1894
+ --
1895
+ -- Name: index_workflow_steps_by_task; Type: INDEX; Schema: public; Owner: -
1896
+ --
1897
+
1898
+ CREATE INDEX index_workflow_steps_by_task ON public.tasker_workflow_steps USING btree (task_id);
1899
+
1900
+
1901
+ --
1902
+ -- Name: index_workflow_steps_processing_status; Type: INDEX; Schema: public; Owner: -
1903
+ --
1904
+
1905
+ CREATE INDEX index_workflow_steps_processing_status ON public.tasker_workflow_steps USING btree (task_id, processed, in_process);
1906
+
1907
+
1908
+ --
1909
+ -- Name: index_workflow_steps_retry_logic; Type: INDEX; Schema: public; Owner: -
1910
+ --
1911
+
1912
+ CREATE INDEX index_workflow_steps_retry_logic ON public.tasker_workflow_steps USING btree (attempts, retry_limit, retryable);
1913
+
1914
+
1915
+ --
1916
+ -- Name: index_workflow_steps_retry_status; Type: INDEX; Schema: public; Owner: -
1917
+ --
1918
+
1919
+ CREATE INDEX index_workflow_steps_retry_status ON public.tasker_workflow_steps USING btree (attempts, retry_limit);
1920
+
1921
+
1922
+ --
1923
+ -- Name: index_workflow_steps_task_and_id; Type: INDEX; Schema: public; Owner: -
1924
+ --
1925
+
1926
+ CREATE INDEX index_workflow_steps_task_and_id ON public.tasker_workflow_steps USING btree (task_id, workflow_step_id);
1927
+
1928
+
1929
+ --
1930
+ -- Name: index_workflow_steps_task_and_step_id; Type: INDEX; Schema: public; Owner: -
1931
+ --
1932
+
1933
+ CREATE INDEX index_workflow_steps_task_and_step_id ON public.tasker_workflow_steps USING btree (task_id, workflow_step_id);
1934
+
1935
+
1936
+ --
1937
+ -- Name: index_workflow_steps_task_and_step_optimized; Type: INDEX; Schema: public; Owner: -
1938
+ --
1939
+
1940
+ CREATE INDEX index_workflow_steps_task_and_step_optimized ON public.tasker_workflow_steps USING btree (task_id, workflow_step_id);
1941
+
1942
+
1943
+ --
1944
+ -- Name: index_workflow_steps_task_covering; Type: INDEX; Schema: public; Owner: -
1945
+ --
1946
+
1947
+ CREATE INDEX index_workflow_steps_task_covering ON public.tasker_workflow_steps USING btree (task_id) INCLUDE (workflow_step_id, processed, in_process, attempts, retry_limit);
1948
+
1949
+
1950
+ --
1951
+ -- Name: named_step_by_system_uniq; Type: INDEX; Schema: public; Owner: -
1952
+ --
1953
+
1954
+ CREATE UNIQUE INDEX named_step_by_system_uniq ON public.tasker_named_steps USING btree (dependent_system_id, name);
1955
+
1956
+
1957
+ --
1958
+ -- Name: named_steps_dependent_system_id_index; Type: INDEX; Schema: public; Owner: -
1959
+ --
1960
+
1961
+ CREATE INDEX named_steps_dependent_system_id_index ON public.tasker_named_steps USING btree (dependent_system_id);
1962
+
1963
+
1964
+ --
1965
+ -- Name: named_steps_name_index; Type: INDEX; Schema: public; Owner: -
1966
+ --
1967
+
1968
+ CREATE INDEX named_steps_name_index ON public.tasker_named_steps USING btree (name);
1969
+
1970
+
1971
+ --
1972
+ -- Name: named_tasks_configuration_gin_index; Type: INDEX; Schema: public; Owner: -
1973
+ --
1974
+
1975
+ CREATE INDEX named_tasks_configuration_gin_index ON public.tasker_named_tasks USING gin (configuration);
1976
+
1977
+
1978
+ --
1979
+ -- Name: named_tasks_name_index; Type: INDEX; Schema: public; Owner: -
1980
+ --
1981
+
1982
+ CREATE INDEX named_tasks_name_index ON public.tasker_named_tasks USING btree (name);
1983
+
1984
+
1985
+ --
1986
+ -- Name: named_tasks_named_steps_named_step_id_index; Type: INDEX; Schema: public; Owner: -
1987
+ --
1988
+
1989
+ CREATE INDEX named_tasks_named_steps_named_step_id_index ON public.tasker_named_tasks_named_steps USING btree (named_step_id);
1990
+
1991
+
1992
+ --
1993
+ -- Name: named_tasks_named_steps_named_task_id_index; Type: INDEX; Schema: public; Owner: -
1994
+ --
1995
+
1996
+ CREATE INDEX named_tasks_named_steps_named_task_id_index ON public.tasker_named_tasks_named_steps USING btree (named_task_id);
1997
+
1998
+
1999
+ --
2000
+ -- Name: named_tasks_namespace_name_version_unique; Type: INDEX; Schema: public; Owner: -
2001
+ --
2002
+
2003
+ CREATE UNIQUE INDEX named_tasks_namespace_name_version_unique ON public.tasker_named_tasks USING btree (task_namespace_id, name, version);
2004
+
2005
+
2006
+ --
2007
+ -- Name: named_tasks_steps_ids_unique; Type: INDEX; Schema: public; Owner: -
2008
+ --
2009
+
2010
+ CREATE UNIQUE INDEX named_tasks_steps_ids_unique ON public.tasker_named_tasks_named_steps USING btree (named_task_id, named_step_id);
2011
+
2012
+
2013
+ --
2014
+ -- Name: named_tasks_task_namespace_id_index; Type: INDEX; Schema: public; Owner: -
2015
+ --
2016
+
2017
+ CREATE INDEX named_tasks_task_namespace_id_index ON public.tasker_named_tasks USING btree (task_namespace_id);
2018
+
2019
+
2020
+ --
2021
+ -- Name: named_tasks_version_index; Type: INDEX; Schema: public; Owner: -
2022
+ --
2023
+
2024
+ CREATE INDEX named_tasks_version_index ON public.tasker_named_tasks USING btree (version);
2025
+
2026
+
2027
+ --
2028
+ -- Name: task_annotations_annotation_idx; Type: INDEX; Schema: public; Owner: -
2029
+ --
2030
+
2031
+ CREATE INDEX task_annotations_annotation_idx ON public.tasker_task_annotations USING gin (annotation);
2032
+
2033
+
2034
+ --
2035
+ -- Name: task_annotations_annotation_idx1; Type: INDEX; Schema: public; Owner: -
2036
+ --
2037
+
2038
+ CREATE INDEX task_annotations_annotation_idx1 ON public.tasker_task_annotations USING gin (annotation jsonb_path_ops);
2039
+
2040
+
2041
+ --
2042
+ -- Name: task_annotations_annotation_type_id_index; Type: INDEX; Schema: public; Owner: -
2043
+ --
2044
+
2045
+ CREATE INDEX task_annotations_annotation_type_id_index ON public.tasker_task_annotations USING btree (annotation_type_id);
2046
+
2047
+
2048
+ --
2049
+ -- Name: task_annotations_task_id_index; Type: INDEX; Schema: public; Owner: -
2050
+ --
2051
+
2052
+ CREATE INDEX task_annotations_task_id_index ON public.tasker_task_annotations USING btree (task_id);
2053
+
2054
+
2055
+ --
2056
+ -- Name: task_namespaces_name_index; Type: INDEX; Schema: public; Owner: -
2057
+ --
2058
+
2059
+ CREATE INDEX task_namespaces_name_index ON public.tasker_task_namespaces USING btree (name);
2060
+
2061
+
2062
+ --
2063
+ -- Name: task_namespaces_name_unique; Type: INDEX; Schema: public; Owner: -
2064
+ --
2065
+
2066
+ CREATE UNIQUE INDEX task_namespaces_name_unique ON public.tasker_task_namespaces USING btree (name);
2067
+
2068
+
2069
+ --
2070
+ -- Name: tasks_context_idx; Type: INDEX; Schema: public; Owner: -
2071
+ --
2072
+
2073
+ CREATE INDEX tasks_context_idx ON public.tasker_tasks USING gin (context);
2074
+
2075
+
2076
+ --
2077
+ -- Name: tasks_context_idx1; Type: INDEX; Schema: public; Owner: -
2078
+ --
2079
+
2080
+ CREATE INDEX tasks_context_idx1 ON public.tasker_tasks USING gin (context jsonb_path_ops);
2081
+
2082
+
2083
+ --
2084
+ -- Name: tasks_identity_hash_index; Type: INDEX; Schema: public; Owner: -
2085
+ --
2086
+
2087
+ CREATE INDEX tasks_identity_hash_index ON public.tasker_tasks USING btree (identity_hash);
2088
+
2089
+
2090
+ --
2091
+ -- Name: tasks_named_task_id_index; Type: INDEX; Schema: public; Owner: -
2092
+ --
2093
+
2094
+ CREATE INDEX tasks_named_task_id_index ON public.tasker_tasks USING btree (named_task_id);
2095
+
2096
+
2097
+ --
2098
+ -- Name: tasks_requested_at_index; Type: INDEX; Schema: public; Owner: -
2099
+ --
2100
+
2101
+ CREATE INDEX tasks_requested_at_index ON public.tasker_tasks USING btree (requested_at);
2102
+
2103
+
2104
+ --
2105
+ -- Name: tasks_source_system_index; Type: INDEX; Schema: public; Owner: -
2106
+ --
2107
+
2108
+ CREATE INDEX tasks_source_system_index ON public.tasker_tasks USING btree (source_system);
2109
+
2110
+
2111
+ --
2112
+ -- Name: tasks_tags_idx; Type: INDEX; Schema: public; Owner: -
2113
+ --
2114
+
2115
+ CREATE INDEX tasks_tags_idx ON public.tasker_tasks USING gin (tags);
2116
+
2117
+
2118
+ --
2119
+ -- Name: tasks_tags_idx1; Type: INDEX; Schema: public; Owner: -
2120
+ --
2121
+
2122
+ CREATE INDEX tasks_tags_idx1 ON public.tasker_tasks USING gin (tags jsonb_path_ops);
2123
+
2124
+
2125
+ --
2126
+ -- Name: workflow_steps_last_attempted_at_index; Type: INDEX; Schema: public; Owner: -
2127
+ --
2128
+
2129
+ CREATE INDEX workflow_steps_last_attempted_at_index ON public.tasker_workflow_steps USING btree (last_attempted_at);
2130
+
2131
+
2132
+ --
2133
+ -- Name: workflow_steps_named_step_id_index; Type: INDEX; Schema: public; Owner: -
2134
+ --
2135
+
2136
+ CREATE INDEX workflow_steps_named_step_id_index ON public.tasker_workflow_steps USING btree (named_step_id);
2137
+
2138
+
2139
+ --
2140
+ -- Name: workflow_steps_processed_at_index; Type: INDEX; Schema: public; Owner: -
2141
+ --
2142
+
2143
+ CREATE INDEX workflow_steps_processed_at_index ON public.tasker_workflow_steps USING btree (processed_at);
2144
+
2145
+
2146
+ --
2147
+ -- Name: workflow_steps_task_id_index; Type: INDEX; Schema: public; Owner: -
2148
+ --
2149
+
2150
+ CREATE INDEX workflow_steps_task_id_index ON public.tasker_workflow_steps USING btree (task_id);
2151
+
2152
+
2153
+ --
2154
+ -- Name: tasker_dependent_system_object_maps dependent_system_object_maps_dependent_system_one_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
2155
+ --
2156
+
2157
+ ALTER TABLE ONLY public.tasker_dependent_system_object_maps
2158
+ ADD CONSTRAINT dependent_system_object_maps_dependent_system_one_id_foreign FOREIGN KEY (dependent_system_one_id) REFERENCES public.tasker_dependent_systems(dependent_system_id);
2159
+
2160
+
2161
+ --
2162
+ -- Name: tasker_dependent_system_object_maps dependent_system_object_maps_dependent_system_two_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
2163
+ --
2164
+
2165
+ ALTER TABLE ONLY public.tasker_dependent_system_object_maps
2166
+ ADD CONSTRAINT dependent_system_object_maps_dependent_system_two_id_foreign FOREIGN KEY (dependent_system_two_id) REFERENCES public.tasker_dependent_systems(dependent_system_id);
2167
+
2168
+
2169
+ --
2170
+ -- Name: tasker_named_tasks fk_rails_16a0297759; Type: FK CONSTRAINT; Schema: public; Owner: -
2171
+ --
2172
+
2173
+ ALTER TABLE ONLY public.tasker_named_tasks
2174
+ ADD CONSTRAINT fk_rails_16a0297759 FOREIGN KEY (task_namespace_id) REFERENCES public.tasker_task_namespaces(task_namespace_id);
2175
+
2176
+
2177
+ --
2178
+ -- Name: tasker_workflow_step_transitions fk_rails_6e0f6eb833; Type: FK CONSTRAINT; Schema: public; Owner: -
2179
+ --
2180
+
2181
+ ALTER TABLE ONLY public.tasker_workflow_step_transitions
2182
+ ADD CONSTRAINT fk_rails_6e0f6eb833 FOREIGN KEY (workflow_step_id) REFERENCES public.tasker_workflow_steps(workflow_step_id);
2183
+
2184
+
2185
+ --
2186
+ -- Name: tasker_workflow_step_edges fk_rails_7b4652ccf2; Type: FK CONSTRAINT; Schema: public; Owner: -
2187
+ --
2188
+
2189
+ ALTER TABLE ONLY public.tasker_workflow_step_edges
2190
+ ADD CONSTRAINT fk_rails_7b4652ccf2 FOREIGN KEY (from_step_id) REFERENCES public.tasker_workflow_steps(workflow_step_id);
2191
+
2192
+
2193
+ --
2194
+ -- Name: tasker_workflow_step_edges fk_rails_93ec0bf6eb; Type: FK CONSTRAINT; Schema: public; Owner: -
2195
+ --
2196
+
2197
+ ALTER TABLE ONLY public.tasker_workflow_step_edges
2198
+ ADD CONSTRAINT fk_rails_93ec0bf6eb FOREIGN KEY (to_step_id) REFERENCES public.tasker_workflow_steps(workflow_step_id);
2199
+
2200
+
2201
+ --
2202
+ -- Name: tasker_task_transitions fk_rails_e8caec803c; Type: FK CONSTRAINT; Schema: public; Owner: -
2203
+ --
2204
+
2205
+ ALTER TABLE ONLY public.tasker_task_transitions
2206
+ ADD CONSTRAINT fk_rails_e8caec803c FOREIGN KEY (task_id) REFERENCES public.tasker_tasks(task_id);
2207
+
2208
+
2209
+ --
2210
+ -- Name: tasker_named_steps named_steps_dependent_system_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
2211
+ --
2212
+
2213
+ ALTER TABLE ONLY public.tasker_named_steps
2214
+ ADD CONSTRAINT named_steps_dependent_system_id_foreign FOREIGN KEY (dependent_system_id) REFERENCES public.tasker_dependent_systems(dependent_system_id);
2215
+
2216
+
2217
+ --
2218
+ -- Name: tasker_named_tasks_named_steps named_tasks_named_steps_named_step_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
2219
+ --
2220
+
2221
+ ALTER TABLE ONLY public.tasker_named_tasks_named_steps
2222
+ ADD CONSTRAINT named_tasks_named_steps_named_step_id_foreign FOREIGN KEY (named_step_id) REFERENCES public.tasker_named_steps(named_step_id);
2223
+
2224
+
2225
+ --
2226
+ -- Name: tasker_named_tasks_named_steps named_tasks_named_steps_named_task_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
2227
+ --
2228
+
2229
+ ALTER TABLE ONLY public.tasker_named_tasks_named_steps
2230
+ ADD CONSTRAINT named_tasks_named_steps_named_task_id_foreign FOREIGN KEY (named_task_id) REFERENCES public.tasker_named_tasks(named_task_id);
2231
+
2232
+
2233
+ --
2234
+ -- Name: tasker_task_annotations task_annotations_annotation_type_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
2235
+ --
2236
+
2237
+ ALTER TABLE ONLY public.tasker_task_annotations
2238
+ ADD CONSTRAINT task_annotations_annotation_type_id_foreign FOREIGN KEY (annotation_type_id) REFERENCES public.tasker_annotation_types(annotation_type_id);
2239
+
2240
+
2241
+ --
2242
+ -- Name: tasker_task_annotations task_annotations_task_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
2243
+ --
2244
+
2245
+ ALTER TABLE ONLY public.tasker_task_annotations
2246
+ ADD CONSTRAINT task_annotations_task_id_foreign FOREIGN KEY (task_id) REFERENCES public.tasker_tasks(task_id);
2247
+
2248
+
2249
+ --
2250
+ -- Name: tasker_tasks tasks_named_task_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
2251
+ --
2252
+
2253
+ ALTER TABLE ONLY public.tasker_tasks
2254
+ ADD CONSTRAINT tasks_named_task_id_foreign FOREIGN KEY (named_task_id) REFERENCES public.tasker_named_tasks(named_task_id);
2255
+
2256
+
2257
+ --
2258
+ -- Name: tasker_workflow_steps workflow_steps_named_step_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
2259
+ --
2260
+
2261
+ ALTER TABLE ONLY public.tasker_workflow_steps
2262
+ ADD CONSTRAINT workflow_steps_named_step_id_foreign FOREIGN KEY (named_step_id) REFERENCES public.tasker_named_steps(named_step_id);
2263
+
2264
+
2265
+ --
2266
+ -- Name: tasker_workflow_steps workflow_steps_task_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: -
2267
+ --
2268
+
2269
+ ALTER TABLE ONLY public.tasker_workflow_steps
2270
+ ADD CONSTRAINT workflow_steps_task_id_foreign FOREIGN KEY (task_id) REFERENCES public.tasker_tasks(task_id);
2271
+
2272
+
2273
+ --
2274
+ -- PostgreSQL database dump complete
2275
+ --
2276
+
2277
+ SET search_path TO "$user", public;