Skip to content

Conversation

@marcodejongh
Copy link
Owner

Summary

Add verbose logging to the migration script for better visibility in CI builds.

Changes

  • Log timestamp + first 200 chars of each SQL query as it executes
  • Show total migrations in journal before running

Example Output

🔄 Running migrations on: ep-dry-night-a67fnzaz-pooler.us-west-2.aws.neon.tech
📋 Found 27 migrations in journal
[17:05:23] INSERT INTO board_climbs (board_type, uuid, layout_id, ...) SELECT 'kilter', uuid, layout_id...
[17:07:45] DELETE FROM board_beta_links WHERE climb_uuid NOT IN (SELECT uuid FROM board_climbs)...
[17:08:12] ALTER TABLE "board_beta_links" ADD CONSTRAINT "board_beta_links_climb_fk"...
✅ Migrations completed successfully

Why

Long-running migrations (like the unified tables migration) give no feedback in CI. This makes it hard to know if a migration is stuck or just slow.

🤖 Generated with Claude Code

Add verbose logging to migration script for better visibility in CI:
- Log timestamp + first 200 chars of each SQL query
- Show total migrations in journal before running

This helps debug slow/stuck migrations by showing progress in real-time.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Jan 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
boardsesh Building Building Jan 4, 2026 6:40am

@claude
Copy link

claude bot commented Jan 4, 2026

Claude Review

Ready to merge - Minor issues noted below, but nothing blocking.

Issues

  1. Missing error handling for journal file (packages/db/scripts/migrate.ts:84): fs.readFileSync will throw if the journal file doesn't exist or is malformed JSON. Consider wrapping in try-catch or checking file existence first to provide a clearer error message.

  2. Logs total migrations, not pending (packages/db/scripts/migrate.ts:85): The log says "Found X migrations in journal" but this shows total migrations, not pending ones. The wording could be misleading - consider clarifying this is the total count or actually computing pending migrations by checking the drizzle_migrations table.

@marcodejongh marcodejongh merged commit 73f2228 into main Jan 4, 2026
4 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants