Seperate User "class" into own file.

Also add some SQLite CHECK constraints.