Tidied up entity<->DB mappings + migration script