Update database schema

Use correct types, default values, on update values, delete obsolete columns, rename some for consistency, add dates and editdates to more tables, etc.