CORE-5386 Updated all tables to use UUIDs.

Updated remaining tables to use UUIDs in place of int or varchar IDs.
Added some missing foreign key constraints.