add primaryKey and foreignKey constrain and fix some bugs in windows for mysql adapter