Fixes problems found when creating db models
Fixes problems found when creating db models

* puts class definitions before they are referenced
* add required arguments
* fixes clashes in generated field names
* fixes some typos

jennselby/adelie