Add a new replica table in clampacm database in db migrator 38/138138/1 master
authorFrancescoFioraEst <francesco.fiora@est.tech>
Tue, 4 Jun 2024 13:53:23 +0000 (14:53 +0100)
committerFrancesco Fiora <francesco.fiora@est.tech>
Wed, 5 Jun 2024 12:24:41 +0000 (12:24 +0000)
Issue-ID: POLICY-5033
Change-Id: Ifaf43686c9784a211806058433ecb69f0d7e1ca9
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
16 files changed:
policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0300-participantreplica.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0400-participant.sql [moved from policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0300-participant.sql with 100% similarity]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0500-participant_replica_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0600-participant_replica_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0300-participantreplica.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0400-participant.sql [moved from policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0300-participant.sql with 100% similarity]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0500-participant_replica_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0600-participant_replica_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0300-participantreplica.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0400-participant.sql [moved from policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0300-participant.sql with 100% similarity]
policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0500-participant_replica_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0600-participant_replica_fk.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0300-participantreplica.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0400-participant.sql [moved from policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0300-participant.sql with 100% similarity]
policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0500-participant_replica_fk_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0600-participant_replica_fk.sql [new file with mode: 0644]

diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0300-participantreplica.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0300-participantreplica.sql
new file mode 100644 (file)
index 0000000..d5f7871
--- /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=========================================================
+ */
+
+DROP TABLE participantreplica;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0500-participant_replica_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0500-participant_replica_fk_index.sql
new file mode 100644 (file)
index 0000000..ab9012c
--- /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=========================================================
+ */
+
+DROP INDEX IF EXISTS participant_replica_fk;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0600-participant_replica_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0600-participant_replica_fk.sql
new file mode 100644 (file)
index 0000000..36709b1
--- /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=========================================================
+ */
+
+ALTER TABLE participantreplica DROP CONSTRAINT IF EXISTS participant_replica_fk;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0300-participantreplica.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0300-participantreplica.sql
new file mode 100644 (file)
index 0000000..4543272
--- /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=========================================================
+ */
+
+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/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0500-participant_replica_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0500-participant_replica_fk_index.sql
new file mode 100644 (file)
index 0000000..bc506e9
--- /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=========================================================
+ */
+
+CREATE INDEX participant_replica_fk ON participantreplica(participantId);
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0600-participant_replica_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0600-participant_replica_fk.sql
new file mode 100644 (file)
index 0000000..3341d8e
--- /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=========================================================
+ */
+
+ALTER TABLE participantreplica ADD CONSTRAINT participant_replica_fk FOREIGN KEY (participantId) REFERENCES participant (participantId) ON UPDATE RESTRICT ON DELETE RESTRICT;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0300-participantreplica.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0300-participantreplica.sql
new file mode 100644 (file)
index 0000000..d5f7871
--- /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=========================================================
+ */
+
+DROP TABLE participantreplica;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0500-participant_replica_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0500-participant_replica_fk_index.sql
new file mode 100644 (file)
index 0000000..61a5454
--- /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=========================================================
+ */
+
+DROP INDEX participant_replica_fk ON participantreplica;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0600-participant_replica_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0600-participant_replica_fk.sql
new file mode 100644 (file)
index 0000000..6c5f30e
--- /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=========================================================
+ */
+
+ALTER TABLE participantreplica DROP FOREIGN KEY participant_replica_fk;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0300-participantreplica.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0300-participantreplica.sql
new file mode 100644 (file)
index 0000000..cb5969d
--- /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=========================================================
+ */
+
+CREATE TABLE participantreplica (replicaId varchar(255) NOT NULL, lastMsg datetime(6) DEFAULT NULL, participantId varchar(255) DEFAULT NULL, participantState int(11) DEFAULT NULL, CONSTRAINT PK_PARTICIPANT_REPLICA PRIMARY KEY (replicaId));
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0500-participant_replica_fk_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0500-participant_replica_fk_index.sql
new file mode 100644 (file)
index 0000000..bc506e9
--- /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=========================================================
+ */
+
+CREATE INDEX participant_replica_fk ON participantreplica(participantId);
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0600-participant_replica_fk.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0600-participant_replica_fk.sql
new file mode 100644 (file)
index 0000000..3341d8e
--- /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=========================================================
+ */
+
+ALTER TABLE participantreplica ADD CONSTRAINT participant_replica_fk FOREIGN KEY (participantId) REFERENCES participant (participantId) ON UPDATE RESTRICT ON DELETE RESTRICT;