Improvements for some of the DB migrator fields to be aligned 83/140883/2
authorFrancescoFioraEst <francesco.fiora@est.tech>
Fri, 16 May 2025 09:09:28 +0000 (10:09 +0100)
committerFrancescoFioraEst <francesco.fiora@est.tech>
Fri, 16 May 2025 09:09:28 +0000 (10:09 +0100)
Issue-ID: POLICY-5355
Change-Id: Ibad76ccd38f4e53021e60ca2905c733f715c701d
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
16 files changed:
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0200-automationcomposition.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0300-automationcompositionelement.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0400-automationcomposition_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0500-automationcompositiondefinition.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0600-nodetemplatestate.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0700-mb_identificationId_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0800-participantreplica.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0900-participantsupportedacelements.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0200-automationcomposition.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0300-automationcompositionelement.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0400-automationcomposition_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0500-automationcompositiondefinition.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0600-nodetemplatestate.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0700-mb_identificationId_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0800-participantreplica.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0900-participantsupportedacelements.sql [new file with mode: 0644]

diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0200-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0200-automationcomposition.sql
new file mode 100644 (file)
index 0000000..9436809
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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 automationcomposition
+ ALTER COLUMN compositionid DROP NOT NULL,
+ ALTER COLUMN name DROP NOT NULL,
+ ALTER COLUMN name DROP DEFAULT,
+ ALTER COLUMN version DROP NOT NULL,
+ ALTER COLUMN version DROP DEFAULT,
+ ALTER COLUMN deployState DROP NOT NULL,
+ ALTER COLUMN deployState DROP DEFAULT,
+ ALTER COLUMN lockState DROP NOT NULL,
+ ALTER COLUMN lockState DROP DEFAULT,
+ ALTER COLUMN SubState DROP NOT NULL,
+ ALTER COLUMN SubState DROP DEFAULT,
+ ALTER COLUMN lastMsg DROP NOT NULL;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0300-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0300-automationcompositionelement.sql
new file mode 100644 (file)
index 0000000..fd82c09
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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 automationcompositionelement
+ ALTER COLUMN definition_name DROP NOT NULL,
+ ALTER COLUMN definition_name DROP DEFAULT,
+ ALTER COLUMN definition_version DROP NOT NULL,
+ ALTER COLUMN definition_version DROP DEFAULT,
+ ALTER COLUMN deploystate DROP NOT NULL,
+ ALTER COLUMN deployState DROP DEFAULT,
+ ALTER COLUMN lockState DROP NOT NULL,
+ ALTER COLUMN lockState DROP DEFAULT,
+ ALTER COLUMN substate DROP NOT NULL,
+ ALTER COLUMN substate DROP DEFAULT,
+ ALTER COLUMN outproperties DROP NOT NULL,
+ ALTER COLUMN outproperties DROP DEFAULT,
+ ALTER COLUMN properties DROP NOT NULL,
+ ALTER COLUMN properties DROP DEFAULT;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0400-automationcomposition_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0400-automationcomposition_fk.sql
new file mode 100644 (file)
index 0000000..c9dead3
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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 automationcomposition DROP CONSTRAINT IF EXISTS ac_composition_fk;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0500-automationcompositiondefinition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0500-automationcompositiondefinition.sql
new file mode 100644 (file)
index 0000000..d413382
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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 automationcompositiondefinition
+ ALTER COLUMN name DROP NOT NULL,
+ ALTER COLUMN name DROP DEFAULT,
+ ALTER COLUMN version DROP NOT NULL,
+ ALTER COLUMN version DROP DEFAULT,
+ ALTER COLUMN state DROP NOT NULL,
+ ALTER COLUMN state DROP DEFAULT,
+ ALTER COLUMN serviceTemplate DROP NOT NULL,
+ ALTER COLUMN serviceTemplate DROP DEFAULT,
+ ALTER COLUMN lastMsg DROP NOT NULL;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0600-nodetemplatestate.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0600-nodetemplatestate.sql
new file mode 100644 (file)
index 0000000..a648d8f
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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 nodetemplatestate
+ ALTER COLUMN nodeTemplate_name DROP NOT NULL,
+ ALTER COLUMN nodeTemplate_name DROP DEFAULT,
+ ALTER COLUMN nodeTemplate_version DROP NOT NULL,
+ ALTER COLUMN nodeTemplate_version DROP DEFAULT,
+ ALTER COLUMN outProperties DROP NOT NULL,
+ ALTER COLUMN outProperties DROP DEFAULT,
+ ALTER COLUMN state DROP NOT NULL,
+ ALTER COLUMN state DROP DEFAULT;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0700-mb_identificationId_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0700-mb_identificationId_index.sql
new file mode 100644 (file)
index 0000000..404a12f
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 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 mb_identificationId_index;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0800-participantreplica.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0800-participantreplica.sql
new file mode 100644 (file)
index 0000000..ba2d8fc
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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 participantreplica
+ ALTER COLUMN lastMsg DROP NOT NULL,
+ ALTER COLUMN participantId DROP NOT NULL,
+ ALTER COLUMN participantId DROP DEFAULT,
+ ALTER COLUMN participantState DROP NOT NULL,
+ ALTER COLUMN participantState DROP DEFAULT;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0900-participantsupportedacelements.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/downgrade/0900-participantsupportedacelements.sql
new file mode 100644 (file)
index 0000000..32b99f5
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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 participantsupportedacelements
+ ALTER COLUMN participantId DROP NOT NULL,
+ ALTER COLUMN participantId DROP DEFAULT,
+ ALTER COLUMN typeName DROP NOT NULL,
+ ALTER COLUMN typeName DROP DEFAULT,
+ ALTER COLUMN typeVersion DROP NOT NULL,
+ ALTER COLUMN typeVersion DROP DEFAULT;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0200-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0200-automationcomposition.sql
new file mode 100644 (file)
index 0000000..3bc96f2
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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=========================================================
+ */
+
+update automationcomposition set deployState = 2 where deployState is null;
+update automationcomposition set lockState = 4 where lockState is null;
+update automationcomposition set name = '' where name is null;
+update automationcomposition set version = '1.0.0' where version is null;
+update automationcomposition set lastMsg = now() where lastMsg is null;
+update automationcomposition set subState = 0 where subState is null;
+
+ALTER TABLE automationcomposition
+ ALTER COLUMN compositionid SET NOT NULL,
+ ALTER COLUMN name SET DEFAULT '',
+ ALTER COLUMN name SET NOT NULL,
+ ALTER COLUMN version SET DEFAULT '1.0.0',
+ ALTER COLUMN version SET NOT NULL,
+ ALTER COLUMN deployState SET DEFAULT 2,
+ ALTER COLUMN deployState SET NOT NULL,
+ ALTER COLUMN lockState SET DEFAULT 4,
+ ALTER COLUMN lockState SET NOT NULL,
+ ALTER COLUMN SubState SET DEFAULT 0,
+ ALTER COLUMN SubState SET NOT NULL,
+ ALTER COLUMN lastMsg SET NOT NULL;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0300-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0300-automationcompositionelement.sql
new file mode 100644 (file)
index 0000000..9176454
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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=========================================================
+ */
+
+update automationcompositionelement set definition_name = '' where definition_name is null;
+update automationcompositionelement set definition_version = '0.0.0' where definition_version is null;
+update automationcompositionelement set deploystate = 2 where deploystate is null;
+update automationcompositionelement set lockState = 4 where lockState is null;
+update automationcompositionelement set subState = 0 where subState is null;
+
+ALTER TABLE automationcompositionelement
+ ALTER COLUMN definition_name SET NOT NULL,
+ ALTER COLUMN definition_name SET DEFAULT '',
+ ALTER COLUMN definition_version SET NOT NULL,
+ ALTER COLUMN definition_version SET DEFAULT '0.0.0',
+ ALTER COLUMN deploystate SET NOT NULL,
+ ALTER COLUMN deployState SET DEFAULT 2,
+ ALTER COLUMN lockState SET NOT NULL,
+ ALTER COLUMN lockState SET DEFAULT 4,
+ ALTER COLUMN substate SET NOT NULL,
+ ALTER COLUMN substate SET DEFAULT 0,
+ ALTER COLUMN outproperties SET NOT NULL,
+ ALTER COLUMN outproperties SET DEFAULT '{}',
+ ALTER COLUMN properties SET NOT NULL,
+ ALTER COLUMN properties SET DEFAULT '{}';
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0400-automationcomposition_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0400-automationcomposition_fk.sql
new file mode 100644 (file)
index 0000000..0b0fbdd
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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 automationcomposition ADD CONSTRAINT ac_composition_fk FOREIGN KEY (compositionId) REFERENCES automationcompositiondefinition (compositionId) ON UPDATE RESTRICT ON DELETE RESTRICT;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0500-automationcompositiondefinition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0500-automationcompositiondefinition.sql
new file mode 100644 (file)
index 0000000..99cdbf8
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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=========================================================
+ */
+
+update automationcompositiondefinition set name = '' where name is null;
+update automationcompositiondefinition set version  = '1.0.0' where version is null;
+update automationcompositiondefinition set state  = 0 where state is null;
+update automationcompositiondefinition set lastMsg = now() where lastMsg is null;
+update automationcompositiondefinition set serviceTemplate = '' where serviceTemplate is null;
+
+ALTER TABLE automationcompositiondefinition
+ ALTER COLUMN name SET NOT NULL,
+ ALTER COLUMN name SET DEFAULT '',
+ ALTER COLUMN version SET NOT NULL,
+ ALTER COLUMN version SET DEFAULT '1.0.0',
+ ALTER COLUMN state SET NOT NULL,
+ ALTER COLUMN state SET DEFAULT 0,
+ ALTER COLUMN serviceTemplate SET NOT NULL,
+ ALTER COLUMN serviceTemplate SET DEFAULT '',
+ ALTER COLUMN lastMsg SET NOT NULL;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0600-nodetemplatestate.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0600-nodetemplatestate.sql
new file mode 100644 (file)
index 0000000..c72470d
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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=========================================================
+ */
+
+update nodetemplatestate set nodeTemplate_name  = '' where nodeTemplate_name is null;
+update nodetemplatestate set nodeTemplate_version = '1.0.0' where nodeTemplate_version is null;
+update nodetemplatestate set outProperties = '{}' where outProperties is null;
+update nodetemplatestate set state = 0 where state is null;
+
+ALTER TABLE nodetemplatestate
+ ALTER COLUMN nodeTemplate_name SET NOT NULL,
+ ALTER COLUMN nodeTemplate_name SET DEFAULT '',
+ ALTER COLUMN nodeTemplate_version SET NOT NULL,
+ ALTER COLUMN nodeTemplate_version SET DEFAULT '1.0.0',
+ ALTER COLUMN outProperties SET NOT NULL,
+ ALTER COLUMN outProperties SET DEFAULT '{}',
+ ALTER COLUMN state SET NOT NULL,
+ ALTER COLUMN state SET DEFAULT 0;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0700-mb_identificationId_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0700-mb_identificationId_index.sql
new file mode 100644 (file)
index 0000000..3387c2d
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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 mb_identificationId_index ON message(identificationId);
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0800-participantreplica.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0800-participantreplica.sql
new file mode 100644 (file)
index 0000000..8a50555
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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=========================================================
+ */
+
+update participantreplica set lastMsg = now() where lastMsg is null;
+update participantreplica set participantState = '1' where participantState is null;
+
+ALTER TABLE participantreplica
+ ALTER COLUMN lastMsg SET NOT NULL,
+ ALTER COLUMN participantId SET NOT NULL,
+ ALTER COLUMN participantId SET DEFAULT '',
+ ALTER COLUMN participantState SET NOT NULL,
+ ALTER COLUMN participantState SET DEFAULT 1;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0900-participantsupportedacelements.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1701/upgrade/0900-participantsupportedacelements.sql
new file mode 100644 (file)
index 0000000..9a41419
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2025 OpenInfra Foundation Europe. All rights reserved.
+ *  ================================================================================
+ *  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=========================================================
+ */
+
+update participantsupportedacelements set typeName = '' where typeName is null;
+update participantsupportedacelements set typeVersion = '1.0.0' where typeVersion is null;
+
+ALTER TABLE participantsupportedacelements
+ ALTER COLUMN participantId SET NOT NULL,
+ ALTER COLUMN participantId SET DEFAULT '',
+ ALTER COLUMN typeName SET NOT NULL,
+ ALTER COLUMN typeName SET DEFAULT '',
+ ALTER COLUMN typeVersion SET NOT NULL,
+ ALTER COLUMN typeVersion SET DEFAULT '1.0.0';