Defer creating foreign keys until as late as possible, to avoid foreign key constraint issues when creating