Skip to content

Replace Atlas CE with Ptah Compat to plan the full Rebase schema - #84

Closed
denisvmedia wants to merge 12 commits into
rebasepro:mainfrom
denisvmedia:feat/ptah-native-migrations
Closed

denisvmedia wants to merge 12 commits into
rebasepro:mainfrom
denisvmedia:feat/ptah-native-migrations

Conversation

@denisvmedia

@denisvmedia denisvmedia commented Nov 13, 2026 •

Copy link
Copy Markdown

Why

Rebase previously kept policies, functions, search and vector objects, triggers,
and views outside the schema it gave Atlas CE. Ordinary db generate and
db push could miss changes to objects Rebase already declares.

What changed

  • Use Ptah Compat 0.33.1 in the existing database commands. Generate one desired
    schema that includes policies, Rebase's SQL functions, search and vector
    indexes, triggers, and declared views.
  • Scope plans to Rebase-managed objects and preserve unrelated objects, auth
    provisioning, and migration revisions. Commit backend/drizzle/ptah-managed.json
    with the migrations so generation can recognize previously managed objects.
  • Keep the existing SQL migrations, atlas.sum, and revision records. An
    upgrade targeting Rebase 0.35.0 or its canaries switches existing projects
    from Atlas to Ptah Compat.
  • Plan changes to these objects through the regular migration commands. Keep
    the generated SQL that boot and recovery use.

A shared PostgreSQL dev server requires an explicit PTAH_TRUST_REPLAY_SQL=1
choice for trusted migration replay. Rebase marks its managed PGlite dev server
disposable. The website update is in #86.

Review by commit

  1. 909bcb05
    Install Ptah Compat 0.33.1 in Rebase projects.
  2. f3b06c95
    Render the complete desired PostgreSQL schema.
  3. 05855ac6
    Scope plans to Rebase-managed objects and protect database-owned defaults.
  4. 5bc9aad5
    Prepare Ptah Compat arguments and settings.
  5. 3115e71c
    Use Ptah to plan db generate and db push.
  6. b77dc837
    Detect Ptah installs under isolated pnpm layouts.
  7. f3b2b0ea
    Switch existing projects to Ptah when upgrading to Rebase 0.35.
  8. d0c63a3b
    Limit scratch database allocation and clean it up after a failed plan.
  9. 0de56c72
    Cover migration and scaffold flows in integration tests.
  10. eb93777a
    Apply generated search column rebuilds atomically and verify convergence.
  11. 46d0f41f
    Reuse a managed database slot after its upstream connection closes.
  12. 5bdb0cf2
    Document Ptah setup and migration behavior.

Verification

On 5bdb0cf2, typecheck, 149 upgrade and doctor tests, and 14 managed
PGlite integration tests passed. The full checks below ran with the
published @stokaro/[email protected] on the identical source tree.

  • Frozen install, monorepo build, 52 static checks, 14 post-build checks,
    and packed-package validation.
  • Workspace unit suites and 5,480 PostgreSQL driver unit tests.
  • 1,324 PostgreSQL end-to-end tests, 89 CLI integration tests, and the CMS
    and BaaS template suites.
  • Contributor setup, client SDK, self-host and bundle acceptance, RLS
    checks, and 91 admin browser tests.

Checks ran across Linux and macOS, with focused reruns for runner failures.
The search-column regression verifies that widening its source column
creates one migration and an unchanged schema creates no further migration.

Closes #82.

@denisvmedia
denisvmedia marked this pull request as draft November 13, 2026 20:28
@denisvmedia
denisvmedia force-pushed the feat/ptah-native-migrations branch from 953ce07 to e182d57 Compare November 14, 2026 07:05
@denisvmedia denisvmedia changed the title Replace Atlas migration engine with Ptah Replace Atlas binary with Ptah compatibility mode Nov 14, 2026
@denisvmedia
denisvmedia force-pushed the feat/ptah-native-migrations branch from e182d57 to ac3365a Compare November 14, 2026 07:12
@denisvmedia denisvmedia changed the title Replace Atlas binary with Ptah compatibility mode Replace Atlas CE with Ptah Compat to plan the full Rebase schema Nov 15, 2026
@denisvmedia
denisvmedia force-pushed the feat/ptah-native-migrations branch from 177f473 to f835eaf Compare November 16, 2026 14:59
@denisvmedia
denisvmedia force-pushed the feat/ptah-native-migrations branch 6 times, most recently from 3740552 to b42d6ba Compare November 19, 2026 19:45
@denisvmedia
denisvmedia force-pushed the feat/ptah-native-migrations branch from b42d6ba to 5bdb0cf Compare November 19, 2026 23:05
@denisvmedia
denisvmedia marked this pull request as ready for review November 19, 2026 23:24
@fgatti675

Copy link
Copy Markdown
Member

Thank you for this, and for the amount of care that went into it. Planning policies, functions, search and vector indexes, triggers and views in one pass is a real problem, and the PR makes the case for it well.

I'm going to decline it, though. The planner under db generate and db push is a core dependency, and swapping it is not a change we want to take on right now, so we're staying on Atlas for the time being. Sorry it took a week to say so.

Closing this one and #86 together, since the docs depend on it. If you'd like to contribute in this area again, opening an issue first to agree on the direction would save you the work up front. Thanks again.

@fgatti675 fgatti675 closed this Nov 26, 2026
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.

Sidecar PostgreSQL objects are absent from one schema drift plan

2 participants