diff options
author | waynedunican <wayne.dunican@est.tech> | 2024-04-18 17:09:52 +0100 |
---|---|---|
committer | waynedunican <wayne.dunican@est.tech> | 2024-04-23 15:58:19 +0100 |
commit | aa86c67092daa5bd10dd6506fd33f3a6233dd281 (patch) | |
tree | b94fd47a88548742a16a10ba01e2f1402b3437c7 | |
parent | cebb4172163dc04b43be7e34d9a4b374370492f8 (diff) |
Add ACM db upgrade/downgrade to db-migrator
Issue-ID: POLICY-4934
Change-Id: Ic515eb1b2d549fdd91cff22ed6f589b673748657
Signed-off-by: waynedunican <wayne.dunican@est.tech>
63 files changed, 1180 insertions, 24 deletions
diff --git a/compose/config/clamp/AcRuntimeParameters.yaml b/compose/config/clamp/AcRuntimeParameters.yaml index 262f10c6..c61428da 100644 --- a/compose/config/clamp/AcRuntimeParameters.yaml +++ b/compose/config/clamp/AcRuntimeParameters.yaml @@ -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 diff --git a/compose/docker-compose.yml b/compose/docker-compose.yml index 0264b290..60ed0bc7 100644 --- a/compose/docker-compose.yml +++ b/compose/docker-compose.yml @@ -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 diff --git a/helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml b/helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml index 0858af3c..138b114c 100755 --- a/helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml +++ b/helm/policy/components/policy-clamp-runtime-acm/resources/config/acRuntimeParameters.yaml @@ -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 diff --git a/helm/policy/templates/job.yaml b/helm/policy/templates/job.yaml index eee143b5..560cea09 100755 --- a/helm/policy/templates/job.yaml +++ b/helm/policy/templates/job.yaml @@ -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 - diff --git a/helm/policy/values.yaml b/helm/policy/values.yaml index 10d89199..f980325d 100755 --- a/helm/policy/values.yaml +++ b/helm/policy/values.yaml @@ -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 diff --git a/policy-db-migrator/src/main/docker/Dockerfile b/policy-db-migrator/src/main/docker/Dockerfile index c234d215..81ea0e26 100644 --- a/policy-db-migrator/src/main/docker/Dockerfile +++ b/policy-db-migrator/src/main/docker/Dockerfile @@ -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 index 00000000..f17216f9 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0100-automationcomposition.sql @@ -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 index 00000000..9ef6e9ca --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0200-automationcompositiondefinition.sql @@ -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 index 00000000..2255d085 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0300-automationcompositionelement.sql @@ -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 index 00000000..7aee61ba --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0400-nodetemplatestate.sql @@ -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 index 00000000..3f20fefb --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0500-participant.sql @@ -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 index 00000000..e5ce88a6 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0600-participantsupportedelements.sql @@ -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 index 00000000..c21fd9e3 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0700-ac_compositionId_index.sql @@ -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 index 00000000..c21fd9e3 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0800-ac_element_fk_index.sql @@ -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 index 00000000..ed57c52f --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/0900-dt_element_fk_index.sql @@ -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 index 00000000..41b93291 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1000-supported_element_fk_index.sql @@ -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 index 00000000..c5b7eb30 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1100-automationcompositionelement_fk.sql @@ -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 index 00000000..60ab374d --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1200-nodetemplate_fk.sql @@ -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 index 00000000..1c54ba3f --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/downgrade/1300-participantsupportedelements_fk.sql @@ -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 index 00000000..93aab9db --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0100-automationcomposition.sql @@ -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 index 00000000..0f9f3ddf --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0200-automationcompositiondefinition.sql @@ -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 index 00000000..a37eb39d --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0300-automationcompositionelement.sql @@ -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 index 00000000..c9f79194 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0400-nodetemplatestate.sql @@ -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 index 00000000..e7d4a970 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0500-participant.sql @@ -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 index 00000000..1ad60c63 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0600-participantsupportedelements.sql @@ -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 index 00000000..e5785f9f --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0700-ac_compositionId_index.sql @@ -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 index 00000000..4c2c2bc2 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0800-ac_element_fk_index.sql @@ -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 index 00000000..c67fdd62 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/0900-dt_element_fk_index.sql @@ -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 index 00000000..2ecba6f1 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1000-supported_element_fk_index.sql @@ -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 index 00000000..6315271b --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1100-automationcompositionelement_fk.sql @@ -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 index 00000000..8581deb1 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1200-nodetemplate_fk.sql @@ -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 index 00000000..15f284a0 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1400/upgrade/1300-participantsupportedelements_fk.sql @@ -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 index 00000000..f17216f9 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0100-automationcomposition.sql @@ -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 index 00000000..9ef6e9ca --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0200-automationcompositiondefinition.sql @@ -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 index 00000000..2255d085 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0300-automationcompositionelement.sql @@ -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 index 00000000..7aee61ba --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0400-nodetemplatestate.sql @@ -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 index 00000000..3f20fefb --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0500-participant.sql @@ -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 index 00000000..e5ce88a6 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0600-participantsupportedelements.sql @@ -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 index 00000000..cadcea93 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0700-ac_compositionId_index.sql @@ -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 index 00000000..cadcea93 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0800-ac_element_fk_index.sql @@ -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 index 00000000..9a573697 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0900-dt_element_fk_index.sql @@ -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 index 00000000..b5ecf01e --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1000-supported_element_fk_index.sql @@ -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 index 00000000..d37f4b11 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1100-automationcompositionelement_fk.sql @@ -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 index 00000000..c03da333 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1200-nodetemplate_fk.sql @@ -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 index 00000000..5e61ef17 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/1300-participantsupportedelements_fk.sql @@ -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 index 00000000..edaf2f5b --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0100-automationcomposition.sql @@ -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 index 00000000..22f70b0c --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0200-automationcompositiondefinition.sql @@ -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 index 00000000..7bc18536 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0300-automationcompositionelement.sql @@ -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 index 00000000..3ca27afc --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0400-nodetemplatestate.sql @@ -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 index 00000000..0f5a673b --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0500-participant.sql @@ -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 index 00000000..cf0f4c23 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0600-participantsupportedelements.sql @@ -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 index 00000000..e5785f9f --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0700-ac_compositionId_index.sql @@ -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 index 00000000..4c2c2bc2 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0800-ac_element_fk_index.sql @@ -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 index 00000000..c67fdd62 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/0900-dt_element_fk_index.sql @@ -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 index 00000000..2ecba6f1 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1000-supported_element_fk_index.sql @@ -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 index 00000000..6315271b --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1100-automationcompositionelement_fk.sql @@ -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 index 00000000..8581deb1 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1200-nodetemplate_fk.sql @@ -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 index 00000000..15f284a0 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/upgrade/1300-participantsupportedelements_fk.sql @@ -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/db-migrator b/policy-db-migrator/src/main/docker/db-migrator index 3a4ccfa0..2261a394 100755 --- a/policy-db-migrator/src/main/docker/db-migrator +++ b/policy-db-migrator/src/main/docker/db-migrator @@ -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. @@ -37,11 +37,11 @@ # 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. # diff --git a/policy-db-migrator/src/main/docker/db-migrator-pg b/policy-db-migrator/src/main/docker/db-migrator-pg index 607a86fa..49ed2e61 100755 --- a/policy-db-migrator/src/main/docker/db-migrator-pg +++ b/policy-db-migrator/src/main/docker/db-migrator-pg @@ -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. @@ -36,11 +37,11 @@ # 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. # diff --git a/policy-db-migrator/src/main/docker/prepare_downgrade.sh b/policy-db-migrator/src/main/docker/prepare_downgrade.sh index a7fdbbb3..d1d6533b 100755 --- a/policy-db-migrator/src/main/docker/prepare_downgrade.sh +++ b/policy-db-migrator/src/main/docker/prepare_downgrade.sh @@ -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) diff --git a/policy-db-migrator/src/main/docker/prepare_upgrade.sh b/policy-db-migrator/src/main/docker/prepare_upgrade.sh index b5de226d..6cbc02cc 100755 --- a/policy-db-migrator/src/main/docker/prepare_upgrade.sh +++ b/policy-db-migrator/src/main/docker/prepare_upgrade.sh @@ -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) diff --git a/policy-db-migrator/src/main/docker/suse.Dockerfile b/policy-db-migrator/src/main/docker/suse.Dockerfile index bce31340..033c8a83 100644 --- a/policy-db-migrator/src/main/docker/suse.Dockerfile +++ b/policy-db-migrator/src/main/docker/suse.Dockerfile @@ -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 |