Adds support for foreign keys in table templates