fix: align company Drizzle schema with migration 0011 - #298
Draft
kien-ship-it wants to merge 3 commits into
Draft
Conversation
Remove the legacy plaintext embedding credential columns from the company Drizzle schema and drop the runtime fallback reads that still queried them. Migration 0011 already drops those columns, so clean migration-replayed databases failed on full company selects/returning. Move the backfill script under apps/web and switch it to raw SQL so it can still migrate older db:push-shaped databases that retain the columns. Co-authored-by: Kien Le <kien-ship-it@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Restore the missing Changesets config and record a patch release note for the @launchstack/core schema/runtime alignment with migration 0011. Co-authored-by: Kien Le <kien-ship-it@users.noreply.github.com>
Assert the company Drizzle schema and credential read path stay aligned with migration 0011, and add an optional live DB check that select/insert succeed after the plaintext embedding columns are dropped. Co-authored-by: Kien Le <kien-ship-it@users.noreply.github.com>
Reproduction result for #297Successfully reproduced against local Postgres:
Durable coverage added in:
This PR uses |
CI / build wait complete — all required checks green
#297 regression coverage in CI:
Blocking suite: 46 suites / 461 tests passed. Legacy baseline job still fails (pre-existing, No further code changes needed for e2e/build compatibility. |
Owner
|
yo @kien-ship-it lmk when its ready for review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
0011drops.company-credentialsso runtime matches the encrypted credentials table.apps/weband switches it to raw SQL for olderdb:pushdatabases that still have the columns.Related
Closes #297
Checklist
pnpm checkpasses (lint + typecheck) — CIcheckgreen@launchstack/core.env.exampleandapps/web/src/env.ts(N/A)CI status (latest head)
check✅build✅build✅Build prebuilt runner✅launch-stack/pdr-ai-v2✅Reproduction (confirmed locally)
Against a clean Postgres DB:
pdr_ai_v2_company0008_company_embedding_provider_config.sql→ 4 columns present0011_drop_plaintext_embedding_credentials.sql→ 0 rows for those columnscolumn "embedding_openai_api_key" does not existselect()/.returning()FAILNotes for reviewers
Design choice: treat migration 0011 as the intended final state (not re-add the columns). That matches the encrypted
company_embedding_credentialswrite path already used by signup/update.API request fields like
embeddingOpenAIApiKeyin validation/settings remain — those are HTTP payload names mapped into the encrypted table, not DB columns.