Skip to content

feat(migrations): do not use bound parameters#1128

Draft
rafael wants to merge 1 commit into
masterfrom
storage/use-literals-migraton
Draft

feat(migrations): do not use bound parameters#1128
rafael wants to merge 1 commit into
masterfrom
storage/use-literals-migraton

Conversation

@rafael
Copy link
Copy Markdown

@rafael rafael commented May 26, 2026

What kind of change does this PR introduce?

Compatibility change.

What is the current behavior?

The SELECT set_config(...) batch that runs before tenant migrations (src/internal/database/migrations/migrate.ts) passes its values as bound parameters:

SELECT set_config('storage.install_roles', $1, false), ...

Stock PostgreSQL accepts this, but some Multigres doesn't support this (yet) and rejects the query with:

0A000: set_config value argument must be a literal, not a bound parameter; inline the value into the query text

This causes runMigrations to fail at startup against those engines, blocking the integration entirely.

What is the new behavior?

The eight set_config values are now inlined as SQL literals via a small lit() helper that escapes single quotes.

Tests

  • I ran npm run migration:run pointing against a local multigres cluster and with this fix migrations work.
  • I also ran npm run test:integration and all tests pass.

Signed-off-by: Rafael Chacon <24160+rafael@users.noreply.github.com>
@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 26477286915

Coverage increased (+0.01%) to 75.163%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: 2 of 2 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 10645
Covered Lines: 8434
Line Coverage: 79.23%
Relevant Branches: 6225
Covered Branches: 4246
Branch Coverage: 68.21%
Branches in Coverage %: Yes
Coverage Strength: 362.55 hits per line

💛 - Coveralls

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