From ff280c1be28ae1e95729c0b41e1b3580a741ca30 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Thu, 19 Jun 2025 14:40:23 +0100 Subject: [PATCH] Copy SQL files from DB-migrator to ACM runtime (Liquibase #1) Copy SQL upgrade files from DB-migrator to runtime-acm. Note the files are copied without any changes, and are not yet used. Issue-ID: POLICY-5398 Change-Id: Ibe6fcbb8e2d078d7d5a69e7d36624d629af65cd8 Signed-off-by: danielhanrahan --- .../1400/upgrade/0100-automationcomposition.sql | 20 +++++++++++ .../0200-automationcompositiondefinition.sql | 20 +++++++++++ .../upgrade/0300-automationcompositionelement.sql | 20 +++++++++++ .../1400/upgrade/0400-nodetemplatestate.sql | 20 +++++++++++ .../db/changelog/1400/upgrade/0500-participant.sql | 20 +++++++++++ .../upgrade/0600-participantsupportedelements.sql | 20 +++++++++++ .../1400/upgrade/0700-ac_compositionId_index.sql | 20 +++++++++++ .../1400/upgrade/0800-ac_element_fk_index.sql | 20 +++++++++++ .../1400/upgrade/0900-dt_element_fk_index.sql | 20 +++++++++++ .../upgrade/1000-supported_element_fk_index.sql | 20 +++++++++++ .../1100-automationcompositionelement_fk.sql | 20 +++++++++++ .../1400/upgrade/1200-nodetemplate_fk.sql | 20 +++++++++++ .../1300-participantsupportedelements_fk.sql | 20 +++++++++++ .../1500/upgrade/0100-automationcomposition.sql | 21 ++++++++++++ .../0200-automationcompositiondefinition.sql | 21 ++++++++++++ .../1500/upgrade/0300-participantreplica.sql | 20 +++++++++++ .../db/changelog/1500/upgrade/0400-participant.sql | 20 +++++++++++ .../upgrade/0500-participant_replica_fk_index.sql | 20 +++++++++++ .../1500/upgrade/0600-participant_replica_fk.sql | 20 +++++++++++ .../upgrade/0700-automationcompositionelement.sql | 20 +++++++++++ .../1500/upgrade/0800-nodetemplatestate.sql | 20 +++++++++++ .../1600/upgrade/0100-automationcomposition.sql | 20 +++++++++++ .../upgrade/0200-automationcompositionelement.sql | 20 +++++++++++ .../1601/upgrade/0100-automationcomposition.sql | 20 +++++++++++ .../upgrade/0200-automationcompositionelement.sql | 21 ++++++++++++ .../db/changelog/1700/upgrade/0100-message.sql | 20 +++++++++++ .../db/changelog/1700/upgrade/0200-messagejob.sql | 20 +++++++++++ .../0300-messagejob_identificationId_index.sql | 20 +++++++++++ .../upgrade/0100-automationcompositionrollback.sql | 20 +++++++++++ .../1701/upgrade/0200-automationcomposition.sql | 39 +++++++++++++++++++++ .../upgrade/0300-automationcompositionelement.sql | 40 ++++++++++++++++++++++ .../1701/upgrade/0400-automationcomposition_fk.sql | 20 +++++++++++ .../0500-automationcompositiondefinition.sql | 35 +++++++++++++++++++ .../1701/upgrade/0600-nodetemplatestate.sql | 33 ++++++++++++++++++ .../upgrade/0700-mb_identificationId_index.sql | 20 +++++++++++ .../1701/upgrade/0800-participantreplica.sql | 28 +++++++++++++++ .../0900-participantsupportedacelements.sql | 29 ++++++++++++++++ 37 files changed, 827 insertions(+) create mode 100644 runtime-acm/src/main/resources/db/changelog/1400/upgrade/0100-automationcomposition.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1400/upgrade/0200-automationcompositiondefinition.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1400/upgrade/0300-automationcompositionelement.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1400/upgrade/0400-nodetemplatestate.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1400/upgrade/0500-participant.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1400/upgrade/0600-participantsupportedelements.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1400/upgrade/0700-ac_compositionId_index.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1400/upgrade/0800-ac_element_fk_index.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1400/upgrade/0900-dt_element_fk_index.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1400/upgrade/1000-supported_element_fk_index.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1400/upgrade/1100-automationcompositionelement_fk.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1400/upgrade/1200-nodetemplate_fk.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1400/upgrade/1300-participantsupportedelements_fk.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1500/upgrade/0100-automationcomposition.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1500/upgrade/0200-automationcompositiondefinition.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1500/upgrade/0300-participantreplica.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1500/upgrade/0400-participant.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1500/upgrade/0500-participant_replica_fk_index.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1500/upgrade/0600-participant_replica_fk.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1500/upgrade/0700-automationcompositionelement.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1500/upgrade/0800-nodetemplatestate.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1600/upgrade/0100-automationcomposition.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1600/upgrade/0200-automationcompositionelement.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1601/upgrade/0100-automationcomposition.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1601/upgrade/0200-automationcompositionelement.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1700/upgrade/0100-message.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1700/upgrade/0200-messagejob.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1700/upgrade/0300-messagejob_identificationId_index.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1701/upgrade/0100-automationcompositionrollback.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1701/upgrade/0200-automationcomposition.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1701/upgrade/0300-automationcompositionelement.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1701/upgrade/0400-automationcomposition_fk.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1701/upgrade/0500-automationcompositiondefinition.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1701/upgrade/0600-nodetemplatestate.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1701/upgrade/0700-mb_identificationId_index.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1701/upgrade/0800-participantreplica.sql create mode 100644 runtime-acm/src/main/resources/db/changelog/1701/upgrade/0900-participantsupportedacelements.sql diff --git a/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0100-automationcomposition.sql b/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0100-automationcomposition.sql new file mode 100644 index 000000000..37dc29687 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/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 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/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0200-automationcompositiondefinition.sql b/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0200-automationcompositiondefinition.sql new file mode 100644 index 000000000..fc4868328 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/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 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/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0300-automationcompositionelement.sql b/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0300-automationcompositionelement.sql new file mode 100644 index 000000000..302fcbc0c --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/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 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/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0400-nodetemplatestate.sql b/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0400-nodetemplatestate.sql new file mode 100644 index 000000000..d5454af4d --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/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 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/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0500-participant.sql b/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0500-participant.sql new file mode 100644 index 000000000..08a8cf016 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/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 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/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0600-participantsupportedelements.sql b/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0600-participantsupportedelements.sql new file mode 100644 index 000000000..fbda69d5e --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/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 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/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0700-ac_compositionId_index.sql b/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0700-ac_compositionId_index.sql new file mode 100644 index 000000000..fce99716c --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/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 automationcomposition(compositionId); \ No newline at end of file diff --git a/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0800-ac_element_fk_index.sql b/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0800-ac_element_fk_index.sql new file mode 100644 index 000000000..520019b82 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/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 automationcompositionelement(instanceId); \ No newline at end of file diff --git a/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0900-dt_element_fk_index.sql b/runtime-acm/src/main/resources/db/changelog/1400/upgrade/0900-dt_element_fk_index.sql new file mode 100644 index 000000000..cfbafea5e --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/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 nodetemplatestate(compositionId); \ No newline at end of file diff --git a/runtime-acm/src/main/resources/db/changelog/1400/upgrade/1000-supported_element_fk_index.sql b/runtime-acm/src/main/resources/db/changelog/1400/upgrade/1000-supported_element_fk_index.sql new file mode 100644 index 000000000..13e1905fb --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/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 participantsupportedacelements(participantId); \ No newline at end of file diff --git a/runtime-acm/src/main/resources/db/changelog/1400/upgrade/1100-automationcompositionelement_fk.sql b/runtime-acm/src/main/resources/db/changelog/1400/upgrade/1100-automationcompositionelement_fk.sql new file mode 100644 index 000000000..f6a24b961 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/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 automationcompositionelement ADD CONSTRAINT ac_element_fk FOREIGN KEY (instanceId) REFERENCES automationcomposition (instanceId) ON UPDATE RESTRICT ON DELETE RESTRICT; \ No newline at end of file diff --git a/runtime-acm/src/main/resources/db/changelog/1400/upgrade/1200-nodetemplate_fk.sql b/runtime-acm/src/main/resources/db/changelog/1400/upgrade/1200-nodetemplate_fk.sql new file mode 100644 index 000000000..5f294ced1 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/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 nodetemplatestate ADD CONSTRAINT dt_element_fk FOREIGN KEY (compositionId) REFERENCES automationcompositiondefinition (compositionId) ON UPDATE RESTRICT ON DELETE RESTRICT; \ No newline at end of file diff --git a/runtime-acm/src/main/resources/db/changelog/1400/upgrade/1300-participantsupportedelements_fk.sql b/runtime-acm/src/main/resources/db/changelog/1400/upgrade/1300-participantsupportedelements_fk.sql new file mode 100644 index 000000000..dd60a3dac --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/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 participantsupportedacelements ADD CONSTRAINT supported_element_fk FOREIGN KEY (participantId) REFERENCES participant (participantId) ON UPDATE RESTRICT ON DELETE RESTRICT; \ No newline at end of file diff --git a/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0100-automationcomposition.sql b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0100-automationcomposition.sql new file mode 100644 index 000000000..c1e4bb431 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0100-automationcomposition.sql @@ -0,0 +1,21 @@ +/* + * ============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 automationcomposition ADD lastMsg timestamp without time zone DEFAULT Now(), ADD phase SMALLINT DEFAULT 0; +UPDATE automationcomposition SET restarting = NULL; diff --git a/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0200-automationcompositiondefinition.sql b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0200-automationcompositiondefinition.sql new file mode 100644 index 000000000..25a773bdb --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0200-automationcompositiondefinition.sql @@ -0,0 +1,21 @@ +/* + * ============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 automationcompositiondefinition ADD lastMsg timestamp without time zone DEFAULT Now(); +UPDATE automationcompositiondefinition SET restarting = NULL; diff --git a/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0300-participantreplica.sql b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0300-participantreplica.sql new file mode 100644 index 000000000..4543272b0 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0300-participantreplica.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 participantreplica (replicaId varchar(255) NOT NULL, lastMsg timestamp without time zone DEFAULT Now(), participantId varchar(255) DEFAULT NULL, participantState SMALLINT DEFAULT NULL, CONSTRAINT PK_PARTICIPANT_REPLICA PRIMARY KEY (replicaId)); diff --git a/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0400-participant.sql b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0400-participant.sql new file mode 100644 index 000000000..97ae43a37 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0400-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========================================================= + */ + +ALTER TABLE participant ADD lastMsg timestamp without time zone DEFAULT Now(); diff --git a/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0500-participant_replica_fk_index.sql b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0500-participant_replica_fk_index.sql new file mode 100644 index 000000000..bc506e996 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0500-participant_replica_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 participant_replica_fk ON participantreplica(participantId); diff --git a/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0600-participant_replica_fk.sql b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0600-participant_replica_fk.sql new file mode 100644 index 000000000..3341d8e09 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0600-participant_replica_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 participantreplica ADD CONSTRAINT participant_replica_fk FOREIGN KEY (participantId) REFERENCES participant (participantId) ON UPDATE RESTRICT ON DELETE RESTRICT; diff --git a/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0700-automationcompositionelement.sql b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0700-automationcompositionelement.sql new file mode 100644 index 000000000..03ab8a490 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0700-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========================================================= + */ + +UPDATE automationcompositionelement SET restarting = NULL; diff --git a/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0800-nodetemplatestate.sql b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0800-nodetemplatestate.sql new file mode 100644 index 000000000..1114a5976 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1500/upgrade/0800-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========================================================= + */ + +UPDATE nodetemplatestate SET restarting = NULL; diff --git a/runtime-acm/src/main/resources/db/changelog/1600/upgrade/0100-automationcomposition.sql b/runtime-acm/src/main/resources/db/changelog/1600/upgrade/0100-automationcomposition.sql new file mode 100644 index 000000000..b3ec5f96f --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1600/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========================================================= + */ + +ALTER TABLE automationcomposition ADD subState SMALLINT DEFAULT NULL; diff --git a/runtime-acm/src/main/resources/db/changelog/1600/upgrade/0200-automationcompositionelement.sql b/runtime-acm/src/main/resources/db/changelog/1600/upgrade/0200-automationcompositionelement.sql new file mode 100644 index 000000000..3e91bbf7b --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1600/upgrade/0200-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========================================================= + */ + +ALTER TABLE automationcompositionelement ADD subState SMALLINT DEFAULT NULL, ADD stage SMALLINT DEFAULT NULL; diff --git a/runtime-acm/src/main/resources/db/changelog/1601/upgrade/0100-automationcomposition.sql b/runtime-acm/src/main/resources/db/changelog/1601/upgrade/0100-automationcomposition.sql new file mode 100644 index 000000000..e4aae8fc7 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1601/upgrade/0100-automationcomposition.sql @@ -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========================================================= + */ + + UPDATE automationcomposition SET substate=0 WHERE substate is NULL; diff --git a/runtime-acm/src/main/resources/db/changelog/1601/upgrade/0200-automationcompositionelement.sql b/runtime-acm/src/main/resources/db/changelog/1601/upgrade/0200-automationcompositionelement.sql new file mode 100644 index 000000000..ad9469cda --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1601/upgrade/0200-automationcompositionelement.sql @@ -0,0 +1,21 @@ +/* + * ============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========================================================= + */ + + UPDATE automationcompositionelement SET subState=0 WHERE substate is NULL; + UPDATE automationcompositionelement SET stage=0 WHERE stage is NULL; diff --git a/runtime-acm/src/main/resources/db/changelog/1700/upgrade/0100-message.sql b/runtime-acm/src/main/resources/db/changelog/1700/upgrade/0100-message.sql new file mode 100644 index 000000000..f13f3b8ec --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1700/upgrade/0100-message.sql @@ -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========================================================= + */ + +CREATE TABLE IF NOT EXISTS message (messageId varchar(255) NOT NULL, identificationId varchar(255) NOT NULL, lastMsg timestamp without time zone NOT NULL DEFAULT now(), docMessage text NOT NULL, CONSTRAINT PK_MESSAGE PRIMARY KEY (messageId)); diff --git a/runtime-acm/src/main/resources/db/changelog/1700/upgrade/0200-messagejob.sql b/runtime-acm/src/main/resources/db/changelog/1700/upgrade/0200-messagejob.sql new file mode 100644 index 000000000..ea6d7baaa --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1700/upgrade/0200-messagejob.sql @@ -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========================================================= + */ + +CREATE TABLE IF NOT EXISTS messagejob (jobId varchar(255) NOT NULL, identificationId varchar(255) NOT NULL, jobStarted timestamp without time zone NOT NULL DEFAULT now(), CONSTRAINT PK_MESSAGE_JOB PRIMARY KEY (jobId)); diff --git a/runtime-acm/src/main/resources/db/changelog/1700/upgrade/0300-messagejob_identificationId_index.sql b/runtime-acm/src/main/resources/db/changelog/1700/upgrade/0300-messagejob_identificationId_index.sql new file mode 100644 index 000000000..4d512dc52 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1700/upgrade/0300-messagejob_identificationId_index.sql @@ -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========================================================= + */ + +CREATE UNIQUE INDEX messagejob_identificationId_index ON messagejob(identificationId); diff --git a/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0100-automationcompositionrollback.sql b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0100-automationcompositionrollback.sql new file mode 100644 index 000000000..1ecd52863 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0100-automationcompositionrollback.sql @@ -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 TABLE automationcompositionrollback (instanceId VARCHAR(255) NOT NULL, compositionId VARCHAR(255) NOT NULL, elements TEXT NOT NULL, CONSTRAINT PK_AUTOMATIONCOMPOSITION_ROLLBACK PRIMARY KEY (instanceId)) WITHOUT OIDS; \ No newline at end of file diff --git a/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0200-automationcomposition.sql b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0200-automationcomposition.sql new file mode 100644 index 000000000..3bc96f293 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0200-automationcomposition.sql @@ -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/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0300-automationcompositionelement.sql b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0300-automationcompositionelement.sql new file mode 100644 index 000000000..917645466 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0300-automationcompositionelement.sql @@ -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/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0400-automationcomposition_fk.sql b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0400-automationcomposition_fk.sql new file mode 100644 index 000000000..0b0fbddc8 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0400-automationcomposition_fk.sql @@ -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/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0500-automationcompositiondefinition.sql b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0500-automationcompositiondefinition.sql new file mode 100644 index 000000000..99cdbf81b --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0500-automationcompositiondefinition.sql @@ -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/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0600-nodetemplatestate.sql b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0600-nodetemplatestate.sql new file mode 100644 index 000000000..c72470dee --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0600-nodetemplatestate.sql @@ -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/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0700-mb_identificationId_index.sql b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0700-mb_identificationId_index.sql new file mode 100644 index 000000000..3387c2d6a --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0700-mb_identificationId_index.sql @@ -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/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0800-participantreplica.sql b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0800-participantreplica.sql new file mode 100644 index 000000000..8a5055515 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0800-participantreplica.sql @@ -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/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0900-participantsupportedacelements.sql b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0900-participantsupportedacelements.sql new file mode 100644 index 000000000..9a4141967 --- /dev/null +++ b/runtime-acm/src/main/resources/db/changelog/1701/upgrade/0900-participantsupportedacelements.sql @@ -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'; -- 2.16.6