From: danielhanrahan Date: Mon, 21 Jul 2025 16:17:01 +0000 (+0100) Subject: Align mismatching column types in DB schema X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=6fc962479cb04aab9d5cd800e8e3f72c423f489e;p=policy%2Fdocker.git Align mismatching column types in DB schema 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 --- diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/downgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/downgrade/0100-automationcomposition.sql index 5557bed1..a6bc9e8f 100644 --- a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/downgrade/0100-automationcomposition.sql +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/downgrade/0100-automationcomposition.sql @@ -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 index 00000000..b230e287 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/downgrade/0300-automationcompositionelement.sql @@ -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; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/upgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/upgrade/0100-automationcomposition.sql index d349ca26..8258ecf0 100644 --- a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/upgrade/0100-automationcomposition.sql +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/upgrade/0100-automationcomposition.sql @@ -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 index 00000000..31fafb5d --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1702/upgrade/0300-automationcompositionelement.sql @@ -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;