Skip to content

fix: add missing velocity_24h and ple_delta_24h columns to campaigns table#33

Merged
Jing-yilin merged 1 commit intodevelopfrom
fix/db-schema-velocity-columns
Feb 27, 2026
Merged

fix: add missing velocity_24h and ple_delta_24h columns to campaigns table#33
Jing-yilin merged 1 commit intodevelopfrom
fix/db-schema-velocity-columns

Conversation

@Jing-yilin
Copy link
Contributor

Problem

After deploying the Cloudflare challenge fix (aa9ad5e), the backend is failing with:

ERROR: column "velocity_24h" does not exist (SQLSTATE 42703)

The model has Velocity24h and PleDelta24h fields, but these columns don't exist in the dev database.

Solution

Added idempotent migration in db.go to ensure both columns exist:

  • velocity_24h - DOUBLE PRECISION DEFAULT 0
  • ple_delta_24h - DOUBLE PRECISION DEFAULT 0

The migration runs on startup and is idempotent (safe to run multiple times).

Testing

  • ✅ Go build succeeds
  • ✅ Tests pass
  • Migration will run automatically on next deployment

Related

🤖 Generated with Claude Code

…table

The model includes Velocity24h and PleDelta24h fields but the database
was missing these columns, causing SQLSTATE 42703 errors when querying
campaigns.

Added idempotent migration to ensure both columns exist with proper
defaults (0) when the backend starts.

Related to deployment aa9ad5e - columns were added to model but not
migrated to dev database.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@Jing-yilin Jing-yilin added bug Something isn't working backend Backend related priority:high High priority labels Feb 27, 2026
@Jing-yilin Jing-yilin merged commit d7989c1 into develop Feb 27, 2026
2 checks passed
@Jing-yilin Jing-yilin deleted the fix/db-schema-velocity-columns branch February 27, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend related bug Something isn't working priority:high High priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant