fix/seed-any-in
safeda63665 · fullpre-PRreviewed 2026-08-07 00:56 UTC0H · 0M · 1L · 3I- Purpose
- Fix a broken SQL construction in the subscription-plan seed script that made the verification query fail at runtime
- Goal
- Replace ANY(array) with IN (...) using sql.join() so Drizzle generates valid parameterized SQL for the multi-org lookup in the seed verification step
- Sub-goals
- SG-1: Replace ANY(${array}) with sql.join IN() in the verification query WHERE clause
- What
- packages/database/src/seed-subscription-plans.ts — verification query WHERE clause: ANY(${array}) → IN (${sql.join(values, sql`, `)}) with each value wrapped in sql`${...}` for proper parameterization
- Why
- Drizzle's sql template tag does not accept a raw JS array in ANY(${array}) — it would produce invalid or un-parameterized SQL. The sql.join() approach is the idiomatic Drizzle pattern for parameterized IN clauses.
- Areas
- packages/database/src/seed-subscription-plans.ts+4−1
- Blast
- 1 file, +4/-1 lines. Seed script only — zero runtime/production-path impact. No schema change, no migration, no API surface touched.
Findings · 4
conventions1
Conventions consistent — sql.join is the idiomatic Drizzle pattern for IN clauses
packages/database/src/seed-subscription-plans.ts:97
Uses Drizzle sql tag correctly, is idempotent, does not import domain logic.
tests1
No test coverage expected for seed scripts
packages/database/src/seed-subscription-plans.ts:1
Seed scripts are imperative-only and run against a real database; automated tests are out of scope.
improvement2
MRR calculation hardcodes rate 2500 (pre-existing)
packages/database/src/seed-subscription-plans.ts:72
Not introduced by this diff. Verification console output uses a hardcoded centavos rate instead of reading from the query result; silently misreports if rates diverge per plan.
Optional: inline comment explaining why ANY() was not used
packages/database/src/seed-subscription-plans.ts:97
A comment noting 'sql.join required — ANY(array) does not produce valid parameterized SQL in Drizzle' would help future readers.