This does not seem to work anymore starting with HA Core 2023.4 where the new table states_meta
has been introduced. How to adapt this statement so it works again?
Edit: found a working version, thanks to @jeedewee, see How to keep your recorder database size under control - #126 by jeedewee