Initial ORM porting [ci skip]