chore(setup:db): surface drizzle-kit errors instead of catch-all

push_schema used to print "Failed (may not have db:push script)" for
every non-zero exit, lumping real failures (stuck rename prompts,
pre-existing public enums) in with missing scripts. Now it prints the
real exit code and tails the last 5 lines of drizzle-kit output so the
root cause is visible without re-running by hand.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-23 15:36:18 +02:00
parent 700861f682
commit be8f5618c6

View file

@ -64,7 +64,13 @@ push_schema() {
elif [ $exit_code -eq 0 ]; then
echo -e " ${GREEN}✓ Schema pushed${NC}"
else
echo -e " ${RED}✗ Failed (may not have db:push script)${NC}"
# Real failure (push script exists but exit ≠ 0). Surface the last
# lines of drizzle-kit output so the root cause is visible without
# re-running by hand. Common cases: interactive rename prompt on
# stdin-less invocation, or pre-existing public-schema enums the
# service's schemaFilter hides.
echo -e " ${RED}✗ Schema push failed (exit ${exit_code})${NC}"
echo "$output" | tail -5 | sed 's/^/ /'
fi
}