In the knowledge base article there are 4 steps described to automate the deployment process
- Pull updates for git
- Run composer install
- Run migrate/all
- Run project-config/apply
The problem with this is that when you have pushed a structural change (eg. adding a new field) and a content migration (adding new entry using that new field) at the same time, it fails because you cannot migrate into a non existing field of course
You cannot flip step 3 and 4 as in that scenario changes made to Craft CMS are not yet available in the database.