Add: CounterCache feature to hasMany models

as discussed in issue #1879 
Nope, nothing in the code springs to mind as breaking PG / mariadb. Especially not maria since it should work exactly like mysql :). I'll check out your code and have a look