diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2024-08-15 11:08:57 +0100 |
---|---|---|
committer | adheli.tavares <adheli.tavares@est.tech> | 2024-08-15 11:10:39 +0100 |
commit | 88744c04a7cfed3a4227bc2137102ff5fe69895f (patch) | |
tree | 5865844183729aed07f06dd2f94e4940e7ff80f1 /feature-distributed-locking/src/main/feature | |
parent | f6d8e60eb75733cf9996bffb3c6ecb586f377da6 (diff) |
PostgreSQL support for Drools
- moved all sql related management to db-migrator
- any hardcoded variable related to database is configurable
Issue-ID: POLICY-5107
Change-Id: I789895773ba8737651f68a0b494f72f947a147d1
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'feature-distributed-locking/src/main/feature')
7 files changed, 2 insertions, 146 deletions
diff --git a/feature-distributed-locking/src/main/feature/config/feature-distributed-locking.properties b/feature-distributed-locking/src/main/feature/config/feature-distributed-locking.properties index 69629e15..fa311260 100644 --- a/feature-distributed-locking/src/main/feature/config/feature-distributed-locking.properties +++ b/feature-distributed-locking/src/main/feature/config/feature-distributed-locking.properties @@ -3,7 +3,7 @@ # ONAP # ================================================================================ # Copyright (C) 2018-2019, 2021-2022 AT&T Intellectual Property. All rights reserved. -# Modifications Copyright (C) 2023 Nordix Foundation. +# Modifications Copyright (C) 2023-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. @@ -20,7 +20,7 @@ ### #Database properties -jakarta.persistence.jdbc.driver=org.mariadb.jdbc.Driver +jakarta.persistence.jdbc.driver=${envd:JDBC_DRIVER} jakarta.persistence.jdbc.url=${envd:JDBC_URL}pooling${envd:JDBC_OPTS} jakarta.persistence.jdbc.user=${envd:SQL_USER} jakarta.persistence.jdbc.password=${envd:SQL_PASSWORD} diff --git a/feature-distributed-locking/src/main/feature/db/pooling/sql/1804-distributedlocking.downgrade.sql b/feature-distributed-locking/src/main/feature/db/pooling/sql/1804-distributedlocking.downgrade.sql deleted file mode 100644 index cd1b815d..00000000 --- a/feature-distributed-locking/src/main/feature/db/pooling/sql/1804-distributedlocking.downgrade.sql +++ /dev/null @@ -1,20 +0,0 @@ -# ============LICENSE_START======================================================= -# feature-distributed-locking -# ================================================================================ -# Copyright (C) 2018 AT&T Intellectual Property. 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. -# ============LICENSE_END========================================================= - -use pooling; -drop table if exists locks;
\ No newline at end of file diff --git a/feature-distributed-locking/src/main/feature/db/pooling/sql/1804-distributedlocking.upgrade.sql b/feature-distributed-locking/src/main/feature/db/pooling/sql/1804-distributedlocking.upgrade.sql deleted file mode 100644 index 07b30738..00000000 --- a/feature-distributed-locking/src/main/feature/db/pooling/sql/1804-distributedlocking.upgrade.sql +++ /dev/null @@ -1,30 +0,0 @@ -# ============LICENSE_START======================================================= -# feature-distributed-locking -# ================================================================================ -# Copyright (C) 2018, 2022 AT&T Intellectual Property. 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. -# ============LICENSE_END========================================================= - -SET foreign_key_checks=0; - -CREATE TABLE if NOT EXISTS pooling.locks( - resourceId VARCHAR(128), - host VARCHAR(128), - owner VARCHAR(128), - expirationTime BIGINT, - PRIMARY KEY (resourceId), - INDEX idx_expirationTime(expirationTime), - INDEX idx_host(host)); - -SET foreign_key_checks=1;
\ No newline at end of file diff --git a/feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.downgrade.sql b/feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.downgrade.sql deleted file mode 100644 index 55a883f2..00000000 --- a/feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.downgrade.sql +++ /dev/null @@ -1,19 +0,0 @@ -# ============LICENSE_START======================================================= -# feature-distributed-locking -# ================================================================================ -# Copyright (C) 2018, 2021 AT&T Intellectual Property. 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. -# ============LICENSE_END========================================================= - -ALTER TABLE pooling.locks modify if exists expirationTime bigint(20) default 0; diff --git a/feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.upgrade.sql b/feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.upgrade.sql deleted file mode 100644 index 0cdad5b9..00000000 --- a/feature-distributed-locking/src/main/feature/db/pooling/sql/1811-distributedlocking.upgrade.sql +++ /dev/null @@ -1,23 +0,0 @@ -# ============LICENSE_START======================================================= -# feature-distributed-locking -# ================================================================================ -# Copyright (C) 2018, 2021-2022 AT&T Intellectual Property. 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. -# ============LICENSE_END========================================================= - -SET foreign_key_checks=0; - -ALTER TABLE pooling.locks MODIFY expirationTime TIMESTAMP DEFAULT '1971-01-01 00:00:00.000000'; - -SET foreign_key_checks=1; diff --git a/feature-distributed-locking/src/main/feature/install/disable b/feature-distributed-locking/src/main/feature/install/disable deleted file mode 100644 index be455734..00000000 --- a/feature-distributed-locking/src/main/feature/install/disable +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env sh - -# ============LICENSE_START======================================================= -# ONAP -# ================================================================================ -# Copyright (C) 2018-2021 AT&T Intellectual Property. 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. -# ============LICENSE_END========================================================= - -if [ "${DEBUG}" = "y" ]; then - set -x -fi - -${POLICY_HOME}/bin/db-migrator -s pooling -o downgrade - diff --git a/feature-distributed-locking/src/main/feature/install/enable b/feature-distributed-locking/src/main/feature/install/enable deleted file mode 100644 index af202f56..00000000 --- a/feature-distributed-locking/src/main/feature/install/enable +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env sh - -# ============LICENSE_START======================================================= -# ONAP -# ================================================================================ -# Copyright (C) 2018-2021 AT&T Intellectual Property. 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. -# ============LICENSE_END========================================================= - -if [ "${DEBUG}" = "y" ]; then - set -x -fi - -${POLICY_HOME}/bin/db-migrator -s pooling -o upgrade - |