From 239b16412eff861283c57a0a9a49267f35f6953d Mon Sep 17 00:00:00 2001 From: Patrick Schalk Date: Mon, 1 Jul 2024 17:49:45 +0200 Subject: [PATCH] Added new simple example which uses simple polyflow view --- scenarios/pom.xml | 1 + scenarios/single-node-simple/pom.xml | 141 ++ ...ngleNodeSimpleExampleProcessApplication.kt | 113 ++ .../polyflow/serializer/gdpr/GdprData.kt | 3 + .../gdpr/GdprSerializationPocConfiguration.kt | 4 + .../serializer/gdpr/GdprSerializer.kt | 25 + .../serializer/gdpr/MyMessageInterceptor.kt | 17 + .../serializer/gdpr/ProtectionStrategy.kt | 17 + .../src/main/resources/application.yml | 149 ++ .../src/main/resources/banner.txt | 23 + .../h2-postgresql/V0_0_10__axon_dlq.sql | 26 + .../V0_0_11__postgres_engine_7.16_to_7.17.sql | 29 + .../V0_0_12__postgres_engine_7.17_to_7.18.sql | 34 + .../V0_0_13__polyflow_deleted.sql | 2 + .../V0_0_14__axon_sequences_per_table.sql | 5 + .../V0_0_15__postgres_engine_7.18_to_7.21.sql | 27 + ...0_16__jpa_view_task_data_entry_payload.sql | 6 + ..._0_17__jpa_plf_data_entry_correlations.sql | 23 + .../V0_0_1__postgres_engine_7.14.0.sql | 1378 +++++++++++++++++ .../V0_0_2__postgres_identity_7.14.0.sql | 109 ++ .../h2-postgresql/V0_0_3__admin.sql | 46 + .../V0_0_4__tasklist filters.sql | 7 + .../migrations/h2-postgresql/V0_0_5__axon.sql | 75 + .../h2-postgresql/V0_0_6__request.sql | 9 + .../V0_0_7__postgres_engine_7.14_to_7.15.sql | 37 + .../h2-postgresql/V0_0_8__jpa_view.sql | 163 ++ .../V0_0_9__postgres_engine_7.15_to_7.16.sql | 30 + .../SingleNodeScenarioContextStartIT.kt | 21 + .../AnnotationBasedDetectionStrategyTest.kt | 5 + .../src/test/resources/application-itest.yml | 1 + .../src/test/resources/banner.txt | 4 + 31 files changed, 2530 insertions(+) create mode 100755 scenarios/single-node-simple/pom.xml create mode 100755 scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/example/process/approval/SingleNodeSimpleExampleProcessApplication.kt create mode 100644 scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/GdprData.kt create mode 100644 scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/GdprSerializationPocConfiguration.kt create mode 100644 scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/GdprSerializer.kt create mode 100644 scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/MyMessageInterceptor.kt create mode 100644 scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/ProtectionStrategy.kt create mode 100755 scenarios/single-node-simple/src/main/resources/application.yml create mode 100644 scenarios/single-node-simple/src/main/resources/banner.txt create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_10__axon_dlq.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_11__postgres_engine_7.16_to_7.17.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_12__postgres_engine_7.17_to_7.18.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_13__polyflow_deleted.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_14__axon_sequences_per_table.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_15__postgres_engine_7.18_to_7.21.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_16__jpa_view_task_data_entry_payload.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_17__jpa_plf_data_entry_correlations.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_1__postgres_engine_7.14.0.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_2__postgres_identity_7.14.0.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_3__admin.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_4__tasklist filters.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_5__axon.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_6__request.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_7__postgres_engine_7.14_to_7.15.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_8__jpa_view.sql create mode 100644 scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_9__postgres_engine_7.15_to_7.16.sql create mode 100644 scenarios/single-node-simple/src/test/kotlin/io/holunda/polyflow/example/process/approval/SingleNodeScenarioContextStartIT.kt create mode 100644 scenarios/single-node-simple/src/test/kotlin/io/holunda/polyflow/serializer/gdpr/AnnotationBasedDetectionStrategyTest.kt create mode 100755 scenarios/single-node-simple/src/test/resources/application-itest.yml create mode 100644 scenarios/single-node-simple/src/test/resources/banner.txt diff --git a/scenarios/pom.xml b/scenarios/pom.xml index 890558f9..22e2bee5 100755 --- a/scenarios/pom.xml +++ b/scenarios/pom.xml @@ -18,6 +18,7 @@ + single-node-simple single-node-jpa single-node-jpa-maria distributed-axon-server diff --git a/scenarios/single-node-simple/pom.xml b/scenarios/single-node-simple/pom.xml new file mode 100755 index 00000000..1bd141c0 --- /dev/null +++ b/scenarios/single-node-simple/pom.xml @@ -0,0 +1,141 @@ + + + 4.0.0 + + + io.holunda.polyflow + polyflow-example-scenario-root + 4.0.0-SNAPSHOT + + + polyflow-example-scenario-single-node-simple + examples/${project.artifactId} + + + true + + + + + + + io.holunda.polyflow + polyflow-taskpool-core + + + io.holunda.polyflow + polyflow-datapool-core + + + + + io.holunda.polyflow + polyflow-example-tasklist-backend + + + io.holunda.polyflow + polyflow-form-url-resolver + + + io.holunda.polyflow + polyflow-view-simple + + + + + io.holunda.polyflow + polyflow-example-approval-backend + + + org.axonframework + axon-server-connector + + + + + org.flywaydb + flyway-core + + + com.h2database + h2 + runtime + + + io.holunda.polyflow + polyflow-example-infrastructure + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + io.holunda.polyflow + polyflow-example-process-backend + + + + + + + + + + frontend + + + !skipFrontend + + + + + io.holunda.polyflow + polyflow-example-approval-forms + + + io.holunda.polyflow + polyflow-example-tasklist-angular + + + + + + camunda-ce + + + !camunda-ee + + + + + org.camunda.bpm.springboot + camunda-bpm-spring-boot-starter-webapp + + + + + + camunda-ee + + + camunda-ee + + + + + org.camunda.bpm.springboot + camunda-bpm-spring-boot-starter-webapp-ee + + + + + + + diff --git a/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/example/process/approval/SingleNodeSimpleExampleProcessApplication.kt b/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/example/process/approval/SingleNodeSimpleExampleProcessApplication.kt new file mode 100755 index 00000000..da13db2b --- /dev/null +++ b/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/example/process/approval/SingleNodeSimpleExampleProcessApplication.kt @@ -0,0 +1,113 @@ +package io.holunda.polyflow.example.process.approval + +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.SerializationFeature +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.thoughtworks.xstream.XStream +import com.thoughtworks.xstream.security.AnyTypePermission +import io.holixon.axon.gateway.query.RevisionValue +import io.holunda.polyflow.bus.jackson.config.FallbackPayloadObjectMapperAutoConfiguration +import io.holunda.polyflow.bus.jackson.configurePolyflowJacksonObjectMapper +import io.holunda.polyflow.datapool.core.EnablePolyflowDataPool +import io.holunda.polyflow.example.tasklist.EnableTasklist +import io.holunda.polyflow.example.users.EnableExampleUsers +import io.holunda.polyflow.taskpool.core.EnablePolyflowTaskPool +import io.holunda.polyflow.urlresolver.EnablePropertyBasedFormUrlResolver +import io.holunda.polyflow.view.simple.EnablePolyflowSimpleView +import org.axonframework.commandhandling.CommandMessage +import org.axonframework.common.jpa.EntityManagerProvider +import org.axonframework.common.transaction.TransactionManager +import org.axonframework.eventhandling.deadletter.jpa.DeadLetterEntry +import org.axonframework.eventhandling.tokenstore.jpa.TokenEntry +import org.axonframework.eventsourcing.eventstore.EventStorageEngine +import org.axonframework.eventsourcing.eventstore.jpa.DomainEventEntry +import org.axonframework.eventsourcing.eventstore.jpa.JpaEventStorageEngine +import org.axonframework.messaging.correlation.CorrelationDataProvider +import org.axonframework.messaging.correlation.MessageOriginProvider +import org.axonframework.messaging.correlation.MultiCorrelationDataProvider +import org.axonframework.messaging.correlation.SimpleCorrelationDataProvider +import org.axonframework.modelling.saga.repository.jpa.SagaEntry +import org.axonframework.serialization.Serializer +import org.axonframework.serialization.xml.XStreamSerializer +import org.springframework.beans.factory.annotation.Qualifier +import org.springframework.boot.autoconfigure.SpringBootApplication +import org.springframework.boot.autoconfigure.domain.EntityScan +import org.springframework.boot.runApplication +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Primary + +/** + * Starts the single node application. + */ +@Suppress("UNUSED_PARAMETER") +fun main(args: Array) { + runApplication().let { } +} + +/** + * Application being everything in one node: + * - process application + * - task pool core + * - data pool core + * - task list + */ +@SpringBootApplication +@EnableExampleUsers +@EnablePolyflowTaskPool +@EnablePolyflowDataPool +@EnableTasklist +@EnablePropertyBasedFormUrlResolver +@EnablePolyflowSimpleView +@EntityScan( + basePackageClasses = [ + DomainEventEntry::class, SagaEntry::class, TokenEntry::class, DeadLetterEntry::class + ] +) +class SingleNodeSimpleExampleProcessApplication { + + /** + * Custom object mapper. + */ + @Bean + @Primary + @Qualifier(FallbackPayloadObjectMapperAutoConfiguration.PAYLOAD_OBJECT_MAPPER) + fun myObjectMapper(): ObjectMapper { + return jacksonObjectMapper() + .registerModule(JavaTimeModule()) + .configurePolyflowJacksonObjectMapper() + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + } + + /** + * Factory function creating correlation data provider for revision information. + * We don't want to explicitly pump revision meta data from command to event. + */ + @Bean + fun revisionAwareCorrelationDataProvider(): CorrelationDataProvider { + return MultiCorrelationDataProvider>( + listOf( + MessageOriginProvider(), + SimpleCorrelationDataProvider(RevisionValue.REVISION_KEY) + ) + ) + } + + @Bean + @Qualifier("eventSerializer") + fun mySerializer(): Serializer = XStreamSerializer.builder().xStream(XStream().apply { addPermission(AnyTypePermission.ANY) }).build() + + @Bean + fun storageEngine( + emp: EntityManagerProvider, + txManager: TransactionManager, + @Qualifier("eventSerializer") + eventSerializer: Serializer + ): EventStorageEngine = JpaEventStorageEngine.builder() + .entityManagerProvider(emp) + .eventSerializer(eventSerializer) + .snapshotSerializer(eventSerializer) + .transactionManager(txManager) + .build() +} + diff --git a/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/GdprData.kt b/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/GdprData.kt new file mode 100644 index 00000000..ecf980ae --- /dev/null +++ b/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/GdprData.kt @@ -0,0 +1,3 @@ +package io.holunda.polyflow.serializer.gdpr + +annotation class GdprData() diff --git a/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/GdprSerializationPocConfiguration.kt b/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/GdprSerializationPocConfiguration.kt new file mode 100644 index 00000000..af0513b8 --- /dev/null +++ b/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/GdprSerializationPocConfiguration.kt @@ -0,0 +1,4 @@ +package io.holunda.polyflow.serializer.gdpr + +class GdprSerializationPocConfiguration { +} diff --git a/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/GdprSerializer.kt b/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/GdprSerializer.kt new file mode 100644 index 00000000..7070e55f --- /dev/null +++ b/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/GdprSerializer.kt @@ -0,0 +1,25 @@ +package io.holunda.polyflow.serializer.gdpr + +import org.axonframework.serialization.SerializedObject +import org.axonframework.serialization.Serializer + + +class GdprSerializer( + private val serializer: Serializer, + private val protectionDetection: ProtectionStrategy +) : Serializer by serializer { + + override fun serialize(`object`: Any?, expectedRepresentation: Class): SerializedObject { + val result = if(protectionDetection.shouldEncrypt(`object`)) { + protectionDetection.encrypt(`object`) + } else { + `object` + } + return serializer.serialize(result, expectedRepresentation) + } + + override fun deserialize(serializedObject: SerializedObject): T { + val deserialized = serializer.deserialize(serializedObject) + return protectionDetection.decrypt(deserialized) + } +} diff --git a/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/MyMessageInterceptor.kt b/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/MyMessageInterceptor.kt new file mode 100644 index 00000000..12d46599 --- /dev/null +++ b/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/MyMessageInterceptor.kt @@ -0,0 +1,17 @@ +package io.holunda.polyflow.serializer.gdpr + +import mu.KLogging +import org.axonframework.eventhandling.EventMessage +import org.axonframework.messaging.MessageDispatchInterceptor +import java.util.function.BiFunction + +class MYMessageInterceptor : MessageDispatchInterceptor> { + + companion object: KLogging() + + override fun handle(messages: MutableList>): BiFunction, EventMessage> { + return BiFunction { index, event -> event.apply { + logger.info { "Handling $index, $event" } + } } + } +} diff --git a/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/ProtectionStrategy.kt b/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/ProtectionStrategy.kt new file mode 100644 index 00000000..c6ac84ce --- /dev/null +++ b/scenarios/single-node-simple/src/main/kotlin/io/holunda/polyflow/serializer/gdpr/ProtectionStrategy.kt @@ -0,0 +1,17 @@ +package io.holunda.polyflow.serializer.gdpr + +/** + * Strategy to detect the protection. + */ +sealed interface ProtectionStrategy { + fun shouldEncrypt(any: Any?): Boolean + fun encrypt(value: T): T + fun decrypt(value: T): T + + + class NoneProtectionStrategy: ProtectionStrategy { + override fun shouldEncrypt(any: Any?): Boolean = false + override fun encrypt(value: T): T = value + override fun decrypt(value: T): T = value + } +} diff --git a/scenarios/single-node-simple/src/main/resources/application.yml b/scenarios/single-node-simple/src/main/resources/application.yml new file mode 100755 index 00000000..fee3a312 --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/application.yml @@ -0,0 +1,149 @@ +server: + port: 8080 + +spring: + application: + name: example-process-approval + datasource: + url: jdbc:h2:mem:testdb;MODE=PostgreSQL;INIT=create schema if not exists PUBLIC;DB_CLOSE_DELAY=-1;NON_KEYWORDS=VALUE;DB_CLOSE_ON_EXIT=FALSE + username: sa + password: sa + hikari: + connection-test-query: select 1 from dual; + schema: PUBLIC + driver-class-name: org.h2.Driver + jpa: + # database-platform: org.hibernate.dialect.H2Dialect + database-platform: io.holunda.polyflow.example.infrastructure.FixedH2Dialect + generate-ddl: false + hibernate.ddl-auto: none + show-sql: false + open-in-view: false + h2: + console: + enabled: true + path: /h2-console + groovy: + template: + check-template-location: false + flyway: + enabled: true + locations: "classpath:db/migrations/h2-postgresql" + +axon-gateway: + query: + type: revision-aware + revision-aware: + default-query-timeout: 10 + +springdoc: + swagger-ui: + try-it-out-enabled: true + display-request-duration: true + +camunda: + bpm: + admin-user: + id: admin + first-name: Admin + last-name: Administrarius + email: admin@localhost + password: admin + authorization: + enabled: false + login: + enabled: true + user-id: admin + database: + schema-update: true + default-serialization-format: application/json + eventing: + task: false + filter: + create: All tasks + history-level: full + id-generator: strong + metrics: + db-reporter-activate: false + enabled: false + webapp: + index-redirect-enabled: false + +polyflow: + integration: + client: + camunda: + application-name: ${spring.application.name} # default + collector: + camunda: + application-name: ${spring.application.name} # default + process-instance: + enabled: false + process-definition: + enabled: true + process-variable: + enabled: false + task: + enabled: true + enricher: + type: processVariables + importer: + enabled: true + task-filter-type: eventstore + + form-url-resolver: + default-application-template: "http://localhost:${server.port}/${applicationName}" + default-task-template: "tasks/${formKey}/${id}?userId=%userId%" + default-process-template: "${formKey}?userId=%userId%" + applications: + example-process-approval: + url: "http://localhost:${server.port}/${spring.application.name}" + processes: + process_approve_request: "start?userId=%userId%" + data-entries: + io.holunda.camunda.taskpool.example.ApprovalRequest: "approval-request/${entryId}?userId=%userId%" + sender: + enabled: true + data-entry: + enabled: true + type: simple + application-name: ${spring.application.name} # default + process-definition: + enabled: true + process-instance: + enabled: false + process-variable: + enabled: false + task: + enabled: true + type: tx + send-within-transaction: true # Must be set to true in single node scenario, because the TX of Camunda must be the same as TX of Axon. + tasklist: + tasklist-url: http://localhost:${server.port}/polyflow/tasks + view: + jpa: + payload-attribute-level-limit: 2 + stored-items: task, process-instance, process-definition, data-entry + + +logging.level: + root: INFO + io.holunda.camunda: + taskpool.core: INFO + io.holunda.polyflow: + taskpool: + collector: + process: + variable: INFO + sender: INFO + core: WARN + view.simple: INFO + datapool: + sender: INFO + view.jpa: INFO + +# To log REST controllers +# org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping: TRACE +# To log web access +# org.springframework.web: DEBUG + diff --git a/scenarios/single-node-simple/src/main/resources/banner.txt b/scenarios/single-node-simple/src/main/resources/banner.txt new file mode 100644 index 00000000..54a42335 --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/banner.txt @@ -0,0 +1,23 @@ +${AnsiColor.GREEN} +███████╗██╗███╗ ██╗ ██████╗ ██╗ ███████╗ ███╗ ██╗ ██████╗ ██████╗ ███████╗ +██╔════╝██║████╗ ██║██╔════╝ ██║ ██╔════╝ ████╗ ██║██╔═══██╗██╔══██╗██╔════╝ +███████╗██║██╔██╗ ██║██║ ███╗██║ █████╗ ██╔██╗ ██║██║ ██║██║ ██║█████╗ +╚════██║██║██║╚██╗██║██║ ██║██║ ██╔══╝ ██║╚██╗██║██║ ██║██║ ██║██╔══╝ +███████║██║██║ ╚████║╚██████╔╝███████╗███████╗ ██║ ╚████║╚██████╔╝██████╔╝███████╗ +╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝╚══════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚══════╝ +${AnsiColor.RED} +████████╗ █████╗ ███████╗██╗ ██╗██████╗ ██████╗ ██████╗ ██╗ ███████╗██╗ ██╗ █████╗ ███╗ ███╗██████╗ ██╗ ███████╗ +╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝██╔══██╗██╔═══██╗██╔═══██╗██║ ██╔════╝╚██╗██╔╝██╔══██╗████╗ ████║██╔══██╗██║ ██╔════╝ + ██║ ███████║███████╗█████╔╝ ██████╔╝██║ ██║██║ ██║██║ █████╗ ╚███╔╝ ███████║██╔████╔██║██████╔╝██║ █████╗ + ██║ ██╔══██║╚════██║██╔═██╗ ██╔═══╝ ██║ ██║██║ ██║██║ ██╔══╝ ██╔██╗ ██╔══██║██║╚██╔╝██║██╔═══╝ ██║ ██╔══╝ + ██║ ██║ ██║███████║██║ ██╗██║ ╚██████╔╝╚██████╔╝███████╗ ███████╗██╔╝ ██╗██║ ██║██║ ╚═╝ ██║██║ ███████╗███████╗ + ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝ +${AnsiColor.WHITE} + Spring-Boot: ${spring-boot.formatted-version} + Camunda BPM: ${camunda.bpm.formatted-version} + Taskpool: ${application.formatted-version} + + Swagger UI: http://localhost:${server.port}/swagger-ui/index.html + Cockpit: http://localhost:${server.port}/camunda/app/cockpit/ + Task list URL: http://localhost:${server.port}/polyflow/tasks + Business data entries list URL: http://localhost:${server.port}/polyflow/archive diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_10__axon_dlq.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_10__axon_dlq.sql new file mode 100644 index 00000000..6dfe016d --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_10__axon_dlq.sql @@ -0,0 +1,26 @@ +CREATE TABLE dead_letter_entry +( + dead_letter_id VARCHAR(255) NOT NULL, + cause_message VARCHAR(255), + cause_type VARCHAR(255), + diagnostics BYTEA, + enqueued_at TIMESTAMP NOT NULL, + last_touched TIMESTAMP, + aggregate_identifier VARCHAR(255), + event_identifier VARCHAR(255) NOT NULL, + message_type VARCHAR(255) NOT NULL, + meta_data BYTEA, + payload BYTEA NOT NULL, + payload_revision VARCHAR(255), + payload_type VARCHAR(255) NOT NULL, + sequence_number INT8, + time_stamp VARCHAR(255) NOT NULL, + token BYTEA, + token_type VARCHAR(255), + type VARCHAR(255), + processing_group VARCHAR(255) NOT NULL, + processing_started TIMESTAMP, + sequence_identifier VARCHAR(255) NOT NULL, + sequence_index INT8 NOT NULL, + PRIMARY KEY (dead_letter_id) +); diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_11__postgres_engine_7.16_to_7.17.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_11__postgres_engine_7.16_to_7.17.sql new file mode 100644 index 00000000..dfdc0c9a --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_11__postgres_engine_7.16_to_7.17.sql @@ -0,0 +1,29 @@ +-- +-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH +-- under one or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information regarding copyright +-- ownership. Camunda licenses this file to you under the Apache License, +-- Version 2.0; you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +insert into ACT_GE_SCHEMA_LOG +values ('600', CURRENT_TIMESTAMP, '7.17.0'); + +-- https://jira.camunda.com/browse/CAM-14006 -- +ALTER TABLE ACT_RU_JOB + ADD COLUMN LAST_FAILURE_LOG_ID_ varchar(64); + +ALTER TABLE ACT_RU_EXT_TASK + ADD COLUMN LAST_FAILURE_LOG_ID_ varchar(64); + +create index ACT_IDX_HI_VARINST_NAME on ACT_HI_VARINST(NAME_); +create index ACT_IDX_HI_VARINST_ACT_INST_ID on ACT_HI_VARINST(ACT_INST_ID_); diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_12__postgres_engine_7.17_to_7.18.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_12__postgres_engine_7.17_to_7.18.sql new file mode 100644 index 00000000..4fa86840 --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_12__postgres_engine_7.17_to_7.18.sql @@ -0,0 +1,34 @@ +-- +-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH +-- under one or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information regarding copyright +-- ownership. Camunda licenses this file to you under the Apache License, +-- Version 2.0; you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +insert into ACT_GE_SCHEMA_LOG +values ('700', CURRENT_TIMESTAMP, '7.18.0'); + +-- https://jira.camunda.com/browse/CAM-14303 -- +ALTER TABLE ACT_RU_TASK + ADD COLUMN LAST_UPDATED_ timestamp; +create index ACT_IDX_TASK_LAST_UPDATED on ACT_RU_TASK(LAST_UPDATED_); + +-- https://jira.camunda.com/browse/CAM-14721 +ALTER TABLE ACT_RU_BATCH + ADD COLUMN START_TIME_ timestamp; + +-- https://jira.camunda.com/browse/CAM-14722 +ALTER TABLE ACT_RU_BATCH + ADD COLUMN EXEC_START_TIME_ timestamp; +ALTER TABLE ACT_HI_BATCH + ADD COLUMN EXEC_START_TIME_ timestamp; \ No newline at end of file diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_13__polyflow_deleted.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_13__polyflow_deleted.sql new file mode 100644 index 00000000..bf3e32aa --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_13__polyflow_deleted.sql @@ -0,0 +1,2 @@ +ALTER TABLE plf_data_entry + ADD date_deleted timestamp; diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_14__axon_sequences_per_table.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_14__axon_sequences_per_table.sql new file mode 100644 index 00000000..ad82813b --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_14__axon_sequences_per_table.sql @@ -0,0 +1,5 @@ +DROP SEQUENCE hibernate_sequence; + +CREATE SEQUENCE association_value_entry_seq START WITH 1 INCREMENT BY 50; + +CREATE SEQUENCE domain_event_entry_seq START WITH 1 INCREMENT BY 50; diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_15__postgres_engine_7.18_to_7.21.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_15__postgres_engine_7.18_to_7.21.sql new file mode 100644 index 00000000..c56732d3 --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_15__postgres_engine_7.18_to_7.21.sql @@ -0,0 +1,27 @@ +-- +-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH +-- under one or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information regarding copyright +-- ownership. Camunda licenses this file to you under the Apache License, +-- Version 2.0; you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +insert into ACT_GE_SCHEMA_LOG +values ('1000', CURRENT_TIMESTAMP, '7.21.0'); + +alter table ACT_RU_EXT_TASK + add column CREATE_TIME_ timestamp; + +alter table ACT_RU_JOB + add column ROOT_PROC_INST_ID_ varchar(64); + +create index ACT_IDX_JOB_ROOT_PROCINST on ACT_RU_JOB(ROOT_PROC_INST_ID_); diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_16__jpa_view_task_data_entry_payload.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_16__jpa_view_task_data_entry_payload.sql new file mode 100644 index 00000000..6c5de79c --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_16__jpa_view_task_data_entry_payload.sql @@ -0,0 +1,6 @@ +create view PLF_VIEW_TASK_AND_DATA_ENTRY_PAYLOAD as +((select pc.TASK_ID, dea.PATH, dea.VALUE + from PLF_TASK_CORRELATIONS pc + join PLF_DATA_ENTRY_PAYLOAD_ATTRIBUTES dea on pc.ENTRY_ID = dea.ENTRY_ID and pc.ENTRY_TYPE = dea.ENTRY_TYPE) +union +select * from PLF_TASK_PAYLOAD_ATTRIBUTES); diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_17__jpa_plf_data_entry_correlations.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_17__jpa_plf_data_entry_correlations.sql new file mode 100644 index 00000000..d70396fd --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_17__jpa_plf_data_entry_correlations.sql @@ -0,0 +1,23 @@ +create table PLF_DATA_ENTRY_CORRELATIONS +( + OWNING_ENTRY_TYPE varchar(255) not null, + OWNING_ENTRY_ID varchar(64) not null, + ENTRY_TYPE varchar(255) not null, + ENTRY_ID varchar(64) not null, + primary key (OWNING_ENTRY_TYPE, OWNING_ENTRY_ID, ENTRY_TYPE, ENTRY_ID) +); + +create view PLF_VIEW_DATA_ENTRY_PAYLOAD as +( +select * +from PLF_DATA_ENTRY_PAYLOAD_ATTRIBUTES +union +(select ec.OWNING_ENTRY_ID as ENTRY_ID, + ec.OWNING_ENTRY_TYPE as ENTRY_TYPE, + ep.path as PATH, + ep.value as VALUE + from PLF_DATA_ENTRY_CORRELATIONS ec + join PLF_DATA_ENTRY_PAYLOAD_ATTRIBUTES ep + on + ec.ENTRY_ID = ep.ENTRY_ID and ec.ENTRY_TYPE = ep.ENTRY_TYPE) +); diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_1__postgres_engine_7.14.0.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_1__postgres_engine_7.14.0.sql new file mode 100644 index 00000000..c21c0b3a --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_1__postgres_engine_7.14.0.sql @@ -0,0 +1,1378 @@ +-- +-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH +-- under one or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information regarding copyright +-- ownership. Camunda licenses this file to you under the Apache License, +-- Version 2.0; you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +create table ACT_GE_PROPERTY ( + NAME_ varchar(64), + VALUE_ varchar(300), + REV_ integer, + primary key (NAME_) +); + +insert into ACT_GE_PROPERTY +values ('schema.version', 'fox', 1); + +insert into ACT_GE_PROPERTY +values ('schema.history', 'create(fox)', 1); + +insert into ACT_GE_PROPERTY +values ('next.dbid', '1', 1); + +insert into ACT_GE_PROPERTY +values ('deployment.lock', '0', 1); + +insert into ACT_GE_PROPERTY +values ('history.cleanup.job.lock', '0', 1); + +insert into ACT_GE_PROPERTY +values ('startup.lock', '0', 1); + +insert into ACT_GE_PROPERTY +values ('telemetry.lock', '0', 1); + +insert into ACT_GE_PROPERTY +values ('installationId.lock', '0', 1); + +create table ACT_GE_BYTEARRAY ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + BYTES_ bytea, + GENERATED_ boolean, + TENANT_ID_ varchar(64), + TYPE_ integer, + CREATE_TIME_ timestamp, + ROOT_PROC_INST_ID_ varchar(64), + REMOVAL_TIME_ timestamp, + primary key (ID_) +); + +create table ACT_GE_SCHEMA_LOG ( + ID_ varchar(64), + TIMESTAMP_ timestamp, + VERSION_ varchar(255), + primary key (ID_) +); + +insert into ACT_GE_SCHEMA_LOG +values ('0', CURRENT_TIMESTAMP, '7.14.0'); + +create table ACT_RE_DEPLOYMENT ( + ID_ varchar(64), + NAME_ varchar(255), + DEPLOY_TIME_ timestamp, + SOURCE_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +); + +create table ACT_RU_EXECUTION ( + ID_ varchar(64), + REV_ integer, + ROOT_PROC_INST_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + SUPER_EXEC_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + IS_ACTIVE_ boolean, + IS_CONCURRENT_ boolean, + IS_SCOPE_ boolean, + IS_EVENT_SCOPE_ boolean, + SUSPENSION_STATE_ integer, + CACHED_ENT_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +); + +create table ACT_RU_JOB ( + ID_ varchar(64) NOT NULL, + REV_ integer, + TYPE_ varchar(255) NOT NULL, + LOCK_EXP_TIME_ timestamp, + LOCK_OWNER_ varchar(255), + EXCLUSIVE_ boolean, + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + RETRIES_ integer, + EXCEPTION_STACK_ID_ varchar(64), + EXCEPTION_MSG_ varchar(4000), + FAILED_ACT_ID_ varchar(255), + DUEDATE_ timestamp, + REPEAT_ varchar(255), + REPEAT_OFFSET_ bigint DEFAULT 0, + HANDLER_TYPE_ varchar(255), + HANDLER_CFG_ varchar(4000), + DEPLOYMENT_ID_ varchar(64), + SUSPENSION_STATE_ integer NOT NULL DEFAULT 1, + JOB_DEF_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + CREATE_TIME_ timestamp, + primary key (ID_) +); + +create table ACT_RU_JOBDEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + JOB_TYPE_ varchar(255) NOT NULL, + JOB_CONFIGURATION_ varchar(255), + SUSPENSION_STATE_ integer, + JOB_PRIORITY_ bigint, + TENANT_ID_ varchar(64), + DEPLOYMENT_ID_ varchar(64), + primary key (ID_) +); + +create table ACT_RE_PROCDEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) NOT NULL, + VERSION_ integer NOT NULL, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + HAS_START_FORM_KEY_ boolean, + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + VERSION_TAG_ varchar(64), + HISTORY_TTL_ integer, + STARTABLE_ boolean NOT NULL default TRUE, + primary key (ID_) +); + +create table ACT_RU_TASK ( + ID_ varchar(64), + REV_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + TASK_DEF_KEY_ varchar(255), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + DELEGATION_ varchar(64), + PRIORITY_ integer, + CREATE_TIME_ timestamp, + DUE_DATE_ timestamp, + FOLLOW_UP_DATE_ timestamp, + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + primary key (ID_) +); + +create table ACT_RU_IDENTITYLINK ( + ID_ varchar(64), + REV_ integer, + GROUP_ID_ varchar(255), + TYPE_ varchar(255), + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar (64), + TENANT_ID_ varchar(64), + primary key (ID_) +); + +create table ACT_RU_VARIABLE ( + ID_ varchar(64) not null, + REV_ integer, + TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + TASK_ID_ varchar(64), + BATCH_ID_ varchar(64), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double precision, + LONG_ bigint, + TEXT_ varchar(4000), + TEXT2_ varchar(4000), + VAR_SCOPE_ varchar(64), + SEQUENCE_COUNTER_ bigint, + IS_CONCURRENT_LOCAL_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +); + +create table ACT_RU_EVENT_SUBSCR ( + ID_ varchar(64) not null, + REV_ integer, + EVENT_TYPE_ varchar(255) not null, + EVENT_NAME_ varchar(255), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTIVITY_ID_ varchar(255), + CONFIGURATION_ varchar(255), + CREATED_ timestamp not null, + TENANT_ID_ varchar(64), + primary key (ID_) +); + +create table ACT_RU_INCIDENT ( + ID_ varchar(64) not null, + REV_ integer not null, + INCIDENT_TIMESTAMP_ timestamp not null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + ACTIVITY_ID_ varchar(255), + FAILED_ACTIVITY_ID_ varchar(255), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +); + +create table ACT_RU_AUTHORIZATION ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ integer not null, + GROUP_ID_ varchar(255), + USER_ID_ varchar(255), + RESOURCE_TYPE_ integer not null, + RESOURCE_ID_ varchar(255), + PERMS_ integer, + REMOVAL_TIME_ timestamp, + ROOT_PROC_INST_ID_ varchar(64), + primary key (ID_) +); + +create table ACT_RU_FILTER ( + ID_ varchar(64) not null, + REV_ integer not null, + RESOURCE_TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + OWNER_ varchar(255), + QUERY_ TEXT not null, + PROPERTIES_ TEXT, + primary key (ID_) +); + +create table ACT_RU_METER_LOG ( + ID_ varchar(64) not null, + NAME_ varchar(64) not null, + REPORTER_ varchar(255), + VALUE_ bigint, + TIMESTAMP_ timestamp, + MILLISECONDS_ bigint DEFAULT 0, + primary key (ID_) +); + +create table ACT_RU_EXT_TASK ( + ID_ varchar(64) not null, + REV_ integer not null, + WORKER_ID_ varchar(255), + TOPIC_NAME_ varchar(255), + RETRIES_ integer, + ERROR_MSG_ varchar(4000), + ERROR_DETAILS_ID_ varchar(64), + LOCK_EXP_TIME_ timestamp, + SUSPENSION_STATE_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + TENANT_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + primary key (ID_) +); + +create table ACT_RU_BATCH ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_CREATED_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + SUSPENSION_STATE_ integer, + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + CREATE_USER_ID_ varchar(255), + primary key (ID_) +); + +create index ACT_IDX_EXE_ROOT_PI on ACT_RU_EXECUTION(ROOT_PROC_INST_ID_); +create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); +create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); +create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_); +create index ACT_IDX_TASK_ASSIGNEE on ACT_RU_TASK(ASSIGNEE_); +create index ACT_IDX_TASK_OWNER on ACT_RU_TASK(OWNER_); +create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); +create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); +create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_); +create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); + +create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); +create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); +create index ACT_IDX_VARIABLE_TASK_NAME_TYPE on ACT_RU_VARIABLE(TASK_ID_, NAME_, TYPE_); + +create index ACT_IDX_INC_CONFIGURATION on ACT_RU_INCIDENT(CONFIGURATION_); +create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); +-- CAM-5914 +create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_); +create index ACT_IDX_JOB_HANDLER on ACT_RU_JOB(HANDLER_TYPE_,HANDLER_CFG_); +create index ACT_IDX_JOB_PROCINST on ACT_RU_JOB(PROCESS_INSTANCE_ID_); +create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); +create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); + +-- new metric milliseconds column +CREATE INDEX ACT_IDX_METER_LOG_MS ON ACT_RU_METER_LOG(MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_NAME_MS ON ACT_RU_METER_LOG(NAME_, MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_REPORT ON ACT_RU_METER_LOG(NAME_, REPORTER_, MILLISECONDS_); + +-- old metric timestamp column +CREATE INDEX ACT_IDX_METER_LOG_TIME ON ACT_RU_METER_LOG(TIMESTAMP_); +CREATE INDEX ACT_IDX_METER_LOG ON ACT_RU_METER_LOG(NAME_, TIMESTAMP_); + +create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); +create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); +create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); +create index ACT_IDX_EXT_TASK_ERR_DETAILS ON ACT_RU_EXT_TASK(ERROR_DETAILS_ID_); +create index ACT_IDX_AUTH_GROUP_ID on ACT_RU_AUTHORIZATION(GROUP_ID_); +create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); + +create index ACT_IDX_BYTEAR_DEPL on ACT_GE_BYTEARRAY(DEPLOYMENT_ID_); +alter table ACT_GE_BYTEARRAY + add constraint ACT_FK_BYTEARR_DEPL + foreign key (DEPLOYMENT_ID_) + references ACT_RE_DEPLOYMENT (ID_); + +create index ACT_IDX_EXE_PROCINST on ACT_RU_EXECUTION(PROC_INST_ID_); +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_EXE_PARENT on ACT_RU_EXECUTION(PARENT_ID_); +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_EXE_SUPER on ACT_RU_EXECUTION(SUPER_EXEC_); +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_SUPER + foreign key (SUPER_EXEC_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_EXE_PROCDEF on ACT_RU_EXECUTION(PROC_DEF_ID_); +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + + +create index ACT_IDX_TSKASS_TASK on ACT_RU_IDENTITYLINK(TASK_ID_); +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_TSKASS_TASK + foreign key (TASK_ID_) + references ACT_RU_TASK (ID_); + +create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_ATHRZ_PROCEDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +create index ACT_IDX_TASK_EXEC on ACT_RU_TASK(EXECUTION_ID_); +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_TASK_PROCINST on ACT_RU_TASK(PROC_INST_ID_); +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_TASK_PROCDEF on ACT_RU_TASK(PROC_DEF_ID_); +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +create index ACT_IDX_VAR_EXE on ACT_RU_VARIABLE(EXECUTION_ID_); +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_VAR_PROCINST on ACT_RU_VARIABLE(PROC_INST_ID_); +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION(ID_); + +create index ACT_IDX_VAR_BYTEARRAY on ACT_RU_VARIABLE(BYTEARRAY_ID_); +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_BYTEARRAY + foreign key (BYTEARRAY_ID_) + references ACT_GE_BYTEARRAY (ID_); + +create index ACT_IDX_JOB_EXCEPTION on ACT_RU_JOB(EXCEPTION_STACK_ID_); +alter table ACT_RU_JOB + add constraint ACT_FK_JOB_EXCEPTION + foreign key (EXCEPTION_STACK_ID_) + references ACT_GE_BYTEARRAY (ID_); + +create index ACT_IDX_EVENT_SUBSCR on ACT_RU_EVENT_SUBSCR(EXECUTION_ID_); +alter table ACT_RU_EVENT_SUBSCR + add constraint ACT_FK_EVENT_EXEC + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_CAUSE + foreign key (CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_RCAUSE + foreign key (ROOT_CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_); + +create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_JOB_DEF + foreign key (JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_USER + unique (TYPE_,USER_ID_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_GROUP + unique (TYPE_,GROUP_ID_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_UNIQ_VARIABLE + unique (VAR_SCOPE_, NAME_); + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_SEED_JOB_DEF + foreign key (SEED_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_MONITOR_JOB_DEF + foreign key (MONITOR_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_JOB_DEF + foreign key (BATCH_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_ERROR_DETAILS + foreign key (ERROR_DETAILS_ID_) + references ACT_GE_BYTEARRAY (ID_); + +create index ACT_IDX_BATCH_ID ON ACT_RU_VARIABLE(BATCH_ID_); +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_BATCH + foreign key (BATCH_ID_) + references ACT_RU_BATCH (ID_); + +-- indexes for deadlock problems - https://app.camunda.com/jira/browse/CAM-2567 -- +create index ACT_IDX_INC_CAUSEINCID on ACT_RU_INCIDENT(CAUSE_INCIDENT_ID_); +create index ACT_IDX_INC_EXID on ACT_RU_INCIDENT(EXECUTION_ID_); +create index ACT_IDX_INC_PROCDEFID on ACT_RU_INCIDENT(PROC_DEF_ID_); +create index ACT_IDX_INC_PROCINSTID on ACT_RU_INCIDENT(PROC_INST_ID_); +create index ACT_IDX_INC_ROOTCAUSEINCID on ACT_RU_INCIDENT(ROOT_CAUSE_INCIDENT_ID_); +-- index for deadlock problem - https://app.camunda.com/jira/browse/CAM-4440 -- +create index ACT_IDX_AUTH_RESOURCE_ID on ACT_RU_AUTHORIZATION(RESOURCE_ID_); +-- index to prevent deadlock on fk constraint - https://app.camunda.com/jira/browse/CAM-5440 -- +create index ACT_IDX_EXT_TASK_EXEC on ACT_RU_EXT_TASK(EXECUTION_ID_); + +-- indexes to improve deployment +create index ACT_IDX_BYTEARRAY_ROOT_PI on ACT_GE_BYTEARRAY(ROOT_PROC_INST_ID_); +create index ACT_IDX_BYTEARRAY_RM_TIME on ACT_GE_BYTEARRAY(REMOVAL_TIME_); +create index ACT_IDX_BYTEARRAY_NAME on ACT_GE_BYTEARRAY(NAME_); +create index ACT_IDX_DEPLOYMENT_NAME on ACT_RE_DEPLOYMENT(NAME_); +create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); +create index ACT_IDX_JOBDEF_PROC_DEF_ID ON ACT_RU_JOBDEF(PROC_DEF_ID_); +create index ACT_IDX_JOB_HANDLER_TYPE ON ACT_RU_JOB(HANDLER_TYPE_); +create index ACT_IDX_EVENT_SUBSCR_EVT_NAME ON ACT_RU_EVENT_SUBSCR(EVENT_NAME_); +create index ACT_IDX_PROCDEF_DEPLOYMENT_ID ON ACT_RE_PROCDEF(DEPLOYMENT_ID_); +create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); +create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); + +-- indices for history cleanup: https://jira.camunda.com/browse/CAM-11616 +create index ACT_IDX_AUTH_ROOT_PI on ACT_RU_AUTHORIZATION(ROOT_PROC_INST_ID_); +create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); +-- +-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH +-- under one or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information regarding copyright +-- ownership. Camunda licenses this file to you under the Apache License, +-- Version 2.0; you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- create case definition table -- + +create table ACT_RE_CASE_DEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) NOT NULL, + VERSION_ integer NOT NULL, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + HISTORY_TTL_ integer, + primary key (ID_) +); + +-- create case execution table -- + +create table ACT_RU_CASE_EXECUTION ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + SUPER_EXEC_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + ACT_ID_ varchar(255), + PREV_STATE_ integer, + CURRENT_STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +); + +-- create case sentry part table -- + +create table ACT_RU_CASE_SENTRY_PART ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + CASE_EXEC_ID_ varchar(64), + SENTRY_ID_ varchar(255), + TYPE_ varchar(255), + SOURCE_CASE_EXEC_ID_ varchar(64), + STANDARD_EVENT_ varchar(255), + SOURCE_ varchar(255), + VARIABLE_EVENT_ varchar(255), + VARIABLE_NAME_ varchar(255), + SATISFIED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +); + +-- create index on business key -- +create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_); + +-- create foreign key constraints on ACT_RU_CASE_EXECUTION -- +create index ACT_IDX_CASE_EXE_CASE_INST on ACT_RU_CASE_EXECUTION(CASE_INST_ID_); +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +create index ACT_IDX_CASE_EXE_PARENT on ACT_RU_CASE_EXECUTION(PARENT_ID_); +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +create index ACT_IDX_CASE_EXE_CASE_DEF on ACT_RU_CASE_EXECUTION(CASE_DEF_ID_); +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_VARIABLE -- +create index ACT_IDX_VAR_CASE_EXE on ACT_RU_VARIABLE(CASE_EXECUTION_ID_); +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +create index ACT_IDX_VAR_CASE_INST_ID on ACT_RU_VARIABLE(CASE_INST_ID_); +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +-- create foreign key constraints on ACT_RU_TASK -- +create index ACT_IDX_TASK_CASE_EXEC on ACT_RU_TASK(CASE_EXECUTION_ID_); +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +create index ACT_IDX_TASK_CASE_DEF_ID on ACT_RU_TASK(CASE_DEF_ID_); +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_CASE_SENTRY_PART -- +create index ACT_IDX_CASE_SENTRY_CASE_INST on ACT_RU_CASE_SENTRY_PART(CASE_INST_ID_); +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +create index ACT_IDX_CASE_SENTRY_CASE_EXEC on ACT_RU_CASE_SENTRY_PART(CASE_EXEC_ID_); +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_EXEC + foreign key (CASE_EXEC_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); +create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); +-- +-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH +-- under one or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information regarding copyright +-- ownership. Camunda licenses this file to you under the Apache License, +-- Version 2.0; you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- create decision definition table -- +create table ACT_RE_DECISION_DEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) NOT NULL, + VERSION_ integer NOT NULL, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + DEC_REQ_ID_ varchar(64), + DEC_REQ_KEY_ varchar(255), + TENANT_ID_ varchar(64), + HISTORY_TTL_ integer, + VERSION_TAG_ varchar(64), + primary key (ID_) +); + +-- create decision requirements definition table -- +create table ACT_RE_DECISION_REQ_DEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) NOT NULL, + VERSION_ integer NOT NULL, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +); + +alter table ACT_RE_DECISION_DEF + add constraint ACT_FK_DEC_REQ + foreign key (DEC_REQ_ID_) + references ACT_RE_DECISION_REQ_DEF(ID_); + +create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); +create index ACT_IDX_DEC_DEF_REQ_ID on ACT_RE_DECISION_DEF(DEC_REQ_ID_); +create index ACT_IDX_DEC_REQ_DEF_TENANT_ID on ACT_RE_DECISION_REQ_DEF(TENANT_ID_); +-- +-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH +-- under one or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information regarding copyright +-- ownership. Camunda licenses this file to you under the Apache License, +-- Version 2.0; you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +create table ACT_HI_PROCINST ( + ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + START_TIME_ timestamp not null, + END_TIME_ timestamp, + REMOVAL_TIME_ timestamp, + DURATION_ bigint, + START_USER_ID_ varchar(255), + START_ACT_ID_ varchar(255), + END_ACT_ID_ varchar(255), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + ROOT_PROC_INST_ID_ varchar(64), + SUPER_CASE_INSTANCE_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(64), + STATE_ varchar(255), + primary key (ID_), + unique (PROC_INST_ID_) +); + +create table ACT_HI_ACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + ROOT_PROC_INST_ID_ varchar(64), + PROC_INST_ID_ varchar(64) not null, + EXECUTION_ID_ varchar(64) not null, + ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + ACT_NAME_ varchar(255), + ACT_TYPE_ varchar(255) not null, + ASSIGNEE_ varchar(255), + START_TIME_ timestamp not null, + END_TIME_ timestamp, + DURATION_ bigint, + ACT_INST_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + REMOVAL_TIME_ timestamp, + primary key (ID_) +); + +create table ACT_HI_TASKINST ( + ID_ varchar(64) not null, + TASK_DEF_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + ROOT_PROC_INST_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + START_TIME_ timestamp not null, + END_TIME_ timestamp, + DURATION_ bigint, + DELETE_REASON_ varchar(4000), + PRIORITY_ integer, + DUE_DATE_ timestamp, + FOLLOW_UP_DATE_ timestamp, + TENANT_ID_ varchar(64), + REMOVAL_TIME_ timestamp, + primary key (ID_) +); + +create table ACT_HI_VARINST ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + ROOT_PROC_INST_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(100), + CREATE_TIME_ timestamp, + REV_ integer, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double precision, + LONG_ bigint, + TEXT_ varchar(4000), + TEXT2_ varchar(4000), + TENANT_ID_ varchar(64), + STATE_ varchar(20), + REMOVAL_TIME_ timestamp, + primary key (ID_) +); + +create table ACT_HI_DETAIL ( + ID_ varchar(64) not null, + TYPE_ varchar(255) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + ROOT_PROC_INST_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + VAR_INST_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(64), + REV_ integer, + TIME_ timestamp not null, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double precision, + LONG_ bigint, + TEXT_ varchar(4000), + TEXT2_ varchar(4000), + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + OPERATION_ID_ varchar(64), + REMOVAL_TIME_ timestamp, + INITIAL_ boolean, + primary key (ID_) +); + +create table ACT_HI_IDENTITYLINK ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp not null, + TYPE_ varchar(255), + USER_ID_ varchar(255), + GROUP_ID_ varchar(255), + TASK_ID_ varchar(64), + ROOT_PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + OPERATION_TYPE_ varchar(64), + ASSIGNER_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + REMOVAL_TIME_ timestamp, + primary key (ID_) +); + +create table ACT_HI_COMMENT ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TIME_ timestamp not null, + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + ROOT_PROC_INST_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTION_ varchar(255), + MESSAGE_ varchar(4000), + FULL_MSG_ bytea, + TENANT_ID_ varchar(64), + REMOVAL_TIME_ timestamp, + primary key (ID_) +); + +create table ACT_HI_ATTACHMENT ( + ID_ varchar(64) not null, + REV_ integer, + USER_ID_ varchar(255), + NAME_ varchar(255), + DESCRIPTION_ varchar(4000), + TYPE_ varchar(255), + TASK_ID_ varchar(64), + ROOT_PROC_INST_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + URL_ varchar(4000), + CONTENT_ID_ varchar(64), + TENANT_ID_ varchar(64), + CREATE_TIME_ timestamp, + REMOVAL_TIME_ timestamp, + primary key (ID_) +); + +create table ACT_HI_OP_LOG ( + ID_ varchar(64) not null, + DEPLOYMENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ROOT_PROC_INST_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + JOB_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + BATCH_ID_ varchar(64), + USER_ID_ varchar(255), + TIMESTAMP_ timestamp not null, + OPERATION_TYPE_ varchar(64), + OPERATION_ID_ varchar(64), + ENTITY_TYPE_ varchar(30), + PROPERTY_ varchar(64), + ORG_VALUE_ varchar(4000), + NEW_VALUE_ varchar(4000), + TENANT_ID_ varchar(64), + REMOVAL_TIME_ timestamp, + CATEGORY_ varchar(64), + EXTERNAL_TASK_ID_ varchar(64), + ANNOTATION_ varchar(4000), + primary key (ID_) +); + +create table ACT_HI_INCIDENT ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + ROOT_PROC_INST_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CREATE_TIME_ timestamp not null, + END_TIME_ timestamp, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + ACTIVITY_ID_ varchar(255), + FAILED_ACTIVITY_ID_ varchar(255), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + HISTORY_CONFIGURATION_ varchar(255), + INCIDENT_STATE_ integer, + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + REMOVAL_TIME_ timestamp, + primary key (ID_) +); + +create table ACT_HI_JOB_LOG ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp not null, + JOB_ID_ varchar(64) not null, + JOB_DUEDATE_ timestamp, + JOB_RETRIES_ integer, + JOB_PRIORITY_ bigint NOT NULL DEFAULT 0, + JOB_EXCEPTION_MSG_ varchar(4000), + JOB_EXCEPTION_STACK_ID_ varchar(64), + JOB_STATE_ integer, + JOB_DEF_ID_ varchar(64), + JOB_DEF_TYPE_ varchar(255), + JOB_DEF_CONFIGURATION_ varchar(255), + ACT_ID_ varchar(255), + FAILED_ACT_ID_ varchar(255), + EXECUTION_ID_ varchar(64), + ROOT_PROC_INST_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + HOSTNAME_ varchar(255), + REMOVAL_TIME_ timestamp, + primary key (ID_) +); + +create table ACT_HI_BATCH ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + CREATE_USER_ID_ varchar(255), + START_TIME_ timestamp not null, + END_TIME_ timestamp, + REMOVAL_TIME_ timestamp, + primary key (ID_) +); + +create table ACT_HI_EXT_TASK_LOG ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp not null, + EXT_TASK_ID_ varchar(64) not null, + RETRIES_ integer, + TOPIC_NAME_ varchar(255), + WORKER_ID_ varchar(255), + PRIORITY_ bigint not null default 0, + ERROR_MSG_ varchar(4000), + ERROR_DETAILS_ID_ varchar(64), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ROOT_PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + STATE_ integer, + REMOVAL_TIME_ timestamp, + primary key (ID_) +); + +create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); +create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_); +create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); +create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_TIME_); +create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_); +create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_); + +create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_); +create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_); +create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); +create index ACT_IDX_HI_ACT_INST_COMP on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, PROC_INST_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_); +create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); +create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_AI_PDEFID_END_TIME on ACT_HI_ACTINST(PROC_DEF_ID_, END_TIME_); +create index ACT_IDX_HI_ACT_INST_RM_TIME on ACT_HI_ACTINST(REMOVAL_TIME_); + +create index ACT_IDX_HI_TASKINST_ROOT_PI on ACT_HI_TASKINST(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); +create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_TASKINST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_); +create index ACT_IDX_HI_TASKINSTID_PROCINST on ACT_HI_TASKINST(ID_,PROC_INST_ID_); +create index ACT_IDX_HI_TASK_INST_RM_TIME on ACT_HI_TASKINST(REMOVAL_TIME_); +create index ACT_IDX_HI_TASK_INST_START on ACT_HI_TASKINST(START_TIME_); +create index ACT_IDX_HI_TASK_INST_END on ACT_HI_TASKINST(END_TIME_); + +create index ACT_IDX_HI_DETAIL_ROOT_PI on ACT_HI_DETAIL(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_); +create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_INST on ACT_HI_DETAIL(CASE_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_EXEC on ACT_HI_DETAIL(CASE_EXECUTION_ID_); +create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_); +create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_); +create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_); +create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); +create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); +create index ACT_IDX_HI_DETAIL_BYTEAR on ACT_HI_DETAIL(BYTEARRAY_ID_); +create index ACT_IDX_HI_DETAIL_RM_TIME on ACT_HI_DETAIL(REMOVAL_TIME_); +create index ACT_IDX_HI_DETAIL_TASK_BYTEAR on ACT_HI_DETAIL(BYTEARRAY_ID_, TASK_ID_); +create index ACT_IDX_HI_DETAIL_VAR_INST_ID on ACT_HI_DETAIL(VAR_INST_ID_); + +create index ACT_IDX_HI_IDENT_LNK_ROOT_PI on ACT_HI_IDENTITYLINK(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); +create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); +create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); +create index ACT_IDX_HI_IDENT_LINK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_); +create index ACT_IDX_HI_IDENT_LINK_RM_TIME on ACT_HI_IDENTITYLINK(REMOVAL_TIME_); +create index ACT_IDX_HI_IDENT_LNK_TIMESTAMP on ACT_HI_IDENTITYLINK(TIMESTAMP_); + +create index ACT_IDX_HI_VARINST_ROOT_PI on ACT_HI_VARINST(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_); +create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_); +create index ACT_IDX_HI_CASEVAR_CASE_INST on ACT_HI_VARINST(CASE_INST_ID_); +create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); +create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_VARINST_BYTEAR on ACT_HI_VARINST(BYTEARRAY_ID_); +create index ACT_IDX_HI_VARINST_RM_TIME on ACT_HI_VARINST(REMOVAL_TIME_); +create index ACT_IDX_HI_VAR_PI_NAME_TYPE on ACT_HI_VARINST(PROC_INST_ID_, NAME_, VAR_TYPE_); + +create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); +create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); +create index ACT_IDX_HI_INCIDENT_ROOT_PI on ACT_HI_INCIDENT(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_INCIDENT_PROCINST on ACT_HI_INCIDENT(PROC_INST_ID_); +create index ACT_IDX_HI_INCIDENT_RM_TIME on ACT_HI_INCIDENT(REMOVAL_TIME_); +create index ACT_IDX_HI_INCIDENT_CREATE_TIME on ACT_HI_INCIDENT(CREATE_TIME_); +create index ACT_IDX_HI_INCIDENT_END_TIME on ACT_HI_INCIDENT(END_TIME_); + +create index ACT_IDX_HI_JOB_LOG_ROOT_PI on ACT_HI_JOB_LOG(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_JOB_LOG_PROCINST on ACT_HI_JOB_LOG(PROCESS_INSTANCE_ID_); +create index ACT_IDX_HI_JOB_LOG_PROCDEF on ACT_HI_JOB_LOG(PROCESS_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); +create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); +create index ACT_IDX_HI_JOB_LOG_EX_STACK on ACT_HI_JOB_LOG(JOB_EXCEPTION_STACK_ID_); +create index ACT_IDX_HI_JOB_LOG_RM_TIME on ACT_HI_JOB_LOG(REMOVAL_TIME_); +create index ACT_IDX_HI_JOB_LOG_JOB_CONF on ACT_HI_JOB_LOG(JOB_DEF_CONFIGURATION_); + +create index ACT_HI_BAT_RM_TIME on ACT_HI_BATCH(REMOVAL_TIME_); + +create index ACT_HI_EXT_TASK_LOG_ROOT_PI on ACT_HI_EXT_TASK_LOG(ROOT_PROC_INST_ID_); +create index ACT_HI_EXT_TASK_LOG_PROCINST on ACT_HI_EXT_TASK_LOG(PROC_INST_ID_); +create index ACT_HI_EXT_TASK_LOG_PROCDEF on ACT_HI_EXT_TASK_LOG(PROC_DEF_ID_); +create index ACT_HI_EXT_TASK_LOG_PROC_DEF_KEY on ACT_HI_EXT_TASK_LOG(PROC_DEF_KEY_); +create index ACT_HI_EXT_TASK_LOG_TENANT_ID on ACT_HI_EXT_TASK_LOG(TENANT_ID_); +create index ACT_IDX_HI_EXTTASKLOG_ERRORDET on ACT_HI_EXT_TASK_LOG(ERROR_DETAILS_ID_); +create index ACT_HI_EXT_TASK_LOG_RM_TIME on ACT_HI_EXT_TASK_LOG(REMOVAL_TIME_); + +create index ACT_IDX_HI_OP_LOG_ROOT_PI on ACT_HI_OP_LOG(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); +create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); +create index ACT_IDX_HI_OP_LOG_TASK on ACT_HI_OP_LOG(TASK_ID_); +create index ACT_IDX_HI_OP_LOG_RM_TIME on ACT_HI_OP_LOG(REMOVAL_TIME_); +create index ACT_IDX_HI_OP_LOG_TIMESTAMP on ACT_HI_OP_LOG(TIMESTAMP_); +create index ACT_IDX_HI_OP_LOG_USER_ID on ACT_HI_OP_LOG(USER_ID_); +create index ACT_IDX_HI_OP_LOG_OP_TYPE on ACT_HI_OP_LOG(OPERATION_TYPE_); +create index ACT_IDX_HI_OP_LOG_ENTITY_TYPE on ACT_HI_OP_LOG(ENTITY_TYPE_); + +create index ACT_IDX_HI_ATTACHMENT_CONTENT on ACT_HI_ATTACHMENT(CONTENT_ID_); +create index ACT_IDX_HI_ATTACHMENT_ROOT_PI on ACT_HI_ATTACHMENT(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_ATTACHMENT_PROCINST on ACT_HI_ATTACHMENT(PROC_INST_ID_); +create index ACT_IDX_HI_ATTACHMENT_TASK on ACT_HI_ATTACHMENT(TASK_ID_); +create index ACT_IDX_HI_ATTACHMENT_RM_TIME on ACT_HI_ATTACHMENT(REMOVAL_TIME_); + +create index ACT_IDX_HI_COMMENT_TASK on ACT_HI_COMMENT(TASK_ID_); +create index ACT_IDX_HI_COMMENT_ROOT_PI on ACT_HI_COMMENT(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_COMMENT_PROCINST on ACT_HI_COMMENT(PROC_INST_ID_); +create index ACT_IDX_HI_COMMENT_RM_TIME on ACT_HI_COMMENT(REMOVAL_TIME_); +-- +-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH +-- under one or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information regarding copyright +-- ownership. Camunda licenses this file to you under the Apache License, +-- Version 2.0; you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +create table ACT_HI_CASEINST ( + ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64) not null, + CREATE_TIME_ timestamp not null, + CLOSE_TIME_ timestamp, + DURATION_ bigint, + STATE_ integer, + CREATE_USER_ID_ varchar(255), + SUPER_CASE_INSTANCE_ID_ varchar(64), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_), + unique (CASE_INST_ID_) +); + +create table ACT_HI_CASEACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + CASE_ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + CASE_ACT_NAME_ varchar(255), + CASE_ACT_TYPE_ varchar(255), + CREATE_TIME_ timestamp not null, + END_TIME_ timestamp, + DURATION_ bigint, + STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +); + +create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_); +create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_); +create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); +create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_); +create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_); +create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); +-- +-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH +-- under one or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information regarding copyright +-- ownership. Camunda licenses this file to you under the Apache License, +-- Version 2.0; you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- create history decision instance table -- +create table ACT_HI_DECINST ( + ID_ varchar(64) NOT NULL, + DEC_DEF_ID_ varchar(64) NOT NULL, + DEC_DEF_KEY_ varchar(255) NOT NULL, + DEC_DEF_NAME_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + EVAL_TIME_ timestamp not null, + REMOVAL_TIME_ timestamp, + COLLECT_VALUE_ double precision, + USER_ID_ varchar(255), + ROOT_DEC_INST_ID_ varchar(64), + ROOT_PROC_INST_ID_ varchar(64), + DEC_REQ_ID_ varchar(64), + DEC_REQ_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +); + +-- create history decision input table -- +create table ACT_HI_DEC_IN ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64), + CLAUSE_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double precision, + LONG_ bigint, + TEXT_ varchar(4000), + TEXT2_ varchar(4000), + TENANT_ID_ varchar(64), + CREATE_TIME_ timestamp, + ROOT_PROC_INST_ID_ varchar(64), + REMOVAL_TIME_ timestamp, + primary key (ID_) +); + +-- create history decision output table -- +create table ACT_HI_DEC_OUT ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64), + CLAUSE_NAME_ varchar(255), + RULE_ID_ varchar(64), + RULE_ORDER_ integer, + VAR_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double precision, + LONG_ bigint, + TEXT_ varchar(4000), + TEXT2_ varchar(4000), + TENANT_ID_ varchar(64), + CREATE_TIME_ timestamp, + ROOT_PROC_INST_ID_ varchar(64), + REMOVAL_TIME_ timestamp, + primary key (ID_) +); + + +create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); +create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); +create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); +create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); +create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); +create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); +create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); +create index ACT_IDX_HI_DEC_INST_ROOT_ID on ACT_HI_DECINST(ROOT_DEC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_ID on ACT_HI_DECINST(DEC_REQ_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_KEY on ACT_HI_DECINST(DEC_REQ_KEY_); +create index ACT_IDX_HI_DEC_INST_ROOT_PI on ACT_HI_DECINST(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_RM_TIME on ACT_HI_DECINST(REMOVAL_TIME_); + +create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); +create index ACT_IDX_HI_DEC_IN_ROOT_PI on ACT_HI_DEC_IN(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_DEC_IN_RM_TIME on ACT_HI_DEC_IN(REMOVAL_TIME_); + +create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); +create index ACT_IDX_HI_DEC_OUT_ROOT_PI on ACT_HI_DEC_OUT(ROOT_PROC_INST_ID_); +create index ACT_IDX_HI_DEC_OUT_RM_TIME on ACT_HI_DEC_OUT(REMOVAL_TIME_); diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_2__postgres_identity_7.14.0.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_2__postgres_identity_7.14.0.sql new file mode 100644 index 00000000..5b63794f --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_2__postgres_identity_7.14.0.sql @@ -0,0 +1,109 @@ +-- +-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH +-- under one or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information regarding copyright +-- ownership. Camunda licenses this file to you under the Apache License, +-- Version 2.0; you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +create table ACT_ID_GROUP ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + TYPE_ varchar(255), + primary key (ID_) +); + +create table ACT_ID_MEMBERSHIP ( + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (USER_ID_, GROUP_ID_) +); + +create table ACT_ID_USER ( + ID_ varchar(64), + REV_ integer, + FIRST_ varchar(255), + LAST_ varchar(255), + EMAIL_ varchar(255), + PWD_ varchar(255), + SALT_ varchar(255), + LOCK_EXP_TIME_ timestamp, + ATTEMPTS_ integer, + PICTURE_ID_ varchar(64), + primary key (ID_) +); + +create table ACT_ID_INFO ( + ID_ varchar(64), + REV_ integer, + USER_ID_ varchar(64), + TYPE_ varchar(64), + KEY_ varchar(255), + VALUE_ varchar(255), + PASSWORD_ bytea, + PARENT_ID_ varchar(255), + primary key (ID_) +); + +create table ACT_ID_TENANT ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + primary key (ID_) +); + +create table ACT_ID_TENANT_MEMBER ( + ID_ varchar(64) not null, + TENANT_ID_ varchar(64) not null, + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (ID_) +); + +create index ACT_IDX_MEMB_GROUP on ACT_ID_MEMBERSHIP(GROUP_ID_); +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + +create index ACT_IDX_MEMB_USER on ACT_ID_MEMBERSHIP(USER_ID_); +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_USER + unique (TENANT_ID_, USER_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_GROUP + unique (TENANT_ID_, GROUP_ID_); + +create index ACT_IDX_TENANT_MEMB on ACT_ID_TENANT_MEMBER(TENANT_ID_); +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB + foreign key (TENANT_ID_) + references ACT_ID_TENANT (ID_); + +create index ACT_IDX_TENANT_MEMB_USER on ACT_ID_TENANT_MEMBER(USER_ID_); +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +create index ACT_IDX_TENANT_MEMB_GROUP on ACT_ID_TENANT_MEMBER(GROUP_ID_); +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_3__admin.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_3__admin.sql new file mode 100644 index 00000000..57e037cb --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_3__admin.sql @@ -0,0 +1,46 @@ +-- Create admin user (password: admin) +INSERT INTO ACT_ID_USER (ID_, REV_, FIRST_, LAST_, EMAIL_, PWD_, PICTURE_ID_) +VALUES ('admin', 1, 'Admin', 'Administratus', 'bpm@holunda.io', '{SHA}0DPiKuNIrrVmD8IUCuw1hQxNqZc=', null); + +-- Create admin group +INSERT INTO ACT_ID_GROUP (ID_, REV_, NAME_, TYPE_) +VALUES ('camunda-admin', 1, 'Camunda BPM Administrators', 'SYSTEM'); + +-- Add admin user to admin group +INSERT into ACT_ID_MEMBERSHIP (USER_ID_, GROUP_ID_) +VALUES ('admin', 'camunda-admin'); + +-- Add authorizations +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A1', 1, 1, null, 'admin', 1, 'admin', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A2', 1, 1, 'camunda-admin', null, 0, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A3', 1, 1, 'camunda-admin', null, 1, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A4', 1, 1, 'camunda-admin', null, 2, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A5', 1, 1, 'camunda-admin', null, 3, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A6', 1, 1, 'camunda-admin', null, 4, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A7', 1, 1, 'camunda-admin', null, 5, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A8', 1, 1, 'camunda-admin', null, 6, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A9', 1, 1, 'camunda-admin', null, 7, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A10', 1, 1, 'camunda-admin', null, 8, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A11', 1, 1, 'camunda-admin', null, 9, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A12', 1, 1, 'camunda-admin', null, 10, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A13', 1, 1, 'camunda-admin', null, 11, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A14', 1, 1, 'camunda-admin', null, 12, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A15', 1, 1, 'camunda-admin', null, 13, '*', 2147483647); +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A16', 1, 1, 'camunda-admin', null, 14, '*', 2147483647); + diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_4__tasklist filters.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_4__tasklist filters.sql new file mode 100644 index 00000000..c73b5803 --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_4__tasklist filters.sql @@ -0,0 +1,7 @@ +-- All tasks excludes just for admin +INSERT INTO ACT_RU_FILTER (ID_, REV_, RESOURCE_TYPE_, NAME_, OWNER_, QUERY_, PROPERTIES_) +VALUES ('F000', 1, 'Task', 'All Tasks', 'admin', '{}', + '{"showUndefinedVariable":false,"description":"All tasks (for admin use only!)","refresh":true,"priority":0}'); + +INSERT INTO ACT_RU_AUTHORIZATION (ID_, REV_, TYPE_, GROUP_ID_, USER_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_) +VALUES ('A20', 1, 1, null, 'admin', 5, 'F000', 2147483647); diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_5__axon.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_5__axon.sql new file mode 100644 index 00000000..57a412ce --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_5__axon.sql @@ -0,0 +1,75 @@ +CREATE SEQUENCE hibernate_sequence START WITH 1 INCREMENT BY 1; + +CREATE TABLE association_value_entry +( + id BIGINT NOT NULL, + association_key VARCHAR(255) NOT NULL, + association_value VARCHAR(255), + saga_id VARCHAR(255) NOT NULL, + saga_type VARCHAR(255), + PRIMARY KEY (id) +); + +CREATE TABLE domain_event_entry +( + global_index BIGINT NOT NULL, + event_identifier VARCHAR(255) NOT NULL, + meta_data BYTEA, + payload BYTEA NOT NULL, + payload_revision VARCHAR(255), + payload_type VARCHAR(255) NOT NULL, + time_stamp VARCHAR(255) NOT NULL, + aggregate_identifier VARCHAR(255) NOT NULL, + sequence_number BIGINT NOT NULL, + type VARCHAR(255), + PRIMARY KEY (global_index) +); + +CREATE TABLE saga_entry +( + saga_id VARCHAR(255) NOT NULL, + revision VARCHAR(255), + saga_type VARCHAR(255), + serialized_saga BYTEA, + PRIMARY KEY (saga_id) +); + +CREATE TABLE snapshot_event_entry +( + aggregate_identifier VARCHAR(255) NOT NULL, + sequence_number BIGINT NOT NULL, + type VARCHAR(255) NOT NULL, + event_identifier VARCHAR(255) NOT NULL, + meta_data BYTEA, + payload BYTEA NOT NULL, + payload_revision VARCHAR(255), + payload_type VARCHAR(255) NOT NULL, + time_stamp VARCHAR(255) NOT NULL, + PRIMARY KEY (aggregate_identifier, sequence_number, type) +); + +CREATE TABLE token_entry +( + processor_name VARCHAR(255) NOT NULL, + segment INTEGER NOT NULL, + owner VARCHAR(255), + timestamp VARCHAR(255) NOT NULL, + token BYTEA, + token_type VARCHAR(255), + PRIMARY KEY (processor_name, segment) +); + + +CREATE INDEX IDXk45eqnxkgd8hpdn6xixn8sgft ON association_value_entry (saga_type, association_key, association_value); +CREATE INDEX IDXgv5k1v2mh6frxuy5c0hgbau94 ON association_value_entry (saga_id, saga_type); + +ALTER TABLE domain_event_entry + ADD CONSTRAINT UK8s1f994p4la2ipb13me2xqm1w UNIQUE (aggregate_identifier, sequence_number); + +ALTER TABLE domain_event_entry + ADD CONSTRAINT UK_fwe6lsa8bfo6hyas6ud3m8c7x UNIQUE (event_identifier); + +ALTER TABLE snapshot_event_entry + ADD CONSTRAINT UK_e1uucjseo68gopmnd0vgdl44h UNIQUE (event_identifier); + + diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_6__request.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_6__request.sql new file mode 100644 index 00000000..d4aee7e2 --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_6__request.sql @@ -0,0 +1,9 @@ +create table APP_APPROVAL_REQUEST +( + id varchar(255) not null, + amount decimal(10, 2), + applicant varchar(255), + currency varchar(255), + subject varchar(255), + primary key (id) +); diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_7__postgres_engine_7.14_to_7.15.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_7__postgres_engine_7.14_to_7.15.sql new file mode 100644 index 00000000..259227b6 --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_7__postgres_engine_7.14_to_7.15.sql @@ -0,0 +1,37 @@ +-- +-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH +-- under one or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information regarding copyright +-- ownership. Camunda licenses this file to you under the Apache License, +-- Version 2.0; you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +insert into ACT_GE_SCHEMA_LOG +values ('400', CURRENT_TIMESTAMP, '7.15.0'); + +-- https://jira.camunda.com/browse/CAM-13013 + +create table ACT_RU_TASK_METER_LOG ( + ID_ varchar(64) not null, + ASSIGNEE_HASH_ bigint, + TIMESTAMP_ timestamp, + primary key (ID_) +); + +create index ACT_IDX_TASK_METER_LOG_TIME on ACT_RU_TASK_METER_LOG(TIMESTAMP_); + +-- https://jira.camunda.com/browse/CAM-13060 +ALTER TABLE ACT_RU_INCIDENT + ADD ANNOTATION_ varchar(4000); + +ALTER TABLE ACT_HI_INCIDENT + ADD ANNOTATION_ varchar(4000); diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_8__jpa_view.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_8__jpa_view.sql new file mode 100644 index 00000000..10b3884b --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_8__jpa_view.sql @@ -0,0 +1,163 @@ +CREATE TABLE plf_data_entry ( + entry_id VARCHAR(255) NOT NULL, + entry_type VARCHAR(255) NOT NULL, + application_name VARCHAR(255) NOT NULL, + date_created TIMESTAMP NOT NULL, + description VARCHAR(2048), + form_key VARCHAR(255), + date_last_modified TIMESTAMP NOT NULL, + name VARCHAR(255) NOT NULL, + payload BYTEA, + revision INT8, + processing_type VARCHAR(255) NOT NULL, + state VARCHAR(255) NOT NULL, + type VARCHAR(255) NOT NULL, + PRIMARY KEY (entry_id, entry_type) +); + +CREATE TABLE plf_data_entry_authorizations ( + entry_id VARCHAR(255) NOT NULL, + entry_type VARCHAR(255) NOT NULL, + authorized_principal VARCHAR(255) NOT NULL, + PRIMARY KEY (entry_id, entry_type, authorized_principal) +); + +CREATE TABLE plf_data_entry_payload_attributes ( + entry_id VARCHAR(255) NOT NULL, + entry_type VARCHAR(255) NOT NULL, + path VARCHAR(255) NOT NULL, + value VARCHAR(255) NOT NULL, + PRIMARY KEY (entry_id, entry_type, path, value) +); + +CREATE TABLE plf_data_entry_protocol ( + id VARCHAR(255) NOT NULL, + log_details VARCHAR(255), + log_message VARCHAR(255), + processing_type VARCHAR(255) NOT NULL, + state VARCHAR(255) NOT NULL, + time TIMESTAMP NOT NULL, + username VARCHAR(255), + entry_id VARCHAR(255) NOT NULL, + entry_type VARCHAR(255) NOT NULL, + PRIMARY KEY (id) +); + +CREATE TABLE plf_proc_def ( + proc_def_id VARCHAR(255) NOT NULL, + application_name VARCHAR(255) NOT NULL, + description VARCHAR(2048), + name VARCHAR(255) NOT NULL, + proc_def_key VARCHAR(255) NOT NULL, + proc_def_version INT4 NOT NULL, + start_form_key VARCHAR(255), + startable_from_tasklist BOOLEAN, + version_tag VARCHAR(255), + PRIMARY KEY (proc_def_id) +); + +CREATE TABLE plf_proc_def_authorizations ( + proc_def_id VARCHAR(255) NOT NULL, + authorized_starter_principal VARCHAR(255) NOT NULL, + PRIMARY KEY (proc_def_id, authorized_starter_principal) +); + +CREATE TABLE plf_proc_instance ( + instance_id VARCHAR(255) NOT NULL, + business_key VARCHAR(255), + delete_reason VARCHAR(255), + end_activity_id VARCHAR(255), + application_name VARCHAR(255) NOT NULL, + source_def_id VARCHAR(255) NOT NULL, + source_def_key VARCHAR(255) NOT NULL, + source_execution_id VARCHAR(255) NOT NULL, + source_instance_id VARCHAR(255) NOT NULL, + source_name VARCHAR(255) NOT NULL, + source_type VARCHAR(255) NOT NULL, + source_tenant_id VARCHAR(255), + start_activity_id VARCHAR(255), + start_user_id VARCHAR(255), + run_state VARCHAR(255) NOT NULL, + super_instance_id VARCHAR(255), + PRIMARY KEY (instance_id) +); + +CREATE TABLE plf_task ( + task_id VARCHAR(255) NOT NULL, + assignee_id VARCHAR(255), + business_key VARCHAR(255), + date_created TIMESTAMP NOT NULL, + description VARCHAR(2048), + date_due TIMESTAMP, + date_follow_up TIMESTAMP, + form_key VARCHAR(255), + name VARCHAR(255) NOT NULL, + owner_id VARCHAR(255), + payload BYTEA, + priority INT4, + application_name VARCHAR(255) NOT NULL, + source_def_id VARCHAR(255) NOT NULL, + source_def_key VARCHAR(255) NOT NULL, + source_execution_id VARCHAR(255) NOT NULL, + source_instance_id VARCHAR(255) NOT NULL, + source_name VARCHAR(255) NOT NULL, + source_type VARCHAR(255) NOT NULL, + source_tenant_id VARCHAR(255), + task_def_key VARCHAR(255) NOT NULL, + PRIMARY KEY (task_id) +); + +CREATE TABLE plf_task_authorizations ( + task_id VARCHAR(255) NOT NULL, + authorized_principal VARCHAR(255) NOT NULL, + PRIMARY KEY (task_id, authorized_principal) +); + +CREATE TABLE plf_task_correlations ( + task_id VARCHAR(255) NOT NULL, + entry_id VARCHAR(255) NOT NULL, + entry_type VARCHAR(255) NOT NULL, + PRIMARY KEY (task_id, entry_id, entry_type) +); + +CREATE TABLE plf_task_payload_attributes ( + task_id VARCHAR(255) NOT NULL, + path VARCHAR(255) NOT NULL, + value VARCHAR(255) NOT NULL, + PRIMARY KEY (task_id, path, value) +); + +ALTER TABLE plf_data_entry_authorizations + ADD CONSTRAINT FK_authorizations_have_data_entry + FOREIGN KEY (entry_id, entry_type) + REFERENCES plf_data_entry; + +ALTER TABLE plf_data_entry_payload_attributes + ADD CONSTRAINT FK_payload_attributes_have_data_entry + FOREIGN KEY (entry_id, entry_type) + REFERENCES plf_data_entry; + +ALTER TABLE plf_data_entry_protocol + ADD CONSTRAINT FK_protocol_have_data_entry + FOREIGN KEY (entry_id, entry_type) + REFERENCES plf_data_entry; + +ALTER TABLE plf_proc_def_authorizations + ADD CONSTRAINT FK_authorizations_have_proc_def + FOREIGN KEY (proc_def_id) + REFERENCES plf_proc_def; + +ALTER TABLE plf_task_authorizations + ADD CONSTRAINT FK_authorizations_have_task + FOREIGN KEY (task_id) + REFERENCES plf_task; + +ALTER TABLE plf_task_correlations + ADD CONSTRAINT FK_correlation_have_task + FOREIGN KEY (task_id) + REFERENCES plf_task; + +ALTER TABLE plf_task_payload_attributes + ADD CONSTRAINT FK_payload_attributes_have_task + FOREIGN KEY (task_id) + REFERENCES plf_task; diff --git a/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_9__postgres_engine_7.15_to_7.16.sql b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_9__postgres_engine_7.15_to_7.16.sql new file mode 100644 index 00000000..ec0c9e80 --- /dev/null +++ b/scenarios/single-node-simple/src/main/resources/db/migrations/h2-postgresql/V0_0_9__postgres_engine_7.15_to_7.16.sql @@ -0,0 +1,30 @@ +-- +-- Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH +-- under one or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information regarding copyright +-- ownership. Camunda licenses this file to you under the Apache License, +-- Version 2.0; you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +insert into ACT_GE_SCHEMA_LOG +values ('500', CURRENT_TIMESTAMP, '7.16.0'); + +create table ACT_RE_CAMFORMDEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + KEY_ varchar(255) NOT NULL, + VERSION_ integer NOT NULL, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +); \ No newline at end of file diff --git a/scenarios/single-node-simple/src/test/kotlin/io/holunda/polyflow/example/process/approval/SingleNodeScenarioContextStartIT.kt b/scenarios/single-node-simple/src/test/kotlin/io/holunda/polyflow/example/process/approval/SingleNodeScenarioContextStartIT.kt new file mode 100644 index 00000000..a9afb8ef --- /dev/null +++ b/scenarios/single-node-simple/src/test/kotlin/io/holunda/polyflow/example/process/approval/SingleNodeScenarioContextStartIT.kt @@ -0,0 +1,21 @@ +package io.holunda.polyflow.example.process.approval + +import io.holunda.polyflow.view.auth.UserService +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.test.context.SpringBootTest +import org.springframework.test.context.ActiveProfiles + +@SpringBootTest +@ActiveProfiles("itest", "jpa") +class SingleNodeScenarioContextStartIT { + + @Autowired + lateinit var userService: UserService + + @Test + fun `should start application`() { + assertThat(userService.getUser("37bff195-06fe-4788-9480-a7d9ac6474e1").username).isEqualTo("kermit") + } +} diff --git a/scenarios/single-node-simple/src/test/kotlin/io/holunda/polyflow/serializer/gdpr/AnnotationBasedDetectionStrategyTest.kt b/scenarios/single-node-simple/src/test/kotlin/io/holunda/polyflow/serializer/gdpr/AnnotationBasedDetectionStrategyTest.kt new file mode 100644 index 00000000..82f92755 --- /dev/null +++ b/scenarios/single-node-simple/src/test/kotlin/io/holunda/polyflow/serializer/gdpr/AnnotationBasedDetectionStrategyTest.kt @@ -0,0 +1,5 @@ +package io.holunda.polyflow.serializer.gdpr + +import org.junit.jupiter.api.Assertions.* + +class AnnotationBasedDetectionStrategyTest diff --git a/scenarios/single-node-simple/src/test/resources/application-itest.yml b/scenarios/single-node-simple/src/test/resources/application-itest.yml new file mode 100755 index 00000000..8b137891 --- /dev/null +++ b/scenarios/single-node-simple/src/test/resources/application-itest.yml @@ -0,0 +1 @@ + diff --git a/scenarios/single-node-simple/src/test/resources/banner.txt b/scenarios/single-node-simple/src/test/resources/banner.txt new file mode 100644 index 00000000..d18e06bb --- /dev/null +++ b/scenarios/single-node-simple/src/test/resources/banner.txt @@ -0,0 +1,4 @@ +=============================================================================== +Single Node Example I-Test +=============================================================================== +Spring Boot: ${spring-boot.version} \ No newline at end of file