Add ACM db upgrade/downgrade to db-migrator 27/137727/1
authorwaynedunican <wayne.dunican@est.tech>
Thu, 18 Apr 2024 16:09:52 +0000 (17:09 +0100)
committerwaynedunican <wayne.dunican@est.tech>
Tue, 23 Apr 2024 14:58:19 +0000 (15:58 +0100)
Issue-ID: POLICY-4934
Change-Id: Ic515eb1b2d549fdd91cff22ed6f589b673748657
Signed-off-by: waynedunican <wayne.dunican@est.tech>
63 files changed:
compose/config/clamp/AcRuntimeParameters.yaml
compose/docker-compose.yml
helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml
helm/policy/templates/job.yaml
helm/policy/values.yaml
policy-db-migrator/src/main/docker/Dockerfile
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0100-automationcomposition.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0200-automationcompositiondefinition.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0300-automationcompositionelement.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0400-nodetemplatestate.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0500-participant.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0600-participantsupportedelements.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0700-ac_compositionId_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0800-ac_element_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0900-dt_element_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1000-supported_element_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1100-automationcompositionelement_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1200-nodetemplate_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1300-participantsupportedelements_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0100-automationcomposition.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0200-automationcompositiondefinition.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0300-automationcompositionelement.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0400-nodetemplatestate.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0500-participant.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0600-participantsupportedelements.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0700-ac_compositionId_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0800-ac_element_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0900-dt_element_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1000-supported_element_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1100-automationcompositionelement_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1200-nodetemplate_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1300-participantsupportedelements_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0100-automationcomposition.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0200-automationcompositiondefinition.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0300-automationcompositionelement.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0400-nodetemplatestate.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0500-participant.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0600-participantsupportedelements.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0700-ac_compositionId_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0800-ac_element_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0900-dt_element_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1000-supported_element_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1100-automationcompositionelement_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1200-nodetemplate_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1300-participantsupportedelements_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0100-automationcomposition.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0200-automationcompositiondefinition.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0300-automationcompositionelement.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0400-nodetemplatestate.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0500-participant.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0600-participantsupportedelements.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0700-ac_compositionId_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0800-ac_element_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0900-dt_element_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1000-supported_element_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1100-automationcompositionelement_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1200-nodetemplate_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1300-participantsupportedelements_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/db-migrator
policy-db-migrator/src/main/docker/db-migrator-pg
policy-db-migrator/src/main/docker/prepare_downgrade.sh
policy-db-migrator/src/main/docker/prepare_upgrade.sh
policy-db-migrator/src/main/docker/suse.Dockerfile

index 262f10c..c61428d 100644 (file)
@@ -18,7 +18,7 @@ spring:
       maximumPoolSize: 10
   jpa:
     hibernate:
-      ddl-auto: update
+      ddl-auto: none
       naming:
         physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
         implicit-strategy: org.onap.policy.common.spring.utils.CustomImplicitNamingStrategy
index 0264b29..60ed0bc 100644 (file)
@@ -35,7 +35,7 @@ services:
       container_name: policy-db-migrator
       hostname: policy-db-migrator
       depends_on:
-        - mariadb
+       - mariadb
       expose:
        - 6824
       env_file: ./config/db/db.conf
@@ -51,6 +51,27 @@ services:
                 '/opt/app/policy/bin/db_migrator_policy_init.sh',
                 'mariadb', '3306'
                ]
+   policy-db-migrator-clamp:
+     image: ${CONTAINER_LOCATION}onap/policy-db-migrator:${POLICY_DOCKER_VERSION}
+     container_name: policy-db-migrator-clamp
+     hostname: policy-db-migrator-clamp
+     depends_on:
+       - mariadb
+     expose:
+       - 6824
+     env_file: ./config/db/db.conf
+     environment:
+       SQL_DB: clampacm
+       SQL_HOST: mariadb
+     volumes:
+       - ./config/db-migrator/init.sh:/opt/app/policy/bin/db_migrator_policy_init.sh:ro
+       - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro
+     entrypoint: /opt/app/policy/bin/wait_for_port.sh
+     command: [
+       '-c',
+       '/opt/app/policy/bin/db_migrator_policy_init.sh',
+       'mariadb', '3306'
+     ]
    simulator:
       image: ${CONTAINER_LOCATION}onap/policy-models-simulator:${POLICY_MODELS_VERSION}
       container_name: simulator
