fixes #2400 add foreign keys to database migrations