Skip to content

feat(postgres)!: split the marker into per-space signatures and per-database policies, in a schema named prisma - #31242

Open
wmadden-electric wants to merge 92 commits into
own-tables-contract-spacefrom
own-tables-signatures-config
Open

wmadden-electric wants to merge 92 commits into
own-tables-contract-spacefrom
own-tables-signatures-config

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

At a glance

Prisma's bookkeeping table marker is split in two, and Prisma's own schema is named prisma. A database a release candidate set up, before and after its first prisma db migrate with this release (hashes shortened):

prisma_contract.marker                                    # before
 space | core_hash | profile_hash | contract_json | canonical_version | invariants | updated_at | app_tag | meta
 app   | bc4424a6… | …            | NULL          | NULL              | {}         | 2026-11-27 | NULL    | {"policies": {"change": ["migrate"]}}

prisma.signatures                                         # after: one row per contract space
 space   | core_hash | profile_hash | invariants | signed_at
 _prisma | a09d7307… | …            | {}         | 2026-11-28
 app     | bc4424a6… | …            | {}         | 2026-11-27

prisma.config                                             # after: at most one row, for the whole database
 id   | policies
 true | {"change": ["migrate"]}

What the terms mean:

  • Prisma keeps four tables for itself in every PostgreSQL database it manages: the one shown here, ledger (one row per migration applied), and contract (the contracts those migrations moved between, read by Prisma Studio).
  • A contract space is one set of migrations: the application's, and one per extension. The row each has in this table is its signature: which contract the database was last brought to. db sign writes it, and every command reads it first.
  • The database's policies say whether it may be changed by db migrate, by db update or by both, and whether a change may lose data. They were in the meta column of the application's row.
  • The new _prisma row is the signature of a contract space for Prisma's own tables, which brings those tables up to date with migrations the PostgreSQL package carries (feat(postgres)!: Prisma's own tables move to schema _prisma and are brought up to date before every command that changes a database #31234). _prisma is a value in the space column, not a database object.
  • Gone: contract_json, canonical_version and app_tag (nothing read them; every writer wrote NULL) and meta (its only content, the policies, is in config). updated_at is now signed_at.

Breaking for a project on a release candidate that:

  • grants roles access to the old table: the application's role now needs SELECT on prisma.signatures, and a role that runs Prisma's commands also needs it on prisma.config;
  • reads marker in its own SQL, or built a view or function over it;
  • has a schema of its own named prisma.

Each is covered below. The PostgreSQL target package's exports change too.

The decisions

Three, all made before any release ships these tables:

  1. Split the table. A signature describes one contract space; a policy describes the whole database. With the policies on the application's row, every reader had to know that row held them, and a database with no application row had nowhere to keep them. So prisma.signatures has one row per space and prisma.config one row per database.
  2. Name it signatures. "Marker" says nothing to someone who finds the table in their database. "Signature" matches db sign, which writes the row. Error codes such as CONTRACT.MARKER_MISSING still say "marker"; renaming the concept everywhere a user sees it is a later change, also before 8.0.0.
  3. Name the schema prisma. feat(postgres)!: Prisma's own tables move to schema _prisma and are brought up to date before every command that changes a database #31234 renamed the release candidates' prisma_contract to _prisma. This change names it prisma instead, so every name Prisma puts in a database is prisma or prisma_<what it is>, on every database. On databases without schemas (SQLite, MySQL, MongoDB) the tables will be prisma_signatures, prisma_config and prisma_ledger when they move to this design. The tool's own name is how most tools name theirs (django_migrations, knex_migrations, Drizzle's schema drizzle).

Why now: within Prisma 8, Prisma's own tables may only gain columns and tables, never lose or rename them, so that a release can always read a database a later release of the same major has touched. And every release finds the _prisma row, and from it the form of Prisma's tables, in this table, through space, core_hash, profile_hash and invariants. After 8.0.0 the table could not be renamed, meta could not be dropped, and that row could not move. A test pins those four columns.

How it merges

This pull request is stacked on #31234, which makes Prisma's tables a contract space and renames their schema. The two must ship in the same release, and main must be releasable at any time, so neither may reach main alone. When approved, this one merges into #31234's branch, and #31234 then brings both into main, after #31203 (which changes how every contract hash is computed; Prisma's own contract hash must be final before a release records it). No release has shipped #31234's migration of Prisma's tables, so this change rewrites that migration in place.

How a database is upgraded

