Added some db constraints and defaults