Skip to content

fix(db): add missing rollout_by column migration for flags table - #697

Open
superlog-app[bot] wants to merge 1 commit into
stagingfrom
superlog/add-rollout-by-flags-migration
Open

fix(db): add missing rollout_by column migration for flags table#697
superlog-app[bot] wants to merge 1 commit into
stagingfrom
superlog/add-rollout-by-flags-migration

Conversation

@superlog-app

@superlog-app superlog-app Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Every request to GET /public/v1/flags/bulk is returning HTTP 500 in production. The root cause is a missing rollout_by column in the production flags PostgreSQL table — the Drizzle schema defines it, but db:push was never applied to production after the column was added.

Root cause

The Drizzle schema in packages/db/src/drizzle/schema/flags.ts includes:

rolloutBy: text("rollout_by"),

Drizzle selects every schema column on bulk queries, so the generated SQL always includes "d0"."rollout_by" as "rolloutBy". The production database does not have this column, causing PostgreSQL to throw error 42703 (errorMissingColumn) on every invocation. Telemetry confirms 3 error events at 2026-08-31T20:58:31–32Z, all status 500.

Remediation

Adds packages/db/src/drizzle/migrations/20260831_add_rollout_by_to_flags.sql, an idempotent ALTER TABLE … ADD COLUMN IF NOT EXISTS migration following the same manual-apply pattern as the ClickHouse migrations.

⚠️ This migration must be applied to the production database immediately — deploying the code change alone does not fix the outage. Run:

ALTER TABLE flags ADD COLUMN IF NOT EXISTS rollout_by TEXT;

Related incident: tender-porcupine (459c2ef9-6187-412b-aad9-edd8be764c5a)


Was this PR helpful? Leave feedback — goes straight to the Superlog team.


Summary by cubic

Fixes GET /public/v1/flags/bulk returning HTTP 500 in production. The flags table is missing the rollout_by column that the Drizzle schema expects, so bulk queries fail with PostgreSQL error 42703.

  • Adds an idempotent ALTER TABLE flags ADD COLUMN IF NOT EXISTS rollout_by TEXT migration.
  • Apply this migration to production immediately; deploying the code change alone does not fix the outage.

Written for commit 0989b10. Summary will update on new commits.

Review in cubic

Delivery-Id: df50b5706d4d34768e12da9ece2ea5cb6f0f9deb4d10f8f17bf4d8e0bbdce93c
Delivery-Base: staging
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
dashboard Ready Ready Preview Aug 31, 2026 9:15pm
databuddy-status Ready Ready Preview Aug 31, 2026 9:15pm
documentation Ready Ready Preview Aug 31, 2026 9:15pm

@unkey-deploy

unkey-deploy Bot commented Aug 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Unkey Deploy

Name Status Preview Inspect Updated (UTC)
links (preview) Ready Visit Preview Inspect Aug 31, 2026 9:14pm

@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds an idempotent PostgreSQL migration to restore the missing nullable flags.rollout_by column and resolve failures in bulk feature-flag queries.

  • Adds rollout_by as a nullable TEXT column, matching the existing Drizzle schema.
  • Uses IF NOT EXISTS so manual application is safe to repeat.
  • Documents that operators must apply the migration before or alongside affected application code.

Confidence Score: 5/5

The PR appears safe to merge, provided the explicitly documented production migration is applied operationally.

The SQL adds the missing column with the same PostgreSQL type and nullable contract as the existing Drizzle schema, and repeated application is protected by IF NOT EXISTS.

Important Files Changed

Filename Overview
packages/db/src/drizzle/migrations/20260831_add_rollout_by_to_flags.sql Adds an idempotent, schema-compatible column migration; no actionable defect was identified in the changed SQL.

Reviews (1): Last reviewed commit: "fix(db): add missing rollout_by column m..." | Re-trigger Greptile

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.

0 participants