Add support SQL VACUUM for PostgeSQL (#28106)

* Add support SQL VACUUM for PostgeSQL

VACUUM PostgreSQL DB if repack is true

* Update tests
This commit is contained in:
bastshoes authored and Paulus Schoutsen committed 2019-10-22 08:39:26 -07:00
1 parent c2c9213e9b
commit 0226b76e0a
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -34,8 +34,8 @@ def purge_old_data(instance, purge_days, repack):
_LOGGER.debug("Deleted %s events", deleted_rows)
# Execute sqlite vacuum command to free up space on disk
if repack and instance.engine.driver == "pysqlite":
_LOGGER.debug("Vacuuming SQLite to free space")
if repack and instance.engine.driver in ("pysqlite", "postgresql"):
_LOGGER.debug("Vacuuming SQL DB to free space")
instance.engine.execute("VACUUM")
except SQLAlchemyError as err: