Fixed some issues related to foreign keys.

1. For column: character set and collate should be after data type.
2. For FK: sometimes pk index is null.
3. For FK: When there is a index covers the columns of fk, mysql will
use the index for the fk.