Add foreign key query to LocalShare table at upgrading