Fix db-migrator issue in default phase 21/139721/1
authorFrancescoFioraEst <francesco.fiora@est.tech>
Thu, 12 Dec 2024 14:44:14 +0000 (14:44 +0000)
committerFrancesco Fiora <francesco.fiora@est.tech>
Fri, 13 Dec 2024 12:29:11 +0000 (12:29 +0000)
Fix db-migrator issue when there is an AC instances
in transitioning state with TIMEOUT

Issue-ID: POLICY-5210
Change-Id: I562a659b74e7ce85db8550ff268ee7845d476eea
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0100-automationcomposition.sql
policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0200-automationcompositiondefinition.sql
policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0700-automationcompositionelement.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0800-nodetemplatestate.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0100-automationcomposition.sql
policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0200-automationcompositiondefinition.sql
policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0700-automationcompositionelement.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0800-nodetemplatestate.sql [new file with mode: 0644]

index 8ef33cb..c1e4bb4 100644 (file)
@@ -17,4 +17,5 @@
  *  ============LICENSE_END=========================================================
  */
 
-ALTER TABLE automationcomposition ADD lastMsg timestamp without time zone DEFAULT Now(), ADD phase SMALLINT;
+ALTER TABLE automationcomposition ADD lastMsg timestamp without time zone DEFAULT Now(), ADD phase SMALLINT DEFAULT 0;
+UPDATE automationcomposition SET restarting = NULL;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0700-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0700-automationcompositionelement.sql
new file mode 100644 (file)
index 0000000..03ab8a4
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+UPDATE automationcompositionelement SET restarting = NULL;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0800-nodetemplatestate.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0800-nodetemplatestate.sql
new file mode 100644 (file)
index 0000000..1114a59
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+UPDATE nodetemplatestate SET restarting = NULL;
index 103a616..681b08a 100644 (file)
@@ -17,4 +17,5 @@
  *  ============LICENSE_END=========================================================
  */
 
-ALTER TABLE automationcomposition ADD lastMsg datetime(6) DEFAULT Now(), ADD phase TINYINT;
+ALTER TABLE automationcomposition ADD lastMsg datetime(6) DEFAULT Now(), ADD phase TINYINT DEFAULT 0;
+UPDATE automationcomposition SET restarting = NULL;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0700-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0700-automationcompositionelement.sql
new file mode 100644 (file)
index 0000000..03ab8a4
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+UPDATE automationcompositionelement SET restarting = NULL;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0800-nodetemplatestate.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0800-nodetemplatestate.sql
new file mode 100644 (file)
index 0000000..1114a59
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2024 Nordix Foundation
+ *  ================================================================================
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *  SPDX-License-Identifier: Apache-2.0
+ *  ============LICENSE_END=========================================================
+ */
+
+UPDATE nodetemplatestate SET restarting = NULL;