Repository navigation
feat(sql-family)!: MySQL, MariaDB and SQLite contracts list capabilities - #31360
wmadden-electric wants to merge 39 commits into
Conversation
…rt from required ones, as PostgreSQL does Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…pabilities The control stack, enrichContract, the SQL family's buildContract and requiredCapabilitiesOf no longer add a target's or adapter's capabilities to a contract, and the contract's type no longer does either. Control descriptors, pack refs, runtime target descriptors and ContractSourceContext lose their capabilities member; runtime adapter and driver descriptors keep it for the client's connection check. CapabilityContributor and unionCapabilityKeys are removed. PostgreSQL's release-candidate default for a ready source given no list now rebuilds the source with the default list. CapabilitiesByVersion moves to the SQL family, which gains parseDatabaseVersion, a shared version comparison (PostgreSQL keeps thin wrappers), SqlSchemaIR.databaseVersion, requiredCapabilitiesFor with an optional fix, and the shared init entry nodes. sqlContextInput takes the required list explicitly. MySQL, MariaDB and SQLite pass their adapter's list as the author's list for now, so their contracts do not change yet. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…cks and driver lists written; facades, init, client types, re-emit and tests not done Not compiled or tested. See wip/mozart/impl-notes.md, section "Phase 2 status at handover". Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
… research maps and implementer notes of the slice in progress Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…apabilities The facades export each database's version list and driver list, defineContract and the config's contract entry require the list and refuse a missing one with the line to write, introspection reads the database's version, init writes the list, and the client factories check the driver's connection capabilities at compile time. Prisma's own SQLite tables require nothing. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…nd pin the version tables and driver lists Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…eading on MySQL, MariaDB and SQLite; re-emit their contracts Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
… driver Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…se 2 in the implementation notes Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…ver sets it per connection Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
… capability keys Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
… its oldest supported version Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…at list their required capabilities Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…ersion are refused by db migrate and db sign Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…d MySQL and MariaDB signing is tested against each table Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…wn refusal; emit tests leave out a provided key; MariadbContractEntry is exported Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…n notes Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…and SQLite Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…and SQLite Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…and SQLite Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…and SQLite Restructure the app upgrade guide into five steps, fix the facts the review found in the extension guide and the skill, and apply three system-design review fixes: drop the ADR 335 sentence about patch-release functions, give the runtime adapter's capabilities doc comment no example, and record the always-empty adapter capabilities member as deferred. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…d SQLite Build the contracts in the capability tests with defineContract, refuse .mts, .cts and .tsx contract paths on SQLite as on MySQL, check that contract source contexts and driver pack refs carry no capabilities, and add the control case to each client check. Move the config refusals into the SQL family beside the contract entry nodes, have PostgreSQL use the shared runner check and refusal, test that refusals and init write the same requiredCapabilities line, rename the schema tree's version field to databaseVersionText, and name the adapter's contract contributions AdapterContractContributions. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…figValue The SQL family entry point contract-entry-nodes is now contract-entry, in the internal and published packages. The helper that describes a bad config value is exported once from the SQL contract package. The insert conflict-skip doc comment names the capability pairs it needs. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…and SQLite Corrects the claim that transactions are checked on these databases, the conflict-skip pairs, the prepared read methods and the MariaDB include note. The extension guide tells authors to list only what an extension uses, or [], and detects descriptors that still declare capabilities. Records the transaction check and the PostgreSQL packs as deferred work. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…and SQLite Corrects what signing an extension space again does, which calls take a conflict option, which contract a plain db migrate signs with, and the detection pattern for SqlControl descriptors. The extension guide leads with listing only what an extension uses and says which list governs its queries. The app guide says the new lists match what the adapters used to add. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…and SQLite The extension guide gives one test for which keys an extension lists, with a table of what fails without each key. Both guides and the skill cover extensions emitted by an earlier release, which signing refuses for keys this release removed. Smaller fixes to the ProxySQL cases, the snapshot folder, change policy and refs, and the sign hand-off. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…bles Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
…and SQLite Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
|
Important Review skippedToo many files! This PR contains 531 files, which is 231 over the limit of 300. To get a review, reduce the PR to 300 files or fewer by splitting it into smaller PRs or changing its base branch. Usage-priced reviews support at most 500 files.
|
…-provided-apart Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> # Conflicts: # packages/9-public/@prisma/orm-family-sql/api-breaks.json # packages/9-public/@prisma/orm-family-sql/api.txt # packages/9-public/@prisma/orm-framework/api-breaks.json # packages/9-public/@prisma/orm-postgres/api-breaks.json
Public API changesThis pull request changes the ## API changes
- `examples/prisma-8-demo-mariadb`:
- `examples/prisma-8-demo-mysql`:
- `examples/prisma-8-demo-sqlite`:
- `@prisma/orm-family-mongo`:
- `@prisma/orm-family-sql`:
- `@prisma/orm-family-sql (not exported): DerivedCapabilities`:
- `@prisma/orm-family-sql (not exported): ExtractPackCapabilities`:
- `@prisma/orm-family-sql/contract-psl/provider: RebuildWithRequiredCapabilities`:
- `@prisma/orm-family-sql/contract-psl/provider: isSourceGivenNoCapabilities`:
- `@prisma/orm-family-sql/contract-psl/provider: rebuildOfSourceGivenNoCapabilities`:
- `@prisma/orm-family-sql/contract-ts/contract-builder: AdapterContractContributions`:
- `@prisma/orm-family-sql/contract-ts/contract-builder: CapabilityContributor`:
- `@prisma/orm-family-sql/contract-ts/contract-builder: ContractInput`:
- `@prisma/orm-family-sql/contract/capability-providers: CapabilitiesByVersion`:
- `@prisma/orm-family-sql/contract/required-capabilities: RequiredCapabilitiesFix`:
- `@prisma/orm-family-sql/contract/required-capabilities: describeConfigValue`:
- `@prisma/orm-family-sql/contract/required-capabilities: requiredCapabilitiesFix`:
- `@prisma/orm-family-sql/contract/required-capabilities: requiredCapabilitiesFor`:
- `@prisma/orm-family-sql/contract: CapabilitiesByVersion`:
- `@prisma/orm-family-sql/contract: RequiredCapabilitiesFix`:
- `@prisma/orm-family-sql/contract: describeConfigValue`:
- `@prisma/orm-family-sql/contract: requiredCapabilitiesFix`:
- `@prisma/orm-family-sql/contract: requiredCapabilitiesFor`:
- `@prisma/orm-family-sql/family/contract-entry: CapabilityListModuleExports`:
- `@prisma/orm-family-sql/family/contract-entry: PrismaSchemaContractEntry`:
- `@prisma/orm-family-sql/family/contract-entry: RequiredCapabilitiesList`:
- `@prisma/orm-family-sql/family/contract-entry: TypeScriptContractEntry`:
- `@prisma/orm-family-sql/family/contract-entry: contractNeitherPathNorEntry`:
- `@prisma/orm-family-sql/family/contract-entry: exportOf`:
- `@prisma/orm-family-sql/family/contract-entry: isOtherTypescriptExtension`:
- `@prisma/orm-family-sql/family/contract-entry: prismaSchemaPathWithoutCapabilities`:
- `@prisma/orm-family-sql/family/contract-entry: typescriptContractEntryWithCapabilities`:
- `@prisma/orm-family-sql/family/contract-entry: typescriptContractNotTs`:
- `@prisma/orm-family-sql/family/control: ParsedDatabaseVersion`:
- `@prisma/orm-family-sql/family/control: checkSpacesDatabaseCapabilities`:
- `@prisma/orm-family-sql/family/control: databaseCapabilitiesNotProvidedByVersion`:
- `@prisma/orm-family-sql/family/control: parseDatabaseVersion`:
- `@prisma/orm-family-sql/schema-ir/types: SqlSchemaIR`:
- `@prisma/orm-family-sql/schema-ir/types: SqlSchemaIRInput`:
- `@prisma/orm-framework`:
- `@prisma/orm-framework/components/components: ComponentMetadata`:
- `@prisma/orm-framework/components/components: ExtensionDescriptor`:
- `@prisma/orm-framework/components/components: ExtensionPackRef`:
- `@prisma/orm-framework/components/components: unionCapabilityKeys`:
- `@prisma/orm-framework/components/control: ControlStack`:
- `@prisma/orm-framework/components/execution: RuntimeAdapterDescriptor`:
- `@prisma/orm-framework/components/execution: RuntimeDriverDescriptor`:
- `@prisma/orm-framework/components: ComponentMetadata`:
- `@prisma/orm-framework/components: ControlStack`:
- `@prisma/orm-framework/components: ExtensionDescriptor`:
- `@prisma/orm-framework/components: ExtensionPackRef`:
- `@prisma/orm-framework/components: RuntimeAdapterDescriptor`:
- `@prisma/orm-framework/components: RuntimeDriverDescriptor`:
- `@prisma/orm-framework/components: unionCapabilityKeys`:
- `@prisma/orm-framework/config/config-types: ContractSourceContext`:
- `@prisma/orm-framework/config: ContractSourceContext`:
- `@prisma/orm-mariadb`:
- `@prisma/orm-mariadb/config: MariadbConfigOptions`:
- `@prisma/orm-mariadb/config: MariadbContractEntry`:
- `@prisma/orm-mariadb/config: RequiredCapabilities`:
- `@prisma/orm-mariadb/config: defineConfig`:
- `@prisma/orm-mariadb/config: mariadb10_11`:
- `@prisma/orm-mariadb/config: mariadbDriver`:
- `@prisma/orm-mariadb/contract-builder: RequiredCapabilities`:
- `@prisma/orm-mariadb/contract-builder: mariadb10_11`:
- `@prisma/orm-mariadb/contract-builder: mariadbDriver`:
- `@prisma/orm-mariadb/runtime: default`:
- `@prisma/orm-mongo`:
- `@prisma/orm-mysql`:
- `@prisma/orm-mysql (not exported): MysqlBaseScaffold`:
- `@prisma/orm-mysql (not exported): MysqlClientDriverDescriptor`:
- `@prisma/orm-mysql (not exported): MysqlDefinition`:
- `@prisma/orm-mysql (not exported): MysqlResult`:
- `@prisma/orm-mysql (not exported): MysqlScaffold`:
- `@prisma/orm-mysql (not exported): ProvidingDescriptor`:
- `@prisma/orm-mysql/config: MysqlConfigComponents`:
- `@prisma/orm-mysql/config: MysqlConfigOptions`:
- `@prisma/orm-mysql/config: MysqlContractEntry`:
- `@prisma/orm-mysql/config: MysqlDefineConfig`:
- `@prisma/orm-mysql/config: RequiredCapabilities`:
- `@prisma/orm-mysql/config: createMysqlDefineConfig`:
- `@prisma/orm-mysql/config: defineConfig`:
- `@prisma/orm-mysql/config: mysql8_4`:
- `@prisma/orm-mysql/config: mysqlDriver`:
- `@prisma/orm-mysql/contract-builder: RequiredCapabilities`:
- `@prisma/orm-mysql/contract-builder: mysql8_4`:
- `@prisma/orm-mysql/contract-builder: mysqlDriver`:
- `@prisma/orm-mysql/define-contract: MysqlDefineContract`:
- `@prisma/orm-mysql/define-contract: MysqlDefineContractOptions`:
- `@prisma/orm-mysql/define-contract: createMysqlDefineContract`:
- `@prisma/orm-mysql/runtime: MysqlClientComponents`:
- `@prisma/orm-mysql/runtime: MysqlClientFactory`:
- `@prisma/orm-mysql/runtime: createMysqlClient`:
- `@prisma/orm-mysql/runtime: default`:
- `@prisma/orm-postgres`:
- `@prisma/orm-sqlite`:
- `@prisma/orm-sqlite (not exported): SqliteBaseScaffold`:
- `@prisma/orm-sqlite (not exported): SqliteDefinition`:
- `@prisma/orm-sqlite (not exported): SqliteResult`:
- `@prisma/orm-sqlite (not exported): SqliteScaffold`:
- `@prisma/orm-sqlite (not exported): SqliteStackProvides`:
- `@prisma/orm-sqlite/config: RequiredCapabilities`:
- `@prisma/orm-sqlite/config: SqliteConfigOptions`:
- `@prisma/orm-sqlite/config: SqliteContractEntry`:
- `@prisma/orm-sqlite/config: defineConfig`:
- `@prisma/orm-sqlite/config: sqlite3_38`:
- `@prisma/orm-sqlite/config: sqliteDriver`:
- `@prisma/orm-sqlite/contract-builder: RequiredCapabilities`:
- `@prisma/orm-sqlite/contract-builder: defineContract`:
- `@prisma/orm-sqlite/contract-builder: sqlite3_38`:
- `@prisma/orm-sqlite/contract-builder: sqliteDriver`:
- `@prisma/orm-sqlite/runtime: default`:
- `@prisma/orm-target-mariadb`:
- `@prisma/orm-target-mariadb/adapter/adapter: mariadbAdapterCapabilities`:
- `@prisma/orm-target-mariadb/adapter/adapter: mariadbAdapterContractContributions`:
- `@prisma/orm-target-mariadb/adapter/adapter: mariadbAdapterDescriptorMeta`:
- `@prisma/orm-target-mariadb/adapter: mariadbAdapterCapabilities`:
- `@prisma/orm-target-mariadb/adapter: mariadbAdapterContractContributions`:
- `@prisma/orm-target-mariadb/adapter: mariadbAdapterDescriptorMeta`:
- `@prisma/orm-target-mariadb/driver/runtime: default`:
- `@prisma/orm-target-mariadb/target/server-version-range: MARIADB_MIN_SERVER_VERSION`:
- `@prisma/orm-target-mariadb/target/server-version-range: MARIADB_NEWEST_VERSION`:
- `@prisma/orm-target-mariadb/target/server-version-range: MariadbVersion`:
- `@prisma/orm-target-mariadb/target/server-version: mariadbCapabilitiesByVersion`:
- `@prisma/orm-target-mariadb/target: MARIADB_MIN_SERVER_VERSION`:
- `@prisma/orm-target-mariadb/target: MARIADB_NEWEST_VERSION`:
- `@prisma/orm-target-mariadb/target: MariadbVersion`:
- `@prisma/orm-target-mariadb/target: mariadbCapabilitiesByVersion`:
- `@prisma/orm-target-mongo`:
- `@prisma/orm-target-mongo (not exported): mongoTargetDescriptorMetaBase`:
- `@prisma/orm-target-mongo/target/pack: MongoTargetPack`:
- `@prisma/orm-target-mongo/target: MongoTargetPack`:
- `@prisma/orm-target-mysql`:
- `@prisma/orm-target-mysql (not exported): ControlTargetKeysMysqlBuilds`:
- `@prisma/orm-target-mysql (not exported): mysqlAdapterCapabilities`:
- `@prisma/orm-target-mysql (not exported): mysqlTargetDescriptorMetaBase`:
- `@prisma/orm-target-mysql (not exported): mysqlTargetDescriptorMetaRuntimeBase`:
- `@prisma/orm-target-mysql/adapter/adapter: mysqlAdapterCapabilities`:
- `@prisma/orm-target-mysql/adapter/adapter: mysqlAdapterContractContributions`:
- `@prisma/orm-target-mysql/adapter/adapter: mysqlAdapterDescriptorMeta`:
- `@prisma/orm-target-mysql/adapter/control: MysqlCatalogRows`:
- `@prisma/orm-target-mysql/adapter/runtime: MysqlRuntimeAdapterDescriptor`:
- `@prisma/orm-target-mysql/adapter/runtime: MysqlRuntimeAdapterOptions`:
- `@prisma/orm-target-mysql/adapter: MysqlCatalogRows`:
- `@prisma/orm-target-mysql/adapter: MysqlRuntimeAdapterDescriptor`:
- `@prisma/orm-target-mysql/adapter: MysqlRuntimeAdapterOptions`:
- `@prisma/orm-target-mysql/adapter: mysqlAdapterCapabilities`:
- `@prisma/orm-target-mysql/adapter: mysqlAdapterContractContributions`:
- `@prisma/orm-target-mysql/adapter: mysqlAdapterDescriptorMeta`:
- `@prisma/orm-target-mysql/driver/capabilities: mysqlDriverCapabilities`:
- `@prisma/orm-target-mysql/driver/runtime: MysqlRuntimeDriverDescriptor`:
- `@prisma/orm-target-mysql/driver/runtime: createMysqlRuntimeDriverDescriptor`:
- `@prisma/orm-target-mysql/driver/runtime: default`:
- `@prisma/orm-target-mysql/driver: MysqlRuntimeDriverDescriptor`:
- `@prisma/orm-target-mysql/driver: createMysqlRuntimeDriverDescriptor`:
- `@prisma/orm-target-mysql/driver: mysqlDriverCapabilities`:
- `@prisma/orm-target-mysql/target/control: MysqlControlTargetOptions`:
- `@prisma/orm-target-mysql/target/control: MysqlDatabaseVersions`:
- `@prisma/orm-target-mysql/target/control: mysqlDatabaseVersions`:
- `@prisma/orm-target-mysql/target/migration: createMysqlMigrationRunner`:
- `@prisma/orm-target-mysql/target/server-version-range: MYSQL_MIN_SERVER_VERSION`:
- `@prisma/orm-target-mysql/target/server-version-range: MYSQL_NEWEST_VERSION`:
- `@prisma/orm-target-mysql/target/server-version-range: MysqlVersion`:
- `@prisma/orm-target-mysql/target/server-version: MYSQL_VERSION_QUERY`:
- `@prisma/orm-target-mysql/target/server-version: mysqlCapabilitiesByVersion`:
- `@prisma/orm-target-mysql/target/server-version: readMysqlVersionText`:
- `@prisma/orm-target-mysql/target: MYSQL_MIN_SERVER_VERSION`:
- `@prisma/orm-target-mysql/target: MYSQL_NEWEST_VERSION`:
- `@prisma/orm-target-mysql/target: MYSQL_VERSION_QUERY`:
- `@prisma/orm-target-mysql/target: MysqlControlTargetOptions`:
- `@prisma/orm-target-mysql/target: MysqlDatabaseVersions`:
- `@prisma/orm-target-mysql/target: MysqlVersion`:
- `@prisma/orm-target-mysql/target: createMysqlMigrationRunner`:
- `@prisma/orm-target-mysql/target: mysqlCapabilitiesByVersion`:
- `@prisma/orm-target-mysql/target: mysqlDatabaseVersions`:
- `@prisma/orm-target-mysql/target: readMysqlVersionText`:
- `@prisma/orm-target-postgres`:
- `@prisma/orm-target-postgres (not exported): postgresTargetDescriptorMetaBase`:
- `@prisma/orm-target-postgres/target/prisma7-binding: prisma7PostgresBinding`:
- `@prisma/orm-target-sqlite`:
- `@prisma/orm-target-sqlite (not exported): sqliteAdapterCapabilities`:
- `@prisma/orm-target-sqlite (not exported): sqliteTargetDescriptorMetaBase`:
- `@prisma/orm-target-sqlite/adapter/adapter: sqliteAdapterCapabilities`:
- `@prisma/orm-target-sqlite/adapter/adapter: sqliteAdapterContractContributions`:
- `@prisma/orm-target-sqlite/adapter/runtime: default`:
- `@prisma/orm-target-sqlite/adapter: sqliteAdapterCapabilities`:
- `@prisma/orm-target-sqlite/adapter: sqliteAdapterContractContributions`:
- `@prisma/orm-target-sqlite/driver/capabilities: sqliteDriverCapabilities`:
- `@prisma/orm-target-sqlite/driver/runtime: default`:
- `@prisma/orm-target-sqlite/driver: sqliteDriverCapabilities`:
- `@prisma/orm-target-sqlite/target/control: createSqliteControlTargetDescriptor`:
- `@prisma/orm-target-sqlite/target/server-version-range: SQLITE_MIN_VERSION`:
- `@prisma/orm-target-sqlite/target/server-version-range: SQLITE_NEWEST_VERSION`:
- `@prisma/orm-target-sqlite/target/server-version-range: SqliteVersion`:
- `@prisma/orm-target-sqlite/target/server-version: SQLITE_VERSION_QUERY`:
- `@prisma/orm-target-sqlite/target/server-version: readSqliteVersionText`:
- `@prisma/orm-target-sqlite/target/server-version: sqliteCapabilitiesByVersion`:
- `@prisma/orm-target-sqlite/target: SQLITE_MIN_VERSION`:
- `@prisma/orm-target-sqlite/target: SQLITE_NEWEST_VERSION`:
- `@prisma/orm-target-sqlite/target: SQLITE_VERSION_QUERY`:
- `@prisma/orm-target-sqlite/target: SqliteVersion`:
- `@prisma/orm-target-sqlite/target: createSqliteControlTargetDescriptor`:
- `@prisma/orm-target-sqlite/target: readSqliteVersionText`:
- `@prisma/orm-target-sqlite/target: sqliteCapabilitiesByVersion`:
- `@prisma/orm-toolchain`:
|
@prisma/orm-better-auth
@prisma/orm-extension-arktype-json
@prisma/orm-extension-middleware-cache
@prisma/orm-extension-pgvector
@prisma/orm-extension-postgis
@prisma/orm-extension-supabase
@prisma/orm-family-mongo
@prisma/orm-family-sql
@prisma/orm-framework
@prisma/orm-mariadb
@prisma/orm-mongo
@prisma/orm-mysql
@prisma/orm-postgres
@prisma/orm-postgres-contrib
@prisma/orm-sqlite
@prisma/orm-target-mariadb
@prisma/orm-target-mongo
@prisma/orm-target-mysql
@prisma/orm-target-postgres
@prisma/orm-target-sqlite
@prisma/orm-toolchain
commit: |
size-limit report 📦
|
Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Tests and fixtures that build a MySQL, MariaDB or SQLite contract now pass the database version and driver lists. Schema IR keeps databaseVersionText optional so introspected schemas from earlier releases still type-check. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Records each public export and example app that now fails against 8.0.0-rc.28, with the reason and the change a user makes. Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
Linked issue
n/a: no ticket. This is one step of the capabilities by database version project, designed in slice-provided-apart.md. It follows #31316, which made a contract store its required capabilities as a list of keys.
At a glance
A capability is a yes-or-no fact that a database version or a connection provides and a contract requires, such as the database supporting
RETURNING(ADR 335). Keys that start withdb.are facts about the database; keys that start withconn.are facts about the connection. Before a database is used,prisma db signchecks that the database's version provides everydb.key the contract requires.Until now that check did nothing on MySQL, MariaDB and SQLite. Every contract on those databases required one fixed list that its author never wrote and could not change, and nothing read the database's version. After this change the author writes the list, as on PostgreSQL:
mysql8_4is what MySQL 8.4 provides.mysqlDriveris what the MySQL driver's connection provides. A Prisma schema project writes the same list inprisma.config.ts, ascontract: { path, requiredCapabilities }. MariaDB exportsmariadb10_11andmariadbDriver; SQLite exportssqlite3_38andsqliteDriver.Then
prisma db signand the migration commands check the database. If the server's version does not provide adb.key the contract requires, they refuse withCONTRACT.DATABASE_CAPABILITIES_NOT_PROVIDED, naming each missing key and the first version that provides it.Summary
The fixed list came from shared code. Five places added what components provide to what a contract requires:
enrichContractadded the target's and adapter's lists again after emit.buildContractadded the target pack's list.requiredCapabilitiesOfadded the list the facade passed for its adapter.On MySQL, MariaDB and SQLite each adapter declared one list mixing
db.andconn.keys, so all five added it. PostgreSQL escaped only because its components declare nothing, a convention that any component could break. This pull request removes all five, so no code can add a provided capability to a contract, and moves MySQL, MariaDB and SQLite onto PostgreSQL's design.Decision
capabilitiesmoves off the control-plane types (the contract source's context, the control stack, and component metadata) onto the runtime adapter and driver descriptors, the only place it is read. The exact exports are under API changes.mysqlCapabilitiesByVersion,mariadbCapabilitiesByVersion,sqliteCapabilitiesByVersion). The driver declares itsconn.keys. The adapter declares[].prismaContract(...)orprisma7Contract(...)and no list still gets a default list and a warning until 8.0; MySQL, MariaDB and SQLite get no such default.conn.keys at compile time, by comparing the contract's type with what the facade's driver declares, and at start, as PostgreSQL's does.The adapters' old lists also held four keys that no code reads as capabilities (
db.enums,db.foreignKeys,db.limit,db.orderBy). They are in no version table. For each database, the new table row plus the driver's list equals the adapter's old list minus those keys.Notes for the reviewer
unionCapabilityKeys); it adds no new concept.storagesection, does not change. The profile hash, which covers the contract's required capabilities and is recorded in the database's contract signature, does. A database signed by an earlier release must be signed again withprisma db sign; the upgrade instructions say so.pnpm fixtures:checkregenerates them, so theirrequiredCapabilitiesnow hold the new lists.How it fits together
buildContract,requiredCapabilitiesOfand the contract type, which is now the author's keys only.server-version.ts, driver lists in each driver'scapabilities.ts, and the exported list names built from the newest row. MySQL's server-version.ts.SqlSchemaIR.databaseVersionText. The shared comparison turns it into findings, and signing and the migration runner call it for every contract space. database-capabilities-not-provided.ts, database-capabilities-check.ts.defineContractoptions and the config'scontractentry, with their refusals.initwrites the list for MySQL and SQLite.prisma-8skill, and the docs (ADR 335, ADR 222, ADR 031, ADR 065, the capabilities guide, the error reference, the glossary).Behavior changes & evidence
pnpm fixtures:check.db sign,db init,db updateanddb migraterefuse a database whose version lacks a requireddb.key. Evidence: MySQL and MariaDB tests, with*.live.test.tsbeside them against live databases in CI; SQLite's runner test against a database file.conn.key the driver lacks is a type error at the client factory, naming the key. Evidence: each facade's client type tests.defineContracttests.API changes
@prisma/orm-framework:capabilitiesremoved fromContractSourceContext,ControlStack,ComponentMetadata,ExtensionDescriptorandExtensionPackRef, andunionCapabilityKeysremoved, because no code may add what a component provides to what a contract requires.capabilitiesadded toRuntimeAdapterDescriptorandRuntimeDriverDescriptor, the only place it is read.@prisma/orm-family-sql: the shared version comparison, version parsing and runner check (databaseCapabilitiesNotProvidedByVersion,parseDatabaseVersion,checkSpacesDatabaseCapabilities), theCapabilitiesByVersiontable type, the refusal helpers (requiredCapabilitiesFor,requiredCapabilitiesFix,describeConfigValue) and the newfamily/contract-entrysubpath with the config-entry types and refusals are exported for the PostgreSQL, MySQL, MariaDB and SQLite facades, which are published separately.SqlSchemaIRgainsdatabaseVersionText.AdapterContractContributionsis exported;ContractInput.adapterandCapabilityContributorno longer carry capabilities; the internal typesDerivedCapabilitiesandExtractPackCapabilitieschange because a contract's type is now only the author's list.@prisma/orm-mysql: exportsmysql8_4,mysqlDriverandRequiredCapabilitiesfrom/configand/contract-builder; the config'scontracttakes an entry withrequiredCapabilities; the client factory takes adapter and driver type parameters so it can checkconn.keys at compile time.@prisma/orm-mariadb: exportsmariadb10_11,mariadbDriverandRequiredCapabilities, with the same config and client changes as MySQL.@prisma/orm-sqlite: exportssqlite3_38,sqliteDriverandRequiredCapabilities, with the same config,defineContractand client changes as MySQL.@prisma/orm-postgres: its API compatibility records are updated, because framework and family types its exports refer to changed.@prisma/orm-target-mysql: adds the version table, the version query and reader, the range constants and the driver's capability list; the adapter's capability list is now empty, and its descriptors and runtime types follow the framework change.@prisma/orm-target-mariadb: adds the version table and range constants; the adapter's capability list is now empty.@prisma/orm-target-sqlite: adds the version table, the version query and reader, the range constants and the driver's capability list; the adapter's capability list is now empty.@prisma/orm-target-postgres: its descriptor types lose thecapabilitiesmember removed from the framework.@prisma/orm-target-mongo:MongoTargetPackloses its emptycapabilitiesmember, removed from the framework.@prisma/orm-family-mongo,@prisma/orm-mongoand@prisma/orm-toolchain: break records added, because their control descriptors, control stacks and contract source contexts no longer carry thecapabilitiesmember removed from the framework.examples/prisma-8-demo-mysql,examples/prisma-8-demo-mariadbandexamples/prisma-8-demo-sqlite: their last-release code now fails to compile where it builds a contract or a Prisma schema config entry withoutrequiredCapabilities, which these databases now require; recorded as expected errors.Testing performed
pnpm fixtures:check./drive-code-review(a system design review and a code review) on the final code; every finding is fixed.db signagainst a database that passes and one that is refused.api:compatrun in CI.Skill update
skills/prisma-8/references/contract.mdgains a "Required capabilities" entry and rows for the refusals (ARGUMENT_INVALID,REQUIRED_CAPABILITIES_NOT_LISTED, and the causes ofDATABASE_CAPABILITIES_NOT_PROVIDED). Upgrade instructions for applications and for extension authors are inupgrade-instructions/pending/required-capabilities-other-sql-databases/.Follow-ups
Also recorded in deferred.md: the MySQL, MariaDB and SQLite clients do not check
transaction()against the driver; the PostgreSQL extension packs spread the wholepostgres15list; the adapter'scapabilitiesmember is always empty; MySQL and SQLiteinitset no minimum server version;db migratewith nothing to apply leaves the old profile hash.Alternatives considered
Checklist
git commit -s) per the DCO, except the merge ofmain, which CI checks.Agent: iommi-43