Updated SQL schemas for FOREIGN KEY changes

Was trying to setup freemed too see if it might be adaptable to what I need & ran into trouble with the install.php script erroring when it was attempting to configure the mysql table with MySQL 5.5... Traced the issue to table columns that weren't matching with the FOREIGN KEY maps causing error 150's. Also had too rearrange the script source execution order to allow for FOREIGN KEY maps to be in order.