From 59c25aa2599da95a52baffe261065f84f2bf7e20 Mon Sep 17 00:00:00 2001 From: FrancescoFioraEst Date: Tue, 4 Jun 2024 14:53:23 +0100 Subject: Add a new replica table in clampacm database in db migrator Issue-ID: POLICY-5033 Change-Id: Ifaf43686c9784a211806058433ecb69f0d7e1ca9 Signed-off-by: FrancescoFioraEst --- .../postgres/1500/downgrade/0300-participant.sql | 20 -------------------- .../1500/downgrade/0300-participantreplica.sql | 20 ++++++++++++++++++++ .../postgres/1500/downgrade/0400-participant.sql | 20 ++++++++++++++++++++ .../downgrade/0500-participant_replica_fk_index.sql | 20 ++++++++++++++++++++ .../1500/downgrade/0600-participant_replica_fk.sql | 20 ++++++++++++++++++++ .../postgres/1500/upgrade/0300-participant.sql | 20 -------------------- .../1500/upgrade/0300-participantreplica.sql | 20 ++++++++++++++++++++ .../postgres/1500/upgrade/0400-participant.sql | 20 ++++++++++++++++++++ .../upgrade/0500-participant_replica_fk_index.sql | 20 ++++++++++++++++++++ .../1500/upgrade/0600-participant_replica_fk.sql | 20 ++++++++++++++++++++ .../clampacm/sql/1500/downgrade/0300-participant.sql | 20 -------------------- .../sql/1500/downgrade/0300-participantreplica.sql | 20 ++++++++++++++++++++ .../clampacm/sql/1500/downgrade/0400-participant.sql | 20 ++++++++++++++++++++ .../downgrade/0500-participant_replica_fk_index.sql | 20 ++++++++++++++++++++ .../1500/downgrade/0600-participant_replica_fk.sql | 20 ++++++++++++++++++++ .../clampacm/sql/1500/upgrade/0300-participant.sql | 20 -------------------- .../sql/1500/upgrade/0300-participantreplica.sql | 20 ++++++++++++++++++++ .../clampacm/sql/1500/upgrade/0400-participant.sql | 20 ++++++++++++++++++++ .../upgrade/0500-participant_replica_fk_index.sql | 20 ++++++++++++++++++++ .../sql/1500/upgrade/0600-participant_replica_fk.sql | 20 ++++++++++++++++++++ 20 files changed, 320 insertions(+), 80 deletions(-) delete mode 100644 policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0300-participant.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0300-participantreplica.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0400-participant.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0500-participant_replica_fk_index.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0600-participant_replica_fk.sql delete mode 100644 policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0300-participant.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0300-participantreplica.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0400-participant.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0500-participant_replica_fk_index.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0600-participant_replica_fk.sql delete mode 100644 policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0300-participant.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0300-participantreplica.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0400-participant.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0500-participant_replica_fk_index.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0600-participant_replica_fk.sql delete mode 100644 policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0300-participant.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0300-participantreplica.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0400-participant.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0500-participant_replica_fk_index.sql create mode 100644 policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0600-participant_replica_fk.sql (limited to 'policy-db-migrator') diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0300-participant.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0300-participant.sql deleted file mode 100644 index 10ddaaf6..00000000 --- a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0300-participant.sql +++ /dev/null @@ -1,20 +0,0 @@ -/* - * ============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 DROP lastMsg; 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 index 00000000..d5f7871b --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/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========================================================= + */ + +DROP TABLE participantreplica; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0400-participant.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/0400-participant.sql new file mode 100644 index 00000000..10ddaaf6 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/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 DROP lastMsg; 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 index 00000000..ab9012c5 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/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========================================================= + */ + +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 index 00000000..36709b10 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/downgrade/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 DROP CONSTRAINT IF EXISTS participant_replica_fk; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0300-participant.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0300-participant.sql deleted file mode 100644 index 97ae43a3..00000000 --- a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0300-participant.sql +++ /dev/null @@ -1,20 +0,0 @@ -/* - * ============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/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 index 00000000..4543272b --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/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/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0400-participant.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1500/upgrade/0400-participant.sql new file mode 100644 index 00000000..97ae43a3 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/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/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 index 00000000..bc506e99 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/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/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 index 00000000..3341d8e0 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/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/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0300-participant.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0300-participant.sql deleted file mode 100644 index 10ddaaf6..00000000 --- a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0300-participant.sql +++ /dev/null @@ -1,20 +0,0 @@ -/* - * ============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 DROP lastMsg; 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 index 00000000..d5f7871b --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/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========================================================= + */ + +DROP TABLE participantreplica; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0400-participant.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/0400-participant.sql new file mode 100644 index 00000000..10ddaaf6 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/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 DROP lastMsg; 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 index 00000000..61a5454c --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/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========================================================= + */ + +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 index 00000000..6c5f30ee --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/downgrade/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 DROP FOREIGN KEY participant_replica_fk; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0300-participant.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0300-participant.sql deleted file mode 100644 index 042c454a..00000000 --- a/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0300-participant.sql +++ /dev/null @@ -1,20 +0,0 @@ -/* - * ============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 datetime(6) DEFAULT Now(); 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 index 00000000..cb5969d5 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/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 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/0400-participant.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1500/upgrade/0400-participant.sql new file mode 100644 index 00000000..042c454a --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/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 datetime(6) DEFAULT Now(); 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 index 00000000..bc506e99 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/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/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 index 00000000..3341d8e0 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/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; -- cgit