Skip to content

feat: change public schema to trueforge schema for Postgres - #488

Open
thesujai wants to merge 2 commits into
mainfrom
feat/update-schema-trueforge
Open

feat: change public schema to trueforge schema for Postgres#488
thesujai wants to merge 2 commits into
mainfrom
feat/update-schema-trueforge

Conversation

@thesujai

@thesujai thesujai commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Summary

change public schema to trueforge schema for Postgres

Changes

change public schema to trueforge schema for Postgres

How was this tested?

Recreating every scenarios and also through tests

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

Medium Risk
One-time DDL on every migration run (schema create + possible table moves) affects all Postgres deployments; logic is tested but mistakes could strand tables or break migrations.

Overview
Moves Trueforge’s Postgres app data and Kysely migration bookkeeping out of public into a dedicated trueforge schema.

Migration path: runMigrations now calls ensureTrueforgeSchema first, which creates the schema (with an advisory lock and lock_timeout), then ALTER TABLE … SET SCHEMA for a fixed list of legacy public tables so existing installs keep data and migration history. The Kysely Migrator uses migrationTableSchema: trueforge.

Runtime: createDb sets the pool search_path to trueforge so unqualified queries hit the right tables. AGENTS.md documents the convention.

Tests: Client test asserts search_path; new integration tests cover greenfield installs and simulating pre-upgrade public tables moved back on upgrade.

Reviewed by Cursor Bugbot for commit eae5777. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eae5777

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@truefoundry/trueforge Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@thesujai thesujai changed the title feat: feat: change public schema to trueforge schema for Postgres Aug 28, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cdca799. Configure here.

Comment thread packages/trueforge/src/db/postgres/schema.ts
Comment thread packages/trueforge/src/db/postgres/client.ts
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.

1 participant