Changed ModelID int to mediumint

Changed int to mediumint and fixed FK related.