@@ -240,7 +261,7 @@ services:
       image: ${CONTAINER_LOCATION}onap/policy-clamp-runtime-acm:${POLICY_CLAMP_VERSION}
       container_name: policy-clamp-runtime-acm
       depends_on:
-       - mariadb
+       - policy-db-migrator-clamp
        - kafka
        - policy-clamp-ac-http-ppnt
        - policy-clamp-ac-k8s-ppnt
index 0858af3..138b114 100755 (executable)
@@ -36,7 +36,7 @@ spring:
       maximumPoolSize: 10
   jpa:
     hibernate:
-      ddl-auto: update
+      ddl-auto: none
       naming:
         physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
         implicit-strategy: org.onap.policy.common.spring.utils.CustomImplicitNamingStrategy
index eee143b..560cea0 100755 (executable)
@@ -127,12 +127,96 @@ spec:
                 apiVersion: v1
                 fieldPath: metadata.namespace
       containers:
-      - name: policy-galera-db-migrator
-        image: {{ .Values.global.repository }}/{{ .Values.dbmigrator.image }}
+      - name: policy-galera-db-migrator-policy
+        image: {{ .Values.global.dockerRepository }}/{{ .Values.dbmigrator.image }}
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        volumeMounts:
+          - mountPath: /dbcmd-config/db_migrator_policy_init.sh
+            name: {{ .Chart.Name }}-policy-config
+            subPath: db_migrator_policy_init.sh
+        command:
+          - /bin/sh
+          - -cx
+          - |
+            /dbcmd-config/db_migrator_policy_init.sh
+        env:
+          - name: SQL_HOST
+            value: "{{ index .Values "mariadb-galera" "service" "name" }}"
+          - name: SQL_USER
+            valueFrom:
+              secretKeyRef:
+                name: mariadb-galera-db-user-credentials
+                key: login
+                optional: false
+          - name: SQL_PASSWORD
+            valueFrom:
+              secretKeyRef:
+                name: mariadb-galera-db-user-credentials
+                key: password
+                optional: false
+          - name: SQL_DB
+            value: {{ .Values.dbmigrator.policyadmin.schema }}
+          - name: POLICY_HOME
+            value: {{ .Values.dbmigrator.policy_home }}
+          - name: SCRIPT_DIRECTORY
+            value: "sql"
+        resources:
+          limits:
+            cpu: 1
+            memory: 4Gi
+          requests:
+            cpu: 100m
+            memory: 1Gi
+      restartPolicy: Never
+      serviceAccountName: {{ .Chart.Name }}-read
+      volumes:
+        - name: {{ .Chart.Name }}-policy-config
+          configMap:
+            name: {{ .Chart.Name }}-db-configmap
+            defaultMode: 0755
+            items:
+              - key: db_migrator_policy_init.sh
+                path: db_migrator_policy_init.sh
+
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: policy-galera-config-clamp
+  namespace: default
+  labels:
+    app: policy-galera-config-clamp
+spec:
+  template:
+    metadata:
+      labels:
+        app: policy-galera-config-clamp
+      name: policy-galera-config-clamp
+    spec:
+      imagePullSecrets:
+      - name: "default-docker-registry-key"
+      initContainers:
+        - name: policy-init-readiness
+          image: {{ .Values.global.repository }}/{{ .Values.global.image.readiness }}
+          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+          command:
+          - /app/ready.py
+          args:
+          - --job-name
+          - policy-galera-config
+          env:
+          - name: NAMESPACE
+            valueFrom:
+              fieldRef:
+                apiVersion: v1
+                fieldPath: metadata.namespace
+      containers:
+      - name: policy-galera-db-migrator-clamp
+        image: {{ .Values.global.dockerRepository }}/{{ .Values.dbmigrator.image }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         volumeMounts:
         - mountPath: /dbcmd-config/db_migrator_policy_init.sh
-          name: {{ .Chart.Name }}-config
+          name: {{ .Chart.Name }}-clamp-config
           subPath: db_migrator_policy_init.sh
         command:
         - /bin/sh
@@ -155,7 +239,7 @@ spec:
               key: password
               optional: false
         - name: SQL_DB
-          value: {{ .Values.dbmigrator.schema }}
+          value: {{ .Values.dbmigrator.clampacm.schema }}
         - name: POLICY_HOME
           value: {{ .Values.dbmigrator.policy_home }}
         - name: SCRIPT_DIRECTORY
@@ -170,11 +254,10 @@ spec:
       restartPolicy: Never
       serviceAccountName: {{ .Chart.Name }}-read
       volumes:
-        - name: {{ .Chart.Name }}-config
+        - name: {{ .Chart.Name }}-clamp-config
           configMap:
             name: {{ .Chart.Name }}-db-configmap
             defaultMode: 0755
             items:
               - key: db_migrator_policy_init.sh
                 path: db_migrator_policy_init.sh
-
index 10d8919..f980325 100755 (executable)
@@ -87,9 +87,12 @@ mariadb:
   image: mariadb:10.5.8
 
 dbmigrator:
-  image: onap/policy-db-migrator:3.1.2-SNAPSHOT
-  schema: policyadmin
+  image: onap/policy-db-migrator:$tag
   policy_home: "/opt/app/policy"
+  policyadmin:
+    schema: policyadmin
+  clampacm:
+    schema: clampacm
 
 subChartsOnly:
   enabled: true
index c234d21..81ea0e2 100644 (file)
@@ -1,7 +1,8 @@
 #-------------------------------------------------------------------------------
 # Dockerfile
 # ============LICENSE_START=======================================================
-#  Copyright (C) 2021-2023 Nordix Foundation.
+#  Copyright (C) 2021 Nordix Foundation.
+#  Modification Copyright 2021-2024 Nordix Foundation.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -53,8 +54,10 @@ COPY --chown=policy:policy ./db-migrator $POLICY_BIN/
 COPY --chown=policy:policy ./db-migrator-pg $POLICY_BIN/
 COPY --chown=policy:policy ./prepare_upgrade.sh $POLICY_BIN/
 COPY --chown=policy:policy ./prepare_downgrade.sh $POLICY_BIN/
-COPY --chown=policy:policy ./config/policyadmin/sql /home/policy/sql
-COPY --chown=policy:policy ./config/policyadmin/postgres /home/policy/postgres
+COPY --chown=policy:policy ./config/policyadmin/sql /home/policyadmin/sql
+COPY --chown=policy:policy ./config/policyadmin/postgres /home/policyadmin/postgres
+COPY --chown=policy:policy ./config/clampacm/sql /home/clampacm/sql
+COPY --chown=policy:policy ./config/clampacm/postgres /home/clampacm/postgres
 
 WORKDIR $POLICY_BIN
 USER policy:policy
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0100-automationcomposition.sql
new file mode 100644 (file)
index 0000000..f17216f
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP TABLE clampacm.automationcomposition;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0200-automationcompositiondefinition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0200-automationcompositiondefinition.sql
new file mode 100644 (file)
index 0000000..9ef6e9c
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP TABLE clampacm.automationcompositiondefinition;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0300-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0300-automationcompositionelement.sql
new file mode 100644 (file)
index 0000000..2255d08
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP TABLE clampacm.automationcompositionelement;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0400-nodetemplatestate.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0400-nodetemplatestate.sql
new file mode 100644 (file)
index 0000000..7aee61b
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP TABLE clampacm.nodetemplatestate;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0500-participant.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0500-participant.sql
new file mode 100644 (file)
index 0000000..3f20fef
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP TABLE clampacm.participant;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0600-participantsupportedelements.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0600-participantsupportedelements.sql
new file mode 100644 (file)
index 0000000..e5ce88a
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP TABLE clampacm.participantsupportedacelements;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0700-ac_compositionId_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0700-ac_compositionId_index.sql
new file mode 100644 (file)
index 0000000..c21fd9e
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP INDEX IF EXISTS ac_element_fk;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0800-ac_element_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0800-ac_element_fk_index.sql
new file mode 100644 (file)
index 0000000..c21fd9e
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP INDEX IF EXISTS ac_element_fk;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0900-dt_element_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0900-dt_element_fk_index.sql
new file mode 100644 (file)
index 0000000..ed57c52
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP INDEX IF EXISTS dt_element_fk;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1000-supported_element_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1000-supported_element_fk_index.sql
new file mode 100644 (file)
index 0000000..41b9329
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP INDEX IF EXISTS supported_element_fk;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1100-automationcompositionelement_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1100-automationcompositionelement_fk.sql
new file mode 100644 (file)
index 0000000..c5b7eb3
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+ALTER TABLE clampacm.automationcompositionelement DROP CONSTRAINT IF EXISTS ac_element_fk;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1200-nodetemplate_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1200-nodetemplate_fk.sql
new file mode 100644 (file)
index 0000000..60ab374
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+ALTER TABLE clampacm.nodetemplatestate DROP CONSTRAINT IF EXISTS dt_element_fk;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1300-participantsupportedelements_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1300-participantsupportedelements_fk.sql
new file mode 100644 (file)
index 0000000..1c54ba3
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+ALTER TABLE clampacm.participantsupportedacelements DROP CONSTRAINT IF EXISTS supported_element_fk;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0100-automationcomposition.sql
new file mode 100644 (file)
index 0000000..93aab9d
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE TABLE clampacm.automationcomposition (instanceId VARCHAR(255) NOT NULL, compositionId VARCHAR(255), compositionTargetId VARCHAR(255), deployState SMALLINT DEFAULT NULL, description VARCHAR(255), lockState SMALLINT DEFAULT NULL, name VARCHAR(255), restarting BOOLEAN, stateChangeResult SMALLINT DEFAULT NULL, version VARCHAR(255), CONSTRAINT PK_AUTOMATIONCOMPOSITION PRIMARY KEY (instanceId));
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0200-automationcompositiondefinition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0200-automationcompositiondefinition.sql
new file mode 100644 (file)
index 0000000..0f9f3dd
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE TABLE clampacm.automationcompositiondefinition (compositionId VARCHAR(255) NOT NULL, name VARCHAR(255), restarting BOOLEAN, serviceTemplate TEXT, state SMALLINT DEFAULT NULL, stateChangeResult SMALLINT DEFAULT NULL, version VARCHAR(255), CONSTRAINT PK_AUTOMATIONCOMPOSITIONDEFINITION PRIMARY KEY (compositionId));
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0300-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0300-automationcompositionelement.sql
new file mode 100644 (file)
index 0000000..a37eb39
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE TABLE clampacm.automationcompositionelement (elementId VARCHAR(255) NOT NULL, definition_name VARCHAR(255), definition_version VARCHAR(255), deployState SMALLINT DEFAULT NULL, description VARCHAR(255), instanceId VARCHAR(255), lockState SMALLINT DEFAULT NULL, message VARCHAR(255), operationalState VARCHAR(255), outProperties TEXT, participantId VARCHAR(255), properties TEXT, restarting BOOLEAN, useState VARCHAR(255), CONSTRAINT PK_AUTOMATIONCOMPOSITIONELEMENT PRIMARY KEY (elementId));
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0400-nodetemplatestate.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0400-nodetemplatestate.sql
new file mode 100644 (file)
index 0000000..c9f7919
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE TABLE clampacm.nodetemplatestate (nodeTemplateStateId VARCHAR(255) NOT NULL, compositionId VARCHAR(255), message VARCHAR(255), nodeTemplate_name VARCHAR(255), nodeTemplate_version VARCHAR(255), outProperties TEXT, participantId VARCHAR(255), restarting BOOLEAN, state SMALLINT DEFAULT NULL, CONSTRAINT PK_NODETEMPLATESTATE PRIMARY KEY (nodeTemplateStateId));
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0500-participant.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0500-participant.sql
new file mode 100644 (file)
index 0000000..e7d4a97
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE TABLE clampacm.participant (participantId VARCHAR(255) NOT NULL, description VARCHAR(255), participantState SMALLINT DEFAULT NULL, CONSTRAINT PK_PARTICIPANT PRIMARY KEY (participantId));
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0600-participantsupportedelements.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0600-participantsupportedelements.sql
new file mode 100644 (file)
index 0000000..1ad60c6
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE TABLE clampacm.participantsupportedacelements (id VARCHAR(255) NOT NULL, participantId VARCHAR(255), typeName VARCHAR(255), typeVersion VARCHAR(255), CONSTRAINT PK_PARTICIPANTSUPPORTEDACELEMENTS PRIMARY KEY (id));
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0700-ac_compositionId_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0700-ac_compositionId_index.sql
new file mode 100644 (file)
index 0000000..e5785f9
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE INDEX ac_compositionId ON clampacm.automationcomposition(compositionId);
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0800-ac_element_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0800-ac_element_fk_index.sql
new file mode 100644 (file)
index 0000000..4c2c2bc
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE INDEX ac_element_fk ON clampacm.automationcompositionelement(instanceId);
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0900-dt_element_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0900-dt_element_fk_index.sql
new file mode 100644 (file)
index 0000000..c67fdd6
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE INDEX dt_element_fk ON clampacm.nodetemplatestate(compositionId);
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1000-supported_element_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1000-supported_element_fk_index.sql
new file mode 100644 (file)
index 0000000..2ecba6f
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE INDEX supported_element_fk ON clampacm.participantsupportedacelements(participantId);
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1100-automationcompositionelement_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1100-automationcompositionelement_fk.sql
new file mode 100644 (file)
index 0000000..6315271
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+ALTER TABLE clampacm.automationcompositionelement ADD CONSTRAINT ac_element_fk FOREIGN KEY (instanceId) REFERENCES clampacm.automationcomposition (instanceId) ON UPDATE RESTRICT ON DELETE RESTRICT;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1200-nodetemplate_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1200-nodetemplate_fk.sql
new file mode 100644 (file)
index 0000000..8581deb
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+ALTER TABLE clampacm.nodetemplatestate ADD CONSTRAINT dt_element_fk FOREIGN KEY (compositionId) REFERENCES clampacm.automationcompositiondefinition (compositionId) ON UPDATE RESTRICT ON DELETE RESTRICT;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1300-participantsupportedelements_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1300-participantsupportedelements_fk.sql
new file mode 100644 (file)
index 0000000..15f284a
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+ALTER TABLE clampacm.participantsupportedacelements ADD CONSTRAINT supported_element_fk FOREIGN KEY (participantId) REFERENCES clampacm.participant (participantId) ON UPDATE RESTRICT ON DELETE RESTRICT;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0100-automationcomposition.sql
new file mode 100644 (file)
index 0000000..f17216f
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP TABLE clampacm.automationcomposition;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0200-automationcompositiondefinition.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0200-automationcompositiondefinition.sql
new file mode 100644 (file)
index 0000000..9ef6e9c
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP TABLE clampacm.automationcompositiondefinition;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0300-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0300-automationcompositionelement.sql
new file mode 100644 (file)
index 0000000..2255d08
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP TABLE clampacm.automationcompositionelement;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0400-nodetemplatestate.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0400-nodetemplatestate.sql
new file mode 100644 (file)
index 0000000..7aee61b
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP TABLE clampacm.nodetemplatestate;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0500-participant.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0500-participant.sql
new file mode 100644 (file)
index 0000000..3f20fef
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP TABLE clampacm.participant;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0600-participantsupportedelements.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0600-participantsupportedelements.sql
new file mode 100644 (file)
index 0000000..e5ce88a
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP TABLE clampacm.participantsupportedacelements;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0700-ac_compositionId_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0700-ac_compositionId_index.sql
new file mode 100644 (file)
index 0000000..cadcea9
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP INDEX ac_element_fk ON clampacm.automationcompositionelement;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0800-ac_element_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0800-ac_element_fk_index.sql
new file mode 100644 (file)
index 0000000..cadcea9
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP INDEX ac_element_fk ON clampacm.automationcompositionelement;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0900-dt_element_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0900-dt_element_fk_index.sql
new file mode 100644 (file)
index 0000000..9a57369
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP INDEX dt_element_fk ON clampacm.nodetemplatestate;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1000-supported_element_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1000-supported_element_fk_index.sql
new file mode 100644 (file)
index 0000000..b5ecf01
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+DROP INDEX supported_element_fk ON clampacm.participantsupportedacelements;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1100-automationcompositionelement_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1100-automationcompositionelement_fk.sql
new file mode 100644 (file)
index 0000000..d37f4b1
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+ALTER TABLE clampacm.automationcompositionelement DROP FOREIGN KEY ac_element_fk;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1200-nodetemplate_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1200-nodetemplate_fk.sql
new file mode 100644 (file)
index 0000000..c03da33
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+ALTER TABLE clampacm.nodetemplatestate DROP FOREIGN KEY dt_element_fk;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1300-participantsupportedelements_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1300-participantsupportedelements_fk.sql
new file mode 100644 (file)
index 0000000..5e61ef1
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+ALTER TABLE clampacm.participantsupportedacelements DROP FOREIGN KEY supported_element_fk;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0100-automationcomposition.sql
new file mode 100644 (file)
index 0000000..edaf2f5
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE TABLE clampacm.automationcomposition (instanceId VARCHAR(255) NOT NULL, compositionId VARCHAR(255) NULL, compositionTargetId VARCHAR(255) NULL, deployState TINYINT DEFAULT NULL NULL, `description` VARCHAR(255) NULL, lockState TINYINT DEFAULT NULL NULL, name VARCHAR(255) NULL, restarting BIT NULL, stateChangeResult TINYINT DEFAULT NULL NULL, version VARCHAR(255) NULL, CONSTRAINT PK_AUTOMATIONCOMPOSITION PRIMARY KEY (instanceId));
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0200-automationcompositiondefinition.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0200-automationcompositiondefinition.sql
new file mode 100644 (file)
index 0000000..22f70b0
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE TABLE clampacm.automationcompositiondefinition (compositionId VARCHAR(255) NOT NULL, name VARCHAR(255) NULL, restarting BIT NULL, serviceTemplate MEDIUMTEXT NULL, state TINYINT DEFAULT NULL NULL, stateChangeResult TINYINT DEFAULT NULL NULL, version VARCHAR(255) NULL, CONSTRAINT PK_AUTOMATIONCOMPOSITIONDEFINITION PRIMARY KEY (compositionId));
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0300-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0300-automationcompositionelement.sql
new file mode 100644 (file)
index 0000000..7bc1853
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE TABLE clampacm.automationcompositionelement (elementId VARCHAR(255) NOT NULL, definition_name VARCHAR(255) NULL, definition_version VARCHAR(255) NULL, deployState TINYINT DEFAULT NULL NULL, `description` VARCHAR(255) NULL, instanceId VARCHAR(255) NULL, lockState TINYINT DEFAULT NULL NULL, message VARCHAR(255) NULL, operationalState VARCHAR(255) NULL, outProperties MEDIUMTEXT NULL, participantId VARCHAR(255) NULL, properties MEDIUMTEXT NULL, restarting BIT NULL, useState VARCHAR(255) NULL, CONSTRAINT PK_AUTOMATIONCOMPOSITIONELEMENT PRIMARY KEY (elementId));
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0400-nodetemplatestate.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0400-nodetemplatestate.sql
new file mode 100644 (file)
index 0000000..3ca27af
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE TABLE clampacm.nodetemplatestate (nodeTemplateStateId VARCHAR(255) NOT NULL, compositionId VARCHAR(255) NULL, message VARCHAR(255) NULL, nodeTemplate_name VARCHAR(255) NULL, nodeTemplate_version VARCHAR(255) NULL, outProperties MEDIUMTEXT NULL, participantId VARCHAR(255) NULL, restarting BIT NULL, state TINYINT DEFAULT NULL NULL, CONSTRAINT PK_NODETEMPLATESTATE PRIMARY KEY (nodeTemplateStateId));
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0500-participant.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0500-participant.sql
new file mode 100644 (file)
index 0000000..0f5a673
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE TABLE clampacm.participant (participantId VARCHAR(255) NOT NULL, `description` VARCHAR(255) NULL, participantState TINYINT DEFAULT NULL NULL, CONSTRAINT PK_PARTICIPANT PRIMARY KEY (participantId));
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0600-participantsupportedelements.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0600-participantsupportedelements.sql
new file mode 100644 (file)
index 0000000..cf0f4c2
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE TABLE clampacm.participantsupportedacelements (id VARCHAR(255) NOT NULL, participantId VARCHAR(255) NULL, typeName VARCHAR(255) NULL, typeVersion VARCHAR(255) NULL, CONSTRAINT PK_PARTICIPANTSUPPORTEDACELEMENTS PRIMARY KEY (id));
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0700-ac_compositionId_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0700-ac_compositionId_index.sql
new file mode 100644 (file)
index 0000000..e5785f9
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE INDEX ac_compositionId ON clampacm.automationcomposition(compositionId);
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0800-ac_element_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0800-ac_element_fk_index.sql
new file mode 100644 (file)
index 0000000..4c2c2bc
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE INDEX ac_element_fk ON clampacm.automationcompositionelement(instanceId);
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0900-dt_element_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0900-dt_element_fk_index.sql
new file mode 100644 (file)
index 0000000..c67fdd6
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE INDEX dt_element_fk ON clampacm.nodetemplatestate(compositionId);
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1000-supported_element_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1000-supported_element_fk_index.sql
new file mode 100644 (file)
index 0000000..2ecba6f
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+CREATE INDEX supported_element_fk ON clampacm.participantsupportedacelements(participantId);
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1100-automationcompositionelement_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1100-automationcompositionelement_fk.sql
new file mode 100644 (file)
index 0000000..6315271
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+ALTER TABLE clampacm.automationcompositionelement ADD CONSTRAINT ac_element_fk FOREIGN KEY (instanceId) REFERENCES clampacm.automationcomposition (instanceId) ON UPDATE RESTRICT ON DELETE RESTRICT;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1200-nodetemplate_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1200-nodetemplate_fk.sql
new file mode 100644 (file)
index 0000000..8581deb
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+ALTER TABLE clampacm.nodetemplatestate ADD CONSTRAINT dt_element_fk FOREIGN KEY (compositionId) REFERENCES clampacm.automationcompositiondefinition (compositionId) ON UPDATE RESTRICT ON DELETE RESTRICT;
\ No newline at end of file
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1300-participantsupportedelements_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1300-participantsupportedelements_fk.sql
new file mode 100644 (file)
index 0000000..15f284a
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  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.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+ALTER TABLE clampacm.participantsupportedacelements ADD CONSTRAINT supported_element_fk FOREIGN KEY (participantId) REFERENCES clampacm.participant (participantId) ON UPDATE RESTRICT ON DELETE RESTRICT;
\ No newline at end of file
index 3a4ccfa..2261a39 100755 (executable)
@@ -4,7 +4,7 @@
 # ONAP
 # ================================================================================
 # Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
-# Modifications Copyright (C) 2021-2022 Nordix Foundation.
+# Modifications Copyright (C) 2021-2024 Nordix Foundation.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # The nature of the migration directories is dynamic.
 # A number of environment variables needs to be initialized
 # prior to running db-migrator.
-# These vaiables specifiy the connection details for the database
+# These variables specify the connection details for the database
 # to be upgraded/downgraded.
 #
 # The repository of upgrade/downgrade scripts is located in the
-# /home/policy/sql directory.
+# /home/${SQL_DB}/sql directory.
 # Two additional scripts have been provided to prepare the directories/files
 # needed to perform the upgrade/downgrade.
 #
index 607a86f..49ed2e6 100755 (executable)
@@ -4,6 +4,7 @@
 # ONAP
 # ================================================================================
 # Copyright (C) 2022 Nordix Foundation.
+# Modification Copyright 2024 Nordix Foundation.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # The nature of the migration directories is dynamic.
 # A number of environment variables needs to be initialized
 # prior to running db-migrator.
-# These vaiables specifiy the connection details for the database
+# These variables specify the connection details for the database
 # to be upgraded/downgraded.
 #
 # The repository of upgrade/downgrade scripts is located in the
-# /home/policy/sql directory.
+# /home/${SQL_DB}/sql directory.
 # Two additional scripts have been provided to prepare the directories/files
 # needed to perform the upgrade/downgrade.
 #
index a7fdbbb..d1d6533 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 # ============LICENSE_START=======================================================
 #  Copyright (C) 2021-2022 Nordix Foundation.
+#  Modification Copyright 2024 Nordix Foundation.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -33,7 +34,7 @@ mkdir -p $POLICY_HOME/etc/db/migration/${SCHEMA}/${SCRIPT_DIRECTORY}/
 # Remove any files from previous operations
 rm -rf $POLICY_HOME/etc/db/migration/${SCHEMA}/${SCRIPT_DIRECTORY}/* 2>/dev/null
 # Copy files to downgrade directories
-cd /home/policy/${SCRIPT_DIRECTORY} && find . -type f  -not -path '*/upgrade/*' -not -path '*/upgrade'  -print0  \
+cd /home/${SCHEMA}/${SCRIPT_DIRECTORY} && find . -type f  -not -path '*/upgrade/*' -not -path '*/upgrade'  -print0  \
    | cpio --null -pud $POLICY_HOME/etc/db/migration/${SCHEMA}/${SCRIPT_DIRECTORY}/
 
 releases=$(find $POLICY_HOME/etc/db/migration/${SCHEMA}/${SCRIPT_DIRECTORY}/*/downgrade -type d | sort -u | rev | cut -f2 -d/ | rev)
index b5de226..6cbc02c 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 # ============LICENSE_START=======================================================
 #  Copyright (C) 2021-2022 Nordix Foundation.
+#  Modification Copyright 2024 Nordix Foundation.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -33,7 +34,7 @@ mkdir -p $POLICY_HOME/etc/db/migration/${SCHEMA}/${SCRIPT_DIRECTORY}/
 # Remove any files from previous operations
 rm -rf $POLICY_HOME/etc/db/migration/${SCHEMA}/${SCRIPT_DIRECTORY}/* 2>/dev/null
 # Copy files to upgrade directories
-cd /home/policy/${SCRIPT_DIRECTORY} && find . -type f  -not -path '*/downgrade/*' -not -path '*/downgrade'  -print0  \
+cd /home/${SCHEMA}/${SCRIPT_DIRECTORY} && find . -type f  -not -path '*/downgrade/*' -not -path '*/downgrade'  -print0  \
    | cpio --null -pud $POLICY_HOME/etc/db/migration/${SCHEMA}/${SCRIPT_DIRECTORY}/
 
 releases=$(find $POLICY_HOME/etc/db/migration/${SCHEMA}/${SCRIPT_DIRECTORY}/*/upgrade -type d | sort -u | rev | cut -f2 -d/ | rev)
index bce3134..033c8a8 100644 (file)
@@ -2,6 +2,7 @@
 # Dockerfile
 # ============LICENSE_START=======================================================
 #  Copyright (C) 2022 Nordix Foundation.
+#  Modification Copyright 2022-2024 Nordix Foundation.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -48,8 +49,10 @@ COPY --chown=policy:policy ./db-migrator $POLICY_BIN/
 COPY --chown=policy:policy ./db-migrator-pg $POLICY_BIN/
 COPY --chown=policy:policy ./prepare_upgrade.sh $POLICY_BIN/
 COPY --chown=policy:policy ./prepare_downgrade.sh $POLICY_BIN/
-COPY --chown=policy:policy ./config/policyadmin/sql /home/policy/sql
-COPY --chown=policy:policy ./config/policyadmin/postgres /home/policy/postgres
+COPY --chown=policy:policy ./config/policyadmin/sql /home/policyadmin/sql
+COPY --chown=policy:policy ./config/policyadmin/postgres /home/policyadmin/postgres
+COPY --chown=policy:policy ./config/clampacm/sql /home/clampacm/sql
+COPY --chown=policy:policy ./config/clampacm/postgres /home/clampacm/postgres
 
 WORKDIR $POLICY_BIN
 USER policy:policy