Fixed #23338 -- Added warning when unique=True on ForeigKey

This PR is similar to #3196 but with the tests and the updated documentation as requested.