create main model, fixe error in db creation

create main model, fixe error in db creation