hassio-addons / addon-sqlite-web

SQLite Web - Home Assistant Community Add-ons
https://addons.community
MIT License
53 stars 11 forks source link

DELETE FROM states database corruption #305

Closed coserotondo closed 5 months ago

coserotondo commented 6 months ago

Problem/Motivation

I wanted to delete 8 rows from states to clean some invalid data and after that HA found the db as corrupted and instantiated a new DB.

[SQL: INSERT INTO states (entity_id, state, attributes, event_id, last_changed, last_changed_ts, last_updated, last_updated_ts, old_state_id, attributes_id, context_id, context_user_id, context_parent_id, origin_idx, context_id_bin, context_user_id_bin, context_parent_id_bin, metadata_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING state_id] [parameters: (None, 'unavailable', None, None, None, None, None, 1711625571.869187, 64566985, 913713, None, None, None, 0, <memory at 0x7f37f34340>, None, None, 712)] (Background on this error at: https://sqlalche.me/e/20/gkpj)

1) is this normal? 2) Now a recovered from backup but lost 2 day of data. I can browse the "corrupted" database and I'm asking if I can manually append the missing states in the recovered backup.

coserotondo commented 6 months ago

Well, Ive just tried to reuse the "corrupted" db and it works again, so why the DELETE query has been identified as a database corruption by HA?

github-actions[bot] commented 5 months ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!