* Make statistics validation create issue registry issues
* Disable creating issue about outdated MariaDB version in tests
* Use call_soon_threadsafe instead of run_callback_threadsafe
* Update tests
* Fix flapping test
* Disable creating issue about outdated SQLite version in tests
* Implement agreed changes
* Add translation strings for issue titles
* Update test
* Update string formatting to use f-string on components
* Update code given review feedback
* Use f-string
---------
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Teach recorder data migrator base class to update MigrationChanges
* Bump migration version
* Improve test coverage
* Update migration.py
* Revert migrator version bump
* Remove unneeded change
* Close database connection before stopping the executor
related issue #117004
* Close database connection before waiting for database executor to finish
related issue #117004
* fix test
* fix
* drop unused arg
* Revert "drop unused arg"
This reverts commit 8a9fe6a24a.
* docstring
* comment
* Raise on database error in recorder.migration._drop_foreign_key_constraints
* Fix test
* Fix test
* Revert "Fix test"
This reverts commit 940b8cb506e912826d43d09d7697c10888bdf685.
* Update test
* Improve test coverage
* Disable test for SQLite
* Drop violating rows before adding foreign constraints
* Don't delete rows with null-references
* Only delete rows when integrityerror is caught
* Move restore of dropped foreign key constraints to a separate migration step
* Use aliases for tables
* Update homeassistant/components/recorder/migration.py
* Update test
* Don't use alias for table we're deleting from, improve test
* Fix MySQL
* Update instead of deleting in case of self references
* Improve log messages
* Batch updates
* Add workaround for unsupported LIMIT in PostgreSQL
* Simplify
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
* Ensure legacy event foreign key is removed from the states table
If the system ran out of disk space removing the FK, it would
fail. #121938 fixed that to try again, however that PR was made
ineffective by #122069 since it will never reach the check.
To solve this, the migration version is incremented to 2, and
the migration is no longer marked as done unless the rebuild
/fk removal is successful.
* fix logic for mysql
* fix test
* asserts
* coverage
* coverage
* narrow test
* fixes
* split tests
* should have skipped
* fixture must be used