Skip to content

Commit ea7efab

Browse files
chargomeclaude
andauthored
fix(node): Instrument Prisma 8 CollectionBase from rc.15 (#25301)
Prisma 8.0.0-rc.15 renamed `CollectionImpl` to `CollectionBase`, which silently dropped all Prisma operation spans, so this targets the new class and moves the tests to rc.17 (older RCs are no longer supported). Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 8017de6 commit ea7efab

9 files changed

Lines changed: 132 additions & 91 deletions

File tree

‎dev-packages/e2e-tests/test-applications/node-prisma-8/init.sql‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,31 @@ CREATE TABLE prisma_contract.marker (
3434
meta jsonb DEFAULT '{}'::jsonb NOT NULL,
3535
invariants text[] DEFAULT '{}'::text[] NOT NULL
3636
);
37-
CREATE TABLE public."user" (
37+
CREATE TABLE public."User" (
3838
email text NOT NULL,
3939
id integer NOT NULL,
4040
name text
4141
);
42-
CREATE SEQUENCE public.user_id_seq
42+
CREATE SEQUENCE public."User_id_seq"
4343
AS integer
4444
START WITH 1
4545
INCREMENT BY 1
4646
NO MINVALUE
4747
NO MAXVALUE
4848
CACHE 1;
49-
ALTER SEQUENCE public.user_id_seq OWNED BY public."user".id;
49+
ALTER SEQUENCE public."User_id_seq" OWNED BY public."User".id;
5050
ALTER TABLE ONLY prisma_contract.ledger ALTER COLUMN id SET DEFAULT nextval('prisma_contract.ledger_id_seq'::regclass);
51-
ALTER TABLE ONLY public."user" ALTER COLUMN id SET DEFAULT nextval('public.user_id_seq'::regclass);
52-
INSERT INTO prisma_contract.contract VALUES ('f4e1954fd8bed87828d13c3f1a02164dc9796ef1af76ed6f98184c01263169c5', '2026-09-09 09:15:28.369559+00', '{"meta": {}, "roots": {"user": {"model": "User", "namespace": "public"}}, "domain": {"namespaces": {"public": {"models": {"User": {"fields": {"id": {"type": {"kind": "scalar", "codecId": "pg/int4@1"}, "nullable": false}, "name": {"type": {"kind": "scalar", "codecId": "pg/text@1"}, "nullable": true}, "email": {"type": {"kind": "scalar", "codecId": "pg/text@1"}, "nullable": false}}, "storage": {"table": "user", "fields": {"id": {"column": "id"}, "name": {"column": "name"}, "email": {"column": "email"}}, "namespaceId": "public"}, "relations": {}}}}}}, "target": "postgres", "storage": {"namespaces": {"public": {"id": "public", "entries": {"table": {"user": {"columns": {"id": {"codecId": "pg/int4@1", "default": {"kind": "function", "expression": "autoincrement()"}, "nullable": false, "nativeType": "int4"}, "name": {"codecId": "pg/text@1", "nullable": true, "nativeType": "text"}, "email": {"codecId": "pg/text@1", "nullable": false, "nativeType": "text"}}, "indexes": [], "uniques": [{"columns": ["email"]}], "primaryKey": {"columns": ["id"]}, "foreignKeys": []}}}}}, "storageHash": "f4e1954fd8bed87828d13c3f1a02164dc9796ef1af76ed6f98184c01263169c5"}, "extensions": {}, "profileHash": "3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2", "capabilities": {"sql": {"enums": true, "lateral": true, "returning": true, "scalarList": true, "checkConstraint": true, "defaultInInsert": true}, "postgres": {"limit": true, "jsonAgg": true, "lateral": true, "orderBy": true, "returning": true, "distinctOn": true}}, "targetFamily": "sql"}');
53-
INSERT INTO prisma_contract.ledger VALUES (1, '2026-09-09 09:15:28.369559+00', 'app', '', 'f4e1954fd8bed87828d13c3f1a02164dc9796ef1af76ed6f98184c01263169c5', '', NULL, 'f4e1954fd8bed87828d13c3f1a02164dc9796ef1af76ed6f98184c01263169c5', NULL, '[{"id": "table.user", "label": "Create table \"user\"", "target": {"id": "postgres", "details": {"name": "user", "schema": "public", "objectType": "table"}}, "execute": [{"sql": "CREATE TABLE \"public\".\"user\" (\n \"email\" text NOT NULL,\n \"id\" SERIAL NOT NULL,\n \"name\" text,\n PRIMARY KEY (\"id\")\n)", "params": [], "description": "create table \"user\""}], "summary": "Creates table \"user\"", "precheck": [{"sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"", "params": ["\"public\".\"user\""], "description": "ensure table \"user\" does not exist"}], "postcheck": [{"sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"", "params": ["\"public\".\"user\""], "description": "verify table \"user\" exists"}], "operationClass": "additive"}, {"id": "unique.user.user_email_key", "label": "Add unique constraint on \"user\" (email)", "target": {"id": "postgres", "details": {"name": "user_email_key", "table": "user", "schema": "public", "objectType": "unique"}}, "execute": [{"sql": "ALTER TABLE \"public\".\"user\" ADD CONSTRAINT \"user_email_key\" UNIQUE (\"email\")", "description": "add unique constraint \"user_email_key\""}], "precheck": [{"sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"", "params": ["user_email_key", "public", "\"public\".\"user\""], "description": "ensure constraint \"user_email_key\" does not exist"}], "postcheck": [{"sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"", "params": ["user_email_key", "public", "\"public\".\"user\""], "description": "verify constraint \"user_email_key\" exists"}], "operationClass": "additive"}]');
54-
INSERT INTO prisma_contract.marker VALUES ('app', 'f4e1954fd8bed87828d13c3f1a02164dc9796ef1af76ed6f98184c01263169c5', '3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2', NULL, NULL, '2026-09-09 09:15:28.369559+00', NULL, '{}', '{}');
51+
ALTER TABLE ONLY public."User" ALTER COLUMN id SET DEFAULT nextval('public."User_id_seq"'::regclass);
52+
INSERT INTO prisma_contract.contract VALUES ('a62d15a094e80be7b342d75e0538935972b9699c76dabb5339940dd50d17a889', '2026-10-08 14:56:22.624077+00', '{"meta": {}, "roots": {"User": {"model": "User", "namespace": "public"}}, "domain": {"namespaces": {"public": {"models": {"User": {"fields": {"id": {"many": false, "type": {"kind": "scalar", "codecId": "pg/int4@1"}, "nullable": false}, "name": {"many": false, "type": {"kind": "scalar", "codecId": "pg/text@1"}, "nullable": true}, "email": {"many": false, "type": {"kind": "scalar", "codecId": "pg/text@1"}, "nullable": false}}, "storage": {"table": "User", "fields": {"id": {"column": "id"}, "name": {"column": "name"}, "email": {"column": "email"}}, "namespaceId": "public"}, "relations": {}}}}}}, "target": "postgres", "storage": {"namespaces": {"public": {"id": "public", "entries": {"table": {"User": {"columns": {"id": {"many": false, "codecId": "pg/int4@1", "default": {"kind": "function", "expression": "autoincrement()"}, "dataType": "pg/int4", "nullable": false}, "name": {"many": false, "codecId": "pg/text@1", "dataType": "pg/text", "nullable": true}, "email": {"many": false, "codecId": "pg/text@1", "dataType": "pg/text", "nullable": false}}, "indexes": [], "uniques": [{"columns": ["email"]}], "primaryKey": {"columns": ["id"]}, "foreignKeys": []}}}}}, "storageHash": "a62d15a094e80be7b342d75e0538935972b9699c76dabb5339940dd50d17a889"}, "extensions": {}, "profileHash": "3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2", "capabilities": {"sql": {"enums": true, "lockOf": true, "lateral": true, "forShare": true, "forUpdate": true, "returning": true, "lockNowait": true, "scalarList": true, "lockSkipLocked": true, "checkConstraint": true, "defaultInInsert": true, "insertOnConflictSkip": true, "insertOnConflictWithoutTarget": true}, "postgres": {"limit": true, "jsonAgg": true, "lateral": true, "orderBy": true, "returning": true, "distinctOn": true, "forKeyShare": true, "forNoKeyUpdate": true}}, "targetFamily": "sql"}');
53+
INSERT INTO prisma_contract.ledger VALUES (1, '2026-10-08 14:56:22.624077+00', 'app', '', 'a62d15a094e80be7b342d75e0538935972b9699c76dabb5339940dd50d17a889', '', NULL, 'a62d15a094e80be7b342d75e0538935972b9699c76dabb5339940dd50d17a889', NULL, '[{"id": "table.User", "label": "Create table \"User\"", "target": {"id": "postgres", "details": {"name": "User", "schema": "public", "objectType": "table"}}, "execute": [{"sql": "CREATE TABLE \"public\".\"User\" (\n \"email\" text NOT NULL,\n \"id\" SERIAL NOT NULL,\n \"name\" text,\n PRIMARY KEY (\"id\")\n)", "params": [], "description": "create table \"User\""}], "summary": "Creates table \"User\"", "precheck": [{"sql": "SELECT (to_regclass($1)) IS NULL AS \"result\"", "params": ["\"public\".\"User\""], "description": "ensure table \"User\" does not exist"}], "postcheck": [{"sql": "SELECT (to_regclass($1)) IS NOT NULL AS \"result\"", "params": ["\"public\".\"User\""], "description": "verify table \"User\" exists"}], "operationClass": "additive"}, {"id": "unique.User.User_email_key", "label": "Add unique constraint on \"User\" (email)", "target": {"id": "postgres", "details": {"name": "User_email_key", "table": "User", "schema": "public", "objectType": "unique"}}, "execute": [{"sql": "ALTER TABLE \"public\".\"User\" ADD CONSTRAINT \"User_email_key\" UNIQUE (\"email\")", "description": "add unique constraint \"User_email_key\""}], "precheck": [{"sql": "SELECT NOT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"", "params": ["User_email_key", "public", "\"public\".\"User\""], "description": "ensure constraint \"User_email_key\" does not exist"}], "postcheck": [{"sql": "SELECT EXISTS (SELECT 1 AS \"one\" FROM \"pg_constraint\" AS \"c\" INNER JOIN \"pg_namespace\" AS \"n\" ON \"n\".\"oid\" = \"c\".\"connamespace\" WHERE (\"c\".\"conname\" = $1 AND \"n\".\"nspname\" = $2 AND \"c\".\"conrelid\" = to_regclass($3))) AS \"result\"", "params": ["User_email_key", "public", "\"public\".\"User\""], "description": "verify constraint \"User_email_key\" exists"}], "operationClass": "additive"}]');
54+
INSERT INTO prisma_contract.marker VALUES ('app', 'a62d15a094e80be7b342d75e0538935972b9699c76dabb5339940dd50d17a889', '3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2', NULL, NULL, '2026-10-08 14:56:22.624077+00', NULL, '{}', '{}');
5555
ALTER TABLE ONLY prisma_contract.contract
5656
ADD CONSTRAINT contract_pkey PRIMARY KEY (core_hash);
5757
ALTER TABLE ONLY prisma_contract.ledger
5858
ADD CONSTRAINT ledger_pkey PRIMARY KEY (id);
5959
ALTER TABLE ONLY prisma_contract.marker
6060
ADD CONSTRAINT marker_pkey PRIMARY KEY (space);
61-
ALTER TABLE ONLY public."user"
62-
ADD CONSTRAINT user_email_key UNIQUE (email);
63-
ALTER TABLE ONLY public."user"
64-
ADD CONSTRAINT user_pkey PRIMARY KEY (id);
61+
ALTER TABLE ONLY public."User"
62+
ADD CONSTRAINT "User_email_key" UNIQUE (email);
63+
ALTER TABLE ONLY public."User"
64+
ADD CONSTRAINT "User_pkey" PRIMARY KEY (id);

‎dev-packages/e2e-tests/test-applications/node-prisma-8/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"test:assert": "pnpm test"
1313
},
1414
"dependencies": {
15-
"@prisma/orm-postgres": "8.0.0-rc.8",
15+
"@prisma/orm-postgres": "8.0.0-rc.17",
1616
"@sentry/node": "file:../../packed/sentry-node-packed.tgz",
1717
"@types/express": "^4.17.21",
1818
"@types/node": "^20.19.0",

‎dev-packages/e2e-tests/test-applications/node-prisma-8/src/prisma/contract.d.ts‎

Lines changed: 64 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,14 @@
11
// ⚠️ GENERATED FILE - DO NOT EDIT
22
// This file is automatically generated by 'prisma contract emit'.
33
// To regenerate, run: prisma contract emit
4-
import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma/orm-postgres/adapter/operation-types';
5-
import type {
6-
Bit,
7-
Char,
8-
CodecTypes as PgTypes,
9-
Interval,
10-
JsonValue,
11-
Numeric,
12-
Time,
13-
TimeString,
14-
Timestamp,
15-
TimestampString,
16-
Timestamptz,
17-
TimestamptzString,
18-
Timetz,
19-
VarBit,
20-
Varchar,
21-
} from '@prisma/orm-postgres/target/codec-types';
4+
import type { CodecTypes as PgTypes } from '@prisma/orm-postgres/target/codec-types';
5+
import type { QueryOperationTypes as PgTargetQueryOps } from '@prisma/orm-postgres/target/operation-types';
226

23-
import type { ContractWithTypeMaps, TypeMaps as TypeMapsType } from '@prisma/orm-postgres/family-contract/types';
7+
import type {
8+
ContractWithTypeMaps,
9+
RelationKeys,
10+
TypeMaps as TypeMapsType,
11+
} from '@prisma/orm-postgres/family-contract/types';
2412
import type {
2513
Contract as ContractType,
2614
ExecutionHashBase,
@@ -29,13 +17,13 @@ import type {
2917
StorageHashBase,
3018
} from '@prisma/orm-postgres/contract/types';
3119

32-
export type StorageHash = StorageHashBase<'f4e1954fd8bed87828d13c3f1a02164dc9796ef1af76ed6f98184c01263169c5'>;
20+
export type StorageHash = StorageHashBase<'a62d15a094e80be7b342d75e0538935972b9699c76dabb5339940dd50d17a889'>;
3321
export type ExecutionHash = ExecutionHashBase<string>;
3422
export type ProfileHash = ProfileHashBase<'3916f444a8a17ad749191acf9e08dad97d1a327b88c2f1d45d12f240296aa8b2'>;
3523

3624
export type CodecTypes = PgTypes;
3725
export type LaneCodecTypes = CodecTypes;
38-
export type QueryOperationTypes = PgAdapterQueryOps<CodecTypes>;
26+
export type QueryOperationTypes = PgTargetQueryOps<CodecTypes>;
3927
export type AggregateTypes = {
4028
readonly avg: {
4129
readonly byCodec: {
@@ -113,6 +101,10 @@ export type AggregateTypes = {
113101
readonly output: 'pg/timestamp-temporal@1';
114102
readonly nullable: true;
115103
};
104+
readonly 'pg/timestamptz-date@1': {
105+
readonly output: 'pg/timestamptz-date@1';
106+
readonly nullable: true;
107+
};
116108
readonly 'pg/timestamptz-string@1': {
117109
readonly output: 'pg/timestamptz-string@1';
118110
readonly nullable: true;
@@ -169,6 +161,10 @@ export type AggregateTypes = {
169161
readonly output: 'pg/timestamp-temporal@1';
170162
readonly nullable: true;
171163
};
164+
readonly 'pg/timestamptz-date@1': {
165+
readonly output: 'pg/timestamptz-date@1';
166+
readonly nullable: true;
167+
};
172168
readonly 'pg/timestamptz-string@1': {
173169
readonly output: 'pg/timestamptz-string@1';
174170
readonly nullable: true;
@@ -236,24 +232,24 @@ type DefaultLiteralValue<CodecId extends string, Encoded> = CodecId extends keyo
236232
export type FieldOutputTypes = {
237233
readonly public: {
238234
readonly User: {
239-
readonly id: CodecTypes['pg/int4@1']['output'];
240235
readonly email: CodecTypes['pg/text@1']['output'];
236+
readonly id: CodecTypes['pg/int4@1']['output'];
241237
readonly name: CodecTypes['pg/text@1']['output'] | null;
242238
};
243239
};
244240
};
245241
export type FieldInputTypes = {
246242
readonly public: {
247243
readonly User: {
248-
readonly id: CodecTypes['pg/int4@1']['input'];
249244
readonly email: CodecTypes['pg/text@1']['input'];
245+
readonly id: CodecTypes['pg/int4@1']['input'];
250246
readonly name: CodecTypes['pg/text@1']['input'] | null;
251247
};
252248
};
253249
};
254250
export type StorageColumnTypes = {
255251
readonly public: {
256-
readonly user: {
252+
readonly User: {
257253
readonly email: CodecTypes['pg/text@1']['output'];
258254
readonly id: CodecTypes['pg/int4@1']['output'];
259255
readonly name: CodecTypes['pg/text@1']['output'] | null;
@@ -262,13 +258,29 @@ export type StorageColumnTypes = {
262258
};
263259
export type StorageColumnInputTypes = {
264260
readonly public: {
265-
readonly user: {
261+
readonly User: {
266262
readonly email: CodecTypes['pg/text@1']['input'];
267263
readonly id: CodecTypes['pg/int4@1']['input'];
268264
readonly name: CodecTypes['pg/text@1']['input'] | null;
269265
};
270266
};
271267
};
268+
269+
export namespace Models {
270+
export type public_User = {
271+
email: CodecTypes['pg/text@1']['output'];
272+
id: CodecTypes['pg/int4@1']['output'];
273+
name: CodecTypes['pg/text@1']['output'] | null;
274+
readonly [RelationKeys]?: never;
275+
};
276+
}
277+
278+
export declare const models: {
279+
public: {
280+
User: Models.public_User;
281+
};
282+
};
283+
272284
export type TypeMaps = TypeMapsType<
273285
CodecTypes,
274286
QueryOperationTypes,
@@ -287,26 +299,29 @@ type ContractBase = Omit<
287299
readonly kind: 'postgres-schema';
288300
readonly entries: {
289301
readonly table: {
290-
readonly user: {
302+
readonly User: {
291303
columns: {
304+
readonly email: {
305+
readonly dataType: 'pg/text';
306+
readonly codecId: 'pg/text@1';
307+
readonly nullable: false;
308+
readonly many: false;
309+
};
292310
readonly id: {
293-
readonly nativeType: 'int4';
311+
readonly dataType: 'pg/int4';
294312
readonly codecId: 'pg/int4@1';
295313
readonly nullable: false;
296314
readonly default: {
297315
readonly kind: 'function';
298316
readonly expression: 'autoincrement()';
299317
};
300-
};
301-
readonly email: {
302-
readonly nativeType: 'text';
303-
readonly codecId: 'pg/text@1';
304-
readonly nullable: false;
318+
readonly many: false;
305319
};
306320
readonly name: {
307-
readonly nativeType: 'text';
321+
readonly dataType: 'pg/text';
308322
readonly codecId: 'pg/text@1';
309323
readonly nullable: true;
324+
readonly many: false;
310325
};
311326
};
312327
primaryKey: { readonly columns: readonly ['id'] };
@@ -325,34 +340,34 @@ type ContractBase = Omit<
325340
readonly target: 'postgres';
326341
readonly targetFamily: 'sql';
327342
readonly roots: {
328-
readonly user: { readonly namespace: 'public' & NamespaceId; readonly model: 'User' };
343+
readonly User: { readonly namespace: 'public' & NamespaceId; readonly model: 'User' };
329344
};
330345
readonly domain: {
331346
readonly namespaces: {
332347
readonly public: {
333348
readonly models: {
334349
readonly User: {
335350
readonly fields: {
336-
readonly id: {
337-
readonly nullable: false;
338-
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
339-
};
340351
readonly email: {
341352
readonly nullable: false;
342353
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
343354
};
355+
readonly id: {
356+
readonly nullable: false;
357+
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' };
358+
};
344359
readonly name: {
345360
readonly nullable: true;
346361
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
347362
};
348363
};
349364
readonly relations: Record<string, never>;
350365
readonly storage: {
351-
readonly table: 'user';
366+
readonly table: 'User';
352367
readonly namespaceId: 'public';
353368
readonly fields: {
354-
readonly id: { readonly column: 'id' };
355369
readonly email: { readonly column: 'email' };
370+
readonly id: { readonly column: 'id' };
356371
readonly name: { readonly column: 'name' };
357372
};
358373
};
@@ -364,6 +379,8 @@ type ContractBase = Omit<
364379
readonly capabilities: {
365380
readonly postgres: {
366381
readonly distinctOn: true;
382+
readonly forKeyShare: true;
383+
readonly forNoKeyUpdate: true;
367384
readonly jsonAgg: true;
368385
readonly lateral: true;
369386
readonly limit: true;
@@ -374,7 +391,14 @@ type ContractBase = Omit<
374391
readonly checkConstraint: true;
375392
readonly defaultInInsert: true;
376393
readonly enums: true;
394+
readonly forShare: true;
395+
readonly forUpdate: true;
396+
readonly insertOnConflictSkip: true;
397+
readonly insertOnConflictWithoutTarget: true;
377398
readonly lateral: true;
399+
readonly lockNowait: true;
400+
readonly lockOf: true;
401+
readonly lockSkipLocked: true;
378402
readonly returning: true;
379403
readonly scalarList: true;
380404
};

0 commit comments

Comments
 (0)