Skip to content

fix: migration error in read-compat-flag#5232

Merged
maidul98 merged 1 commit intomainfrom
chore/migration-fix
Jan 22, 2026
Merged

fix: migration error in read-compat-flag#5232
maidul98 merged 1 commit intomainfrom
chore/migration-fix

Conversation

@akhilmhdh
Copy link
Member

@akhilmhdh akhilmhdh commented Jan 22, 2026

Context

This PR fixes an error in raw query where the array was treated as parameterized items (so if there were more items in the array it would be greater than the expected params count). Switched it back to normal query instead of raw. This was converted to raw query to avoid ts error that happened due to later removing this field. Suppressed with with ts-expect-error command.

Screenshots

Steps to verify the change

Type

  • Fix
  • Feature
  • Improvement
  • Breaking
  • Docs
  • Chore

Checklist

  • Title follows the conventional commit format: type(scope): short description (scope is optional, e.g., fix: prevent crash on sync or fix(api): handle null response).
  • Tested locally
  • Updated docs (if needed)
  • Read the contributing guide

@akhilmhdh akhilmhdh requested a review from maidul98 January 22, 2026 06:58
@maidul98
Copy link
Collaborator

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 22, 2026

Greptile Summary

Fixed a bug in the migration's raw SQL query where parameter binding was incorrect. The raw query template expected individual placeholders for each ID in the IN clause, but was receiving the entire array as a single parameter. Switched to knex query builder which handles array parameters correctly for whereIn() operations. Added @ts-expect-error directive to suppress TypeScript errors for the shouldCheckSecretPermission field that was removed in a later migration.

  • Fixed parameter binding issue in UPDATE query with IN clause
  • Replaced knex.raw() with standard knex query builder
  • Added TypeScript error suppression for removed field

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - it fixes a genuine bug in migration parameter binding
  • The change correctly fixes a SQL parameter binding issue where the raw query was improperly handling array parameters. The migration remains idempotent (protected by hasColumn check) and the knex query builder is the appropriate solution. Score is 4 rather than 5 because migrations should ideally be tested in a staging environment before merging
  • No files require special attention

Important Files Changed

Filename Overview
backend/src/db/migrations/20250824192801_backfill-secret-read-compat-flag.ts Replaced raw SQL query with knex query builder to fix migration error, added @ts-expect-error to suppress TypeScript error for removed field

@maidul98 maidul98 merged commit 5b0a519 into main Jan 22, 2026
12 of 13 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