dynamic_model: rewrite, upgrade

1) big performance upgrade - now table will get altered only once per
model initialization and not separate alter table xxx for each model
field
2) fixed some bugs