rewrite migrations
update models & use count_cache for speeding up