7.5. Database schema initialization


When you are using SonataFlow with PostgreSQL persistence, you can initialize the database schema either by enabling Flyway or by manually applying database schema updates using Data Definition Language (DDL) scripts.

Flyway is managed by the kie-addons-quarkus-flyway runtime module and it is disabled by default. To enable Flyway, you must configure it using one of the following methods:

7.5.1. Flyway configuration in the workflow ConfigMap

To enable Flyway in the workflow ConfigMap, you can add the following property:

Example of enabling Flyway in the workflow ConfigMap

apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    app: example-workflow
  name: example-workflow-props
data:
  application.properties: |
    kie.flyway.enabled = true

7.5.2. Flyway configuration using environment variables in the workflow container

You can enable Flyway by adding an environment variable to the spec.podTemplate.container field in the SonataFlow CR by using the following example:

Example of enabling Flyway by using the workflow container environment variable

apiVersion: sonataflow.org/v1alpha08
kind: SonataFlow
metadata:
  name: example-workflow
  annotations:
    sonataflow.org/description: Example Workflow
    sonataflow.org/version: 0.0.1
spec:
  podTemplate:
    container:
      env:
        - name: KIE_FLYWAY_ENABLED
          value: 'true'
  flow: ...

7.5.3. Flyway configuration using SonataFlowPlatform properties

To apply a common Flyway configuration to all workflows within a namespace, you can add the property to the spec.properties.flow field of the SonataFlowPlatform CR shown in the following example:

참고

This configuration is applied during workflow deployment. Ensure the Flyway property is set before deploying workflows.

Example of enabling Flyway by using the SonataFlowPlatform properties

apiVersion: sonataflow.org/v1alpha08
kind: SonataFlowPlatform
metadata:
  name: sonataflow-platform
spec:
  properties:
    flow:
      - name: kie.flyway.enabled
        value: true

7.5.4. Initializing a manual database using DDL scripts

If you prefer manual initialization, you must disable Flyway by ensuring the kie.flyway.enabled property is either not configured or explicitly set to false.

  • By default, each workflow uses a schema name equal to the workflow name. Ensure that you manually apply the schema initialization for each workflow.
  • If you are using the SonataFlow custom resource (CR) persistence configuration, you can specify a custom schema name.

Procedure

  1. Download the DDL scripts from the kogito-ddl-9.103.0.redhat-00003-db-scripts.zip location.
  2. Extract the files.
  3. Run the .sql files located in the root directory on the target PostgreSQL database. Ensure that the files are executed in the order of their version numbers.

    For example:

    • V1.35.0__create_runtime_PostgreSQL.sql
    • V10.0.0__add_business_key_PostgreSQL.sql
    • V10.0.1__alter_correlation_PostgreSQL.sql

      참고

      The file version numbers are not associated with the OpenShift Serverless Logic Operator versioning.

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동