Fix databse model to use foreign key for course codes