100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Fixed migrations to use the supplied schema for the indexes for asset_datapoint_id and asset_predicted_datapoint_id. (#2205)
Michael Rademakercf4c63967993
diff --git a/manager/src/main/resources/org/openremote/manager/setup/database/V20240722_01__Indexes.sql b/manager/src/main/resources/org/openremote/manager/setup/database/V20240722_01__Indexes.sqlindex eea761618..f7efab08f 100644--- a/manager/src/main/resources/org/openremote/manager/setup/database/V20240722_01__Indexes.sql+++ b/manager/src/main/resources/org/openremote/manager/setup/database/V20240722_01__Indexes.sql@@ -19,5 +19,5 @@*//* Add an index for entity ID, attribute name and timestamp to improve data point retrieval */-CREATE index if not exists asset_datapoint_entity_id_attribute_name_timestamp_idx on ${schemaName}.asset_datapoint (entity_id, attribute_name, timestamp DESC);-CREATE index if not exists asset_predicted_datapoint_entity_id_attribute_name_timestamp_idx on ${schemaName}.asset_predicted_datapoint (entity_id, attribute_name, timestamp DESC);+CREATE index if not exists asset_datapoint_entity_id_attribute_name_timestamp_idx on openremote.asset_datapoint (entity_id, attribute_name, timestamp DESC);+CREATE index if not exists asset_predicted_datapoint_entity_id_attribute_name_timestamp_idx on openremote.asset_predicted_datapoint (entity_id, attribute_name, timestamp DESC);diff --git a/manager/src/main/resources/org/openremote/manager/setup/database/V20251022_01__UpdateIndexesSchemaName.sql b/manager/src/main/resources/org/openremote/manager/setup/database/V20251022_01__UpdateIndexesSchemaName.sqlnew file mode 100644index 000000000..56fad4639--- /dev/null+++ b/manager/src/main/resources/org/openremote/manager/setup/database/V20251022_01__UpdateIndexesSchemaName.sql@@ -0,0 +1,26 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */++/* Drop and recreate indexes with parameterized schema name for flexibility */+DROP INDEX IF EXISTS openremote.asset_datapoint_entity_id_attribute_name_timestamp_idx;+DROP INDEX IF EXISTS openremote.asset_predicted_datapoint_entity_id_attribute_name_timestamp_idx;++CREATE INDEX IF NOT EXISTS asset_datapoint_entity_id_attribute_name_timestamp_idx ON ${schemaName}.asset_datapoint (entity_id, attribute_name, timestamp DESC);+CREATE INDEX IF NOT EXISTS asset_predicted_datapoint_entity_id_attribute_name_timestamp_idx ON ${schemaName}.asset_predicted_datapoint (entity_id, attribute_name, timestamp DESC);