feat(migrations): Unify schema and data journals#896
Draft
dcramer wants to merge 8 commits into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Add a publishable migration package that executes SQL and TypeScript entries from one Drizzle-compatible journal. Route core and plugin upgrades through the shared runner so schema changes and resumable data migrations use one ordered ledger. Keep historical scripts isolated behind versioned capabilities, and wire the package into release, CI, Craft, documentation, and package validation. Co-Authored-By: GPT-5 Codex <noreply@openai.com>
Remove the migration task registry and keep historical data migration code in each journal entry. This prevents future runtime refactors or deletions from breaking pending upgrades. Expose versioned migration capabilities, move scheduler and core backfills into their migration files, and update migration tests and documentation. Co-Authored-By: GPT-5.6 Codex <noreply@openai.com>
Expose the exact host database adapter through MigrationContextV1 instead of reconstructing a partial SQL capability. Rebuild the SQL-heavy frozen migrations without connection setup and driver implementations so migrations retain transformation logic without duplicating database infrastructure. Co-Authored-By: GPT-5.6 Codex <noreply@openai.com>
Allow migrations to import append-only infrastructure helpers from @sentry/junior/migration-helpers/v1 while continuing to reject unversioned Junior runtime imports. Keep one-off Redis transformations and backfill decisions in their journal entries, replace generated capsules for migrations 0004 through 0006 with readable source, and publish explicit helper types without private module references. Co-Authored-By: GPT-5.6 Codex <noreply@openai.com>
Rebase the mixed journal onto the latest schema, move the new conversation usage repair into the journal, and preserve its focused tests. Remove unchanged Drizzle snapshots for data entries, rebuild the legacy history migration around versioned infrastructure helpers, and reject runtime re-export bypasses. Co-Authored-By: GPT-5.6 Codex <noreply@openai.com>
dcramer
force-pushed
the
codex/unified-migration-journals
branch
from
July 16, 2026 19:09
fd37ff2 to
e763a82
Compare
Freeze complete scheduler migration schemas, repair malformed existing scheduler rows, and add focused regression coverage. Harden migration path and JSON boundaries, narrow the runner-only locking interface, remove dead helper surface, deduplicate state projection, and preserve original migration errors. Co-Authored-By: GPT-5.6 Codex <noreply@openai.com>
Require explicit schema-bootstrap execution, scope plugin migration state by default while preserving historical plugin keys, and document permanent helper-version compatibility. Add real PostgreSQL progress, resume, and lock serialization contracts plus host-wiring isolation coverage. Co-Authored-By: GPT-5.6 Codex <noreply@openai.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 360518a. Configure here.
Pass the real core state adapter into TypeScript migrations so Redis-native index and lock detection continues to work. Add multiline import guard coverage and remove the stale generated temp-path comment from the history migration. Co-Authored-By: GPT-5.6 Codex <noreply@openai.com>
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
@sentry/junior-migrationspackage for mixed SQL and TypeScript Drizzle journals0001_name.tsdata migrations through the same Drizzle Kit numbering workflow used for schema migrationscontext.database@sentry/junior/migration-helpers/v1main, into the journalmigrationTasks,context.tasks, duplicate host migration implementations, and unchanged Drizzle snapshots for data-only entriesMigration contract
Each journal entry resolves to exactly one immutable
<tag>.sqlor<tag>.tsfile. TypeScript entries targetMigrationV1, receive the host database/state adapters, and own their one-off record transformations. They may import only external packages and the versioned@sentry/junior/migration-helpers/v1infrastructure surface; unversioned Junior runtime imports, relative imports, dynamic imports, and runtime re-exports are rejected.Drizzle Kit still owns schema snapshots and journal numbering. The data-migration generator removes the unchanged custom snapshot after creating a TypeScript entry; a verified follow-up schema generation continues from the latest real schema snapshot and preserves journal order.
Existing installations adopt their legacy core/plugin migration ledgers once, then all pending SQL and TypeScript entries execute through
runMigrationJournal. TypeScript progress and results are persisted in the Drizzle ledger and failed entries resume with the same source hash.Adversarial cleanup
After rebasing onto current
main, the PR initially measured 7,447 additions. The dominant bloat was a 3,575-line whole-app bundle for legacy history plus 1,292 lines of unchanged custom snapshots. The final diff is 3,889 additions: the history migration is now 1,128 lines of conversion/storage code, data snapshots are removed, and main's usage repair is journaled rather than left as a separate upgrade path.Test Plan
pnpm --filter @sentry/junior-migrations typecheckpnpm --filter @sentry/junior typecheckpnpm --filter @sentry/junior-migrations test— 9 testspnpm lintpnpm release:checkpnpm docs:checkgit diff --checkGarfield adversarial review
Three review cycles addressed strict historical scheduler decoding, malformed existing-row repair, safe migration paths, symlink rejection, final source hash verification, finite JSON progress/result validation, original error preservation, runner-only lock capabilities, dead helper APIs, shared state projection, package version alignment, and stale docs. Independent verification confirmed the validated fixes are committed in this PR.
Final framework guarantees
migration-helpers/v1is a permanent compatibility path; breaking helper changes require a new versioned path, and shipped migration source hashes remain immutable.junior:<plugin>:keys remain available for legacy conversion.mode: "schema-bootstrap"orbootstrapPluginSchemas) and cannot be selected by omission.