getViewsCountAttribute is using a raw SQL statement that is specific to pgsql, it fails on MySQL/MariaDB. Added a conditional to use mysql specific code to access data in the json array. Crude, but no more so than the original?