Moved setting of a foreign key into the internal auth plugin in an attempt to allow the upgrade to 0.8 work