various db script fixes

Note: The following fixes can probably be cherry picked to the 2.8 branch - I have not tested them.

   Added missing foreign key constraints related to the status tables. 
   Fixed username size - should be 255 like the other databases.