On upgrade, the migration Job runs the **old** SQL even though the chart contains new migration files.
AdvancedTroubleshootingHooks, Tests, GitOps & Secrets
Answer
Likely causes → The SQL lives in a regular ConfigMap, which is updated only after pre-upgrade hooks run, so the Job mounts the previous version.
Diagnose → kubectl get cm shop-migrations -n shop -o yaml during the hook shows old content.
Fix → Make the migrations ConfigMap a hook too (pre-upgrade, weight -5, before-hook-creation) so it is created before the Job (weight 0), or bake migrations into the migration image.
Prevent → Remember that pre-* hooks see the old state of regular resources.
More on Hooks, Tests, GitOps & Secrets
`Error: INSTALLATION FAILED: failed post-install: job failed: BackoffLimitExceeded`Beginner`Error: UPGRADE FAILED: pre-upgrade hooks failed: timed out waiting for the condition`Intermediate`Error: UPGRADE FAILED: pre-upgrade hooks failed: warning: Hook pre-upgrade shop/templates/migrate-job.yaml failed: jobs.batch "shop-migrate" already exists`BeginnerThe migration hook fails with `psql: error: connection to server at "shop-postgres" (10.96.12.4), port 5432 failed: Connection refused` on first install.Intermediate`helm test` fails with `Error: unable to get pod logs for shop-test-api: pods "shop-test-api" not found`.Intermediate`helm test` hangs until timeout.Beginner