Enable to define table relations with plugins 

I create pull request following to issues #4068 and #4069.