This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>de.bennig</groupId> | |
| <version>0.0.1-SNAPSHOT</version> | |
| <artifactId>pomtest</artifactId> | |
| <name>pomtest</name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This code snippet is designed to identify "corrupted" data in Home Assistant statistics and generates (without executing) update scripts to repair these statistics and the statistics_short_term data. | |
| *Note: "Corrupted" here refers to instances where statistics were unintentionally reset to a sum of 0. | |
| At present, this functionality is limited to cases where the corruption did not happen within the timeframe covered by the statistics_short_term data. However, the script can be modified to address such scenarios. | |
| */ | |
| select id, created, statistic_id, metadata_id, sum, oldsum, sum / oldsum, | |
| 'update statistics set sum=sum + ' || oldsum || ' where id >= ' || id || ' and metadata_id = ' || metadata_id || ';', |