Prisma's own tables are created and changed by their own migrations, which every db init, db update, db migrate and db sign applies before it reads anything. On a release candidate's database the first of those migrations renames prisma_contract to prisma, copies each marker row into signatures, copies the application row's policies into config exactly as stored, and drops marker, in one transaction. A second command running at the same time finds the work done and skips it. Nothing is asked of the user.

A project's own schema named prisma

Prisma never shares its schema:

  • That first migration stops with MIGRATION.PRECHECK_FAILED, changing nothing, when prisma holds anything besides Prisma's own tables. The message names each object, read from the catalogue so a role's privileges cannot hide one. Once prisma.signatures exists with the four columns above, the schema counts as Prisma's, so a later release that adds columns or tables can still rerun the migration. If prisma exists but is empty, and the role running migrations may create objects in it, Prisma uses it.
  • A release candidate's prisma_contract is checked the same way before it is renamed. Its ledger and contract, which are kept, count as Prisma's whatever columns a project added to them; anything else is named. Its marker is copied and dropped, so a column a project added to it stops the command, which names the column and says to move that data first.
  • A contract may not place a PostgreSQL namespace in the schema prisma or prisma_contract: planning it and applying it are refused, with a message saying the name is reserved for Prisma's own tables. db sign and db verify do not check this; for either to accept such a contract, a project would already have put its own tables inside Prisma's schema by hand.

One case needs action from the user. PostgreSQL's default search path is "$user", public, so for a connection whose role is named prisma, the schema prisma becomes the current schema once it exists. Prisma's own SQL names its schemas and is not affected. Other tools and raw SQL run as that role, naming tables without a schema, would look in prisma first. Such a project sets the role's search path: ALTER ROLE prisma SET search_path = public.

Who reads and writes the policies

The commands that change them write them into prisma.config: db migrate --to <ref> --permit-policy-change and db update --to <ref> --permit-policy-change write the policies a ref (a named pointer file under migrations/) declares, in the same transaction as the run.

Every command that obeys them reads them, and so does the runner (the code that applies migrations), which checks under its lock that they did not change mid-run. That code is shared by every database and expects the policies on the application's signature, as meta.policies. This change leaves it alone: the PostgreSQL adapter reads prisma.config and hands the value over in that shape. The next slice of this project, which must also land before 8.0.0, gives the policies their own path through the shared code. Until then:

  • The message for unreadable policies still says to correct "meta.policies in the marker". It appears only when someone has written invalid JSON into the table by hand; the error reference names the column to correct.
  • A database with no application row in signatures reads as having the default policies, even if config records stricter ones. That happens only when someone deletes that row by hand, since every write of config also writes it.

A policy read never falls back to the defaults on an error: a role that may not read config, or that row-level security on config applies to, gets CONTRACT.MARKER_READ_FAILED naming prisma.config.

