Align mismatching column types in DB schema 74/141574/1
authordanielhanrahan <daniel.hanrahan@est.tech>
Mon, 21 Jul 2025 16:17:01 +0000 (17:17 +0100)
committerdanielhanrahan <daniel.hanrahan@est.tech>
Tue, 22 Jul 2025 19:45:59 +0000 (20:45 +0100)
These columns have type Integer in Java:
- JpaAutomationComposition.phase
- JpaAutomationCompositionElement.stage
The types are changed in the database to match Java.

Issue-ID: POLICY-5422
Change-Id: Ic0708a5b89d4bc6832f0fb1c18324f44ae25e1ae
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/downgrade/0100-automationcomposition.sql
policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/downgrade/0300-automationcompositionelement.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/upgrade/0100-automationcomposition.sql
policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/upgrade/0300-automationcompositionelement.sql [new file with mode: 0644]

index 5557bed..a6bc9e8 100644 (file)
@@ -17,4 +17,6 @@
  *  ============LICENSE_END=========================================================
  */
 
-ALTER TABLE automationcomposition DROP revisionId;
+ALTER TABLE automationcomposition
+ DROP COLUMN revisionId,
+ ALTER COLUMN phase TYPE SMALLINT;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/downgrade/0300-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/downgrade/0300-automationcompositionelement.sql
new file mode 100644 (file)
index 0000000..b230e28
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * ============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 stage TYPE SMALLINT;
index d349ca2..8258ecf 100644 (file)
@@ -18,4 +18,5 @@
  */
 
 ALTER TABLE automationcomposition
- ADD COLUMN revisionId VARCHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
+ ADD COLUMN revisionId VARCHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000',
+ ALTER COLUMN phase TYPE INTEGER;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/upgrade/0300-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/upgrade/0300-automationcompositionelement.sql
new file mode 100644 (file)
index 0000000..31fafb5
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * ============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 stage TYPE INTEGER;