Database improvements & additions

Fixed gleez/cms#748