Add consumer producer messages support in DB-migrator 78/140178/1
authorFrancescoFioraEst <francesco.fiora@est.tech>
Thu, 30 Jan 2025 10:52:10 +0000 (10:52 +0000)
committerFrancesco Fiora <francesco.fiora@est.tech>
Mon, 10 Feb 2025 08:52:56 +0000 (08:52 +0000)
Issue-ID: POLICY-5275
Change-Id: Idd2d9abf278c71d60a2387b1814acb65da305b95
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/downgrade/0100-message.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/downgrade/0200-messagejob.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/downgrade/0300-messagejob_identificationId_index.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/upgrade/0100-message.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/upgrade/0200-messagejob.sql [new file with mode: 0644]
policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/upgrade/0300-messagejob_identificationId_index.sql [new file with mode: 0644]

diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/downgrade/0100-message.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/downgrade/0100-message.sql
new file mode 100644 (file)
index 0000000..2bec3fb
--- /dev/null
@@ -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=========================================================
+ */
+
+DROP TABLE message;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/downgrade/0200-messagejob.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/downgrade/0200-messagejob.sql
new file mode 100644 (file)
index 0000000..e4b5625
--- /dev/null
@@ -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=========================================================
+ */
+
+DROP TABLE messagejob;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/downgrade/0300-messagejob_identificationId_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/downgrade/0300-messagejob_identificationId_index.sql
new file mode 100644 (file)
index 0000000..d54f538
--- /dev/null
@@ -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=========================================================
+ */
+
+DROP INDEX IF EXISTS messagejob_identificationId_index;
diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/upgrade/0100-message.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/upgrade/0100-message.sql
new file mode 100644 (file)
index 0000000..f13f3b8
--- /dev/null
@@ -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/policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/upgrade/0200-messagejob.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/upgrade/0200-messagejob.sql
new file mode 100644 (file)
index 0000000..ea6d7ba
--- /dev/null
@@ -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/policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/upgrade/0300-messagejob_identificationId_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1700/upgrade/0300-messagejob_identificationId_index.sql
new file mode 100644 (file)
index 0000000..4d512dc
--- /dev/null
@@ -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);