fixes #2421 added missing associations in models
fixes #2400 add foreign keys to database migrations