What a user changes

  • Nothing, for a project that never touches these tables and runs as roles with full access to them.
  • The application's role needs GRANT SELECT ON prisma.signatures TO <role>;. On first use the client checks that the database's signature matches the contract the application carries, and logs a warning if not. It reads only signatures. A grant on the old prisma_contract.marker does not carry over, because that table is dropped; without the new grant the client logs CONTRACT.MARKER_MISSING once (the code's name is a leftover) and its queries still run.
  • A role that runs Prisma's commands (db verify, migration status, and every command that changes the database) also needs SELECT on prisma.config, because those commands read every signature and the policies in one read. This is new; the next slice lets the commands that do not use the policies skip them.
  • Its own SQL that reads marker reads prisma.signatures, or prisma.config for the policies.
  • A view, function or other object over prisma_contract.marker (including one that uses the table's row type, such as a function taking marker[]) stops the upgrading command before anything changes. The message names each object with its schema, for example view public.marker_view.
  • Row-level security turned on for the old marker would let the copy read fewer rows than exist, so the upgrading command stops first and gives the statement that lifts it.

The upgrade instructions an agent follows are in upgrade-instructions/pending/prisma-tables-in-prisma-schema/ (the whole upgrade, for applications and extension authors) and upgrade-instructions/pending/prisma-signatures-and-config/ (a project's code and docs that name the marker table). Prisma Studio reads only ledger and contract; prisma/studio#1615 makes it read them from prisma, and must be released before the ORM release.

Also in this change

  • A stored migration's steps can carry data the runner acts on. Three new fields, tableDependents, schemaHoldsOnly and tableHoldsOnlyColumns, are declared to the reader of stored migrations; each holds only data (a schema, a table, the tables a schema or the columns a table may hold), and the runner owns the catalogue queries that use it. The rule for stored files is that a reader acting on a new field raises the format version; format 1 is not final until 8.0.0, so these fields are part of it.
  • turbo.json: test/utils.ts is a build input. Two packages compile it into dist, and a change to it alone restored a cached, stale build.
  • Decision records: the one on names (ADR 338) is rewritten for prisma; those on the marker's storage (ADR 021), the policies (ADR 320), contract spaces (ADR 212) and Prisma's own tables (ADR 339) are corrected in place; ADR 042, which evolved the marker through a version field, is marked superseded.

API changes

All in @prisma/orm-target-postgres, used by the PostgreSQL adapter and runner, which are separate packages, so these must be exported:

  • PRISMA_TABLES_SCHEMA is "prisma".
  • PRISMA_TABLE_NAMES lists signatures and config in place of marker.
  • prismaTablesMissingSummary takes the tables that are missing, so the runner's message names them.
  • qualifiedPrismaTable also accepts RELEASE_CANDIDATE_MARKER_TABLE (new), the release candidate's marker, which the adapter probes for.
  • prismaTableLocation (new) gives a table's qualified name for messages.
  • RECORD_DATABASE_POLICIES_SQL (new) is the statement the adapter and the runner both use to write config.
  • PostgresControlAdapter.readSignatureDiscriminated (new) is the client's first-use read, of signatures alone.

The next slice removes RECORD_DATABASE_POLICIES_SQL and RELEASE_CANDIDATE_MARKER_TABLE when the policies get a single writer, as a recorded break.

How it was checked

Many integration test files were changed only for the new names and not run locally; pull request CI skips integration tests, so they first run when #31234 enters the merge queue. Everything below was run:

  • Reviews by separate system-design and code reviewers over several rounds, each followed by a confirming review of the fixes.
  • Manual QA against PostgreSQL 17 and the published 8.0.0-rc.25, twelve scenarios, including: a new database; a release candidate's database with policies, an extension's row and a view over the marker, upgraded by this branch's command-line tool; read-only commands before the upgrade; a role that does not own the old schema; a refused db update; a project's own prisma schema on a new database; a contract that declares namespace prisma.
  • Integration tests against a real PostgreSQL database for the move, the collision checks, a later release's form of the tables, the policies under the runner's lock, a policy change read back and enforced, a role that may read only signatures, and the upgrade journey through the commands.

Alternatives considered

  • Keep one table, with the policies on the application row. Rejected: every reader must know which row holds them, and a database with no application row has nowhere to keep them; after 8.0.0 it could not be changed.
  • Keep the name marker and only add config. Rejected: the name is fixed from here on, and it tells a reader nothing.
  • Keep the schema name prisma_contract. Rejected: it names one table's purpose, not the tool, and it would be the one name outside the rule every other database follows.
  • Name the schema _prisma, as feat(postgres)!: Prisma's own tables move to schema _prisma and are brought up to date before every command that changes a database #31234 did. Rejected: the tool's name already says whose the objects are, the underscore only says "private" about tables users are told to read, and a collision with a project's own prisma stops safely. Its one real gain is the search-path case above, which a project fixes with one statement.
  • A key-value config table, one row per setting. Rejected: the policies already have one stored form, the JSON a ref declares; a single row keeps it.
  • Change the shared code now to read the policies from their own table. Deferred to the next slice, which is designed first, because it changes interfaces every database's support implements.
  • Add a second migration of Prisma's tables instead of rewriting the first. Not needed: no release has shipped the first.

Agent: laozi-26

🤖 Generated with Claude Code

wmadden-electric and others added 30 commits November 28, 2026 09:00
…tures and configuration

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…es signatures and config, and moves a release candidate's marker into them

The space's contract now describes _prisma.signatures (one row per space, without the columns nothing reads), _prisma.config (one row for the database, keyed by a boolean that a check holds true) and the unchanged ledger and contract. The first migration is rewritten in place, since no release has recorded it: after renaming prisma_contract it checks the release candidates' marker, then moves its rows into signatures, the application row's policies into config, and drops it, in one step that is skipped once the marker is gone.

The space's contract lists the two capabilities its tables use, since a config built without the PostgreSQL defineConfig gets no default list.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ger and contract, and a run that changes only the policies writes config

The runner's check for Prisma's own tables now names each table that is missing, not only the marker. A run whose only change is the database's policies records them as the one row of _prisma.config and writes no signature, so signed_at says when a space was last signed. The statement that records the policies is one constant beside the table names, which the adapter uses too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…_prisma.signatures, and the policies are written to _prisma.config

The control adapter reads and writes each space's row in _prisma.signatures, whose signed_at it reads as the record's updatedAt, and names that table in its marker location, so a corrupt row names it. Given policies, initMarker and updateMarker record them as the one row of _prisma.config in the same transaction, updateMarker only once the signature has moved. Reading the policies back is not part of this change.

The tests read the new tables. Two runner tests of the policies held under the lock read _prisma.config and fail until the commands read the policies from it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…natures and _prisma.config

The tests that read or write the application's signature now name _prisma.signatures, seed and create it without the columns it dropped, and the upgrade journey checks that a release candidate's rows and policies are moved. The journey's check that a migrate-only release candidate database refuses db update fails until the commands read the policies from _prisma.config.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…a.config on PostgreSQL; ADR 042 is superseded by ADR 339

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…into dist

The SQL runtime and the emitter publish test/utils.ts as a built entry point. It was not among the build inputs, so a change to it alone restored the cached dist, and integration tests ran the old helpers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…olicies; a new slice gives them a channel of their own

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…the release candidates shipped

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…icies of _prisma.config as meta.policies

The commands read the policies from the application space's record, and the signatures row has no meta, so every PostgreSQL database read as having the default policies. Each read of signatures now joins config in the same statement, so the signature and the policies come from one state. The stored value is passed on unparsed, for the framework's parser and its corrupt-policies error. Other spaces never carry policies.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… initMarker writes to _prisma.config

The test expected the application space's record to carry no policies, which is the defect the previous commit fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ignatures and _prisma.config, not _prisma.marker

The instructions say the first command moves the marker rows into signatures and the policies into config, that grants on the marker are dropped with it and the application role needs SELECT on both new tables, and that Prisma Studio 0.36.0 reads _prisma.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…policies are in _prisma.config

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…_prisma.config on PostgreSQL

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…onfig move

Name the two warnings a client without SELECT on the new tables logs, say that keys other than policies in meta are not moved, that the move also drops marker, which needs ownership, and which releases recorded policies.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…gnatures finds no marker

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ramework, and what a missing application row means for them; slice 3 lands before 8.0.0

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… and the Prisma space row is read through its four fixed columns

The SQL client check on first use compares hashes, so it now reads the
signature without _prisma.config, and a role needs SELECT on
_prisma.signatures only.

The Prisma space own row is read through space, core_hash, profile_hash
and invariants and nothing else, by the phase and by readAllMarkers, so a
later release may drop signed_at or reshape _prisma.config without an 8.x
release failing to recognise the row. The control commands read the
policies only when _prisma.config has its policies column; a database
without it reads as recording no policies. The policies stay in the same
statement as the signature, so both come from one state.

Policies stored as JSON null are handed to the framework as null, as a
release candidate marker handed them, so they are still reported as
unreadable instead of reading as the defaults.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… Prisma space contract

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… of the marker table, and stops naming the objects that depend on it

The ownership check of prisma_contract.marker now gives the real reason:
this migration drops the table, and dropping a table needs the owner
privileges. The ledger and contract tables keep their reason.

A view, function or other object that depends on prisma_contract.marker
made DROP TABLE fail after the rename, with a message about
_prisma.marker, a table that no longer exists once the transaction rolls
back. A precheck on the rename now stops first. A step whose meta names
tableDependents makes the runner list the dependent objects from
pg_depend, in the words PostgreSQL uses, and the check says to drop them
and create them again over _prisma.signatures.

The migration hash changes; ops.json and migration.json are re-emitted.
The head ref and snapshot hold the contract hash, which is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…greSQL marker location

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…config moved after they were checked

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…e land in _prisma.config and refuse a later db update

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…sma.signatures alone, and the move stops when another object depends on marker

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ated

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…to read the policies instead of reading the defaults

Whether _prisma.config and its policies column exist was read from
information_schema.columns, which lists only the columns the role may
use. A role without SELECT on config therefore read no policies and got
the defaults, so a database that permits only migrate accepted db update
from it. The columns now come from pg_attribute, which lists them
whatever the role may do, so the read that follows selects policies and
PostgreSQL refuses it, reported as CONTRACT.MARKER_READ_FAILED. The
column check of the Prisma space row reads the catalogue the same way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Conflicts kept both sides: the CLI options take the Prisma space listener and the unrecorded-snapshot listener, and db update reports both the Prisma space and an unreadable origin snapshot. api-breaks.json records from both sides are kept, their reasons joined and fingerprints taken from the merged api.txt.

main moved APP_UPGRADE_GUIDES_URL to @internal/utils/upgrade-guides, so the CLI imports it from there and @internal/errors/control no longer re-exports it. contractSpaceFromJson now takes the space id, and assertDescriptorSelfConsistency the bundled contract.json.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… version 1

The contract and the migration are re-emitted, and the head ref and the snapshot rewritten by the format-version upgrade script. No hash changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric and others added 6 commits November 29, 2026 11:31
…ma's tables and checks prisma_contract before the rename

The check that schema prisma holds only Prisma's tables takes the schema as Prisma's when its signatures table has the columns every 8.x release reads, so a rerun against a later release's tables passes. The rename first checks that prisma_contract holds only the release candidates' tables. A step names what a schema may hold as data (meta.schemaHoldsOnly), and the runner owns the query that lists the other objects. An empty prisma needs USAGE and CREATE on it, not its ownership.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…e in location

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… points to no upgrade instructions

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…age a project's own prisma gives

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…sma, and how the first migration stays rerunnable

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric wmadden-electric changed the title feat(postgres)!: split Prisma's marker table into _prisma.signatures and _prisma.config feat(postgres)!: split the marker into per-space signatures and per-database policies, in a schema named prisma Nov 29, 2026
wmadden-electric and others added 7 commits November 29, 2026 11:45
… the migrating role needs, and that the refusal is by schema

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ithout the columns Prisma reads, and an empty prisma is adopted without CREATE on the database

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ls its extension

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
… the release candidates' tables whatever columns a project added

The check named a release candidate's ledger, contract or marker with an added column as an object Prisma did not create, and advised moving or dropping it, which would lose Prisma's records. It now accepts those three tables by name, with their sequences, indexes and constraints, and leaves their form to the checks of their columns, which accept extra columns. The upgrade instructions say never to drop them to get past the check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ink only when it can fail on a new database

The check that schema prisma is Prisma's can fail on a new database, where no upgrade instructions apply. The checks of the operation that brings a release candidate's database up to date (what prisma_contract holds, and what depends on its marker) fail only during an upgrade, so they lead with the objects they found and keep the link to the upgrade instructions. The branch is chosen by the failed check's operation id, which the failure carries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…ma schema yet

Studio 0.36.0 reads _prisma, which no release of Prisma uses. The release that reads prisma is the one after prisma/studio#1615 merges; until then the Migrations view is empty on an upgraded database.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…e upgrade instructions

Shared CLI code must not name a PostgreSQL operation id, so the branch on the failed check's operation id is gone. A check that names objects still leads with them; every check keeps the link to the upgrade instructions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric marked this pull request as ready for review November 29, 2026 01:14
wmadden-electric added a commit that referenced this pull request Nov 29, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric added a commit that referenced this pull request Nov 29, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric marked this pull request as draft November 29, 2026 01:22
wmadden-electric added a commit that referenced this pull request Nov 29, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric added a commit that referenced this pull request Nov 29, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
…en a project added a column to the release candidates' marker

The migration copies the rows of prisma_contract.marker into signatures and config, which keep only some of its columns, and then drops it. Since the rename's check accepts the release candidates' tables in any form, a column a project added to marker, and its data, were lost without a message.

The rename now checks first that marker has no columns but the release candidates'. The runner names each other column, and the check's description says to copy its data elsewhere and drop it, with the statements. ledger and contract are still kept with any column a project added. The check's description, the error reference and the app upgrade instructions no longer say all three tables are kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric marked this pull request as ready for review November 29, 2026 01:33
wmadden-electric added a commit that referenced this pull request Nov 29, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
wmadden-electric added a commit that referenced this pull request Nov 29, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric marked this pull request as draft November 29, 2026 01:38
…umns ends by saying it found such columns

The CLI appends "In this database, those objects are ..." to the description of a check that names objects. The description of the check on prisma_contract.marker's columns ended with "then run the command again.", so that sentence referred to nothing. It now ends "This command found such columns there.", as the other object-naming checks do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric marked this pull request as ready for review November 29, 2026 01:44
wmadden-electric and others added 3 commits November 29, 2026 15:10
…nto own-tables-signatures-config

Prisma's own contract and its first migration are re-emitted under the
new hash rules: storage hash a09d7307, migration hash 1937b046.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>

This branch has not been deployed

No deployments
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