@prisma/orm-sqlite 8.0.0-rc.16-dev.5 → 8.0.0-rc.16-dev.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,9 @@
1
1
  import sqlitePackRef from "@prisma/orm-target-sqlite/target/pack";
2
- import { ComposedAuthoringHelpers, ComposedAuthoringHelpers as ComposedAuthoringHelpers$1, ContractDefinition, ContractInput, ContractInput as ContractInput$1, ContractModelBuilder, FieldNode, ForeignKeyNode, IndexNode, ModelLike, ModelLike as ModelLike$1, ModelNode, PrimaryKeyNode, RelationNode, ScalarFieldBuilder, UniqueConstraintNode, autoincrement, buildBoundContract, field, model, now, rel, sql } from "@prisma/orm-family-sql/contract-ts/contract-builder";
2
+ import { ComposedAuthoringHelpers, ComposedAuthoringHelpers as ComposedAuthoringHelpers$1, ContractDefinition, ContractInput, ContractInput as ContractInput$1, ContractModelBuilder, EnumTypeHandle, FieldNode, ForeignKeyNode, IndexNode, MergeEnums, ModelLike, ModelLike as ModelLike$1, ModelNode, PrimaryKeyNode, RelationNode, ScalarFieldBuilder, UniqueConstraintNode, autoincrement, buildBoundContract, field, member, model, now, rel, sql } from "@prisma/orm-family-sql/contract-ts/contract-builder";
3
3
  import sqlFamilyPack from "@prisma/orm-family-sql/family/pack";
4
- import { CodecLookupWithDescriptors, DataTypeLookup } from "@prisma/orm-framework/components/codec";
4
+ import { CodecLookupWithDescriptors, ColumnTypeDescriptor, DataTypeLookup } from "@prisma/orm-framework/components/codec";
5
+ import "@prisma/orm-framework/contract/types";
6
+ import "@prisma/orm-framework/components/authoring";
5
7
  import { ExtensionPackRef } from "@prisma/orm-framework/components/components";
6
8
  import { AuthoredStorageTypeInstance, SqlNamespaceBase, SqlNamespaceInput } from "@prisma/orm-family-sql/contract/types";
7
9
  //#region ../../../3-extensions/sqlite/dist/contract-builder.d.mts
@@ -10,30 +12,188 @@ type SqlFamily = typeof sqlFamilyPack;
10
12
  type SqlitePack = typeof sqlitePackRef;
11
13
  type TypesConstraint = Record<string, AuthoredStorageTypeInstance>;
12
14
  type ModelsConstraint = Record<string, ModelLike$1>;
13
- type SqliteResult<Types extends TypesConstraint, Models extends ModelsConstraint, Extensions extends Record<string, ExtensionPackRef<'sql', string>> | undefined> = ReturnType<typeof buildBoundContract<SqlFamily, SqlitePack, {
15
+ type EnumsConstraint = Record<string, EnumTypeHandle>;
16
+ type SqliteResult<Types extends TypesConstraint, Models extends ModelsConstraint, Extensions extends Record<string, ExtensionPackRef<'sql', string>> | undefined, Enums extends EnumsConstraint> = ReturnType<typeof buildBoundContract<SqlFamily, SqlitePack, {
14
17
  readonly types?: Types;
15
18
  readonly models?: Models;
16
19
  readonly extensions?: Extensions;
20
+ readonly enums?: Enums;
17
21
  readonly createNamespace: (input: SqlNamespaceInput) => SqlNamespaceBase;
18
22
  readonly codecLookup: CodecLookupWithDescriptors;
19
23
  readonly dataTypeLookup: DataTypeLookup;
20
24
  }>>;
21
- type SqliteBaseScaffold<Extensions extends Record<string, ExtensionPackRef<'sql', string>> | undefined> = Omit<ContractInput$1<SqlFamily, SqlitePack, Record<never, never>, Record<never, never>, Extensions>, 'family' | 'target' | 'types' | 'models' | 'createNamespace' | 'codecLookup' | 'dataTypeLookup'> & {
25
+ type SqliteBaseScaffold<Extensions extends Record<string, ExtensionPackRef<'sql', string>> | undefined> = Omit<ContractInput$1<SqlFamily, SqlitePack, Record<never, never>, Record<never, never>, Extensions>, 'family' | 'target' | 'types' | 'models' | 'enums' | 'createNamespace' | 'codecLookup' | 'dataTypeLookup'> & {
22
26
  /** Overrides the codecs of the target and the extensions. */
23
27
  readonly codecLookup?: CodecLookupWithDescriptors;
24
28
  /** Overrides the data types of the target and the extensions. */
25
29
  readonly dataTypeLookup?: DataTypeLookup;
26
30
  };
27
- type SqliteDefinition<Types extends TypesConstraint, Models extends ModelsConstraint, Extensions extends Record<string, ExtensionPackRef<'sql', string>> | undefined> = SqliteBaseScaffold<Extensions> & {
31
+ type SqliteDefinition<Types extends TypesConstraint, Models extends ModelsConstraint, Extensions extends Record<string, ExtensionPackRef<'sql', string>> | undefined, Enums extends EnumsConstraint> = SqliteBaseScaffold<Extensions> & {
28
32
  readonly types?: Types;
29
33
  readonly models?: Models;
34
+ readonly enums?: Enums;
30
35
  };
31
- type SqliteScaffold<Extensions extends Record<string, ExtensionPackRef<'sql', string>> | undefined> = SqliteBaseScaffold<Extensions>;
32
- declare function defineContract<const Types extends TypesConstraint = Record<never, never>, const Models extends ModelsConstraint = Record<never, never>, const Extensions extends Record<string, ExtensionPackRef<'sql', string>> | undefined = undefined>(definition: SqliteDefinition<Types, Models, Extensions>): SqliteResult<Types, Models, Extensions>;
33
- declare function defineContract<const Types extends TypesConstraint = Record<never, never>, const Models extends ModelsConstraint = Record<never, never>, const Extensions extends Record<string, ExtensionPackRef<'sql', string>> | undefined = undefined>(scaffold: SqliteScaffold<Extensions>, factory: (helpers: ComposedAuthoringHelpers$1<SqlFamily, SqlitePack, Extensions>) => {
36
+ type SqliteScaffold<Extensions extends Record<string, ExtensionPackRef<'sql', string>> | undefined, Enums extends EnumsConstraint> = SqliteBaseScaffold<Extensions> & {
37
+ readonly enums?: Enums;
38
+ };
39
+ declare function defineContract<const Types extends TypesConstraint = Record<never, never>, const Models extends ModelsConstraint = Record<never, never>, const Extensions extends Record<string, ExtensionPackRef<'sql', string>> | undefined = undefined, const Enums extends EnumsConstraint = Record<never, never>>(definition: SqliteDefinition<Types, Models, Extensions, Enums>): SqliteResult<Types, Models, Extensions, Enums>;
40
+ declare function defineContract<const Types extends TypesConstraint = Record<never, never>, const Models extends ModelsConstraint = Record<never, never>, const Extensions extends Record<string, ExtensionPackRef<'sql', string>> | undefined = undefined, const ScaffoldEnums extends EnumsConstraint = Record<never, never>, const FactoryEnums extends EnumsConstraint = Record<never, never>>(scaffold: SqliteScaffold<Extensions, ScaffoldEnums>, factory: (helpers: ComposedAuthoringHelpers$1<SqlFamily, SqlitePack, Extensions>) => {
34
41
  readonly types?: Types;
35
42
  readonly models?: Models;
36
- }): SqliteResult<Types, Models, Extensions>;
43
+ readonly enums?: FactoryEnums;
44
+ }): SqliteResult<Types, Models, Extensions, MergeEnums<ScaffoldEnums, FactoryEnums>>;
45
+ //#endregion
46
+ //#region ../../1-framework/2-authoring/contract/dist/index.d.mts
47
+ //#endregion
48
+ //#region src/enum-type.d.ts
49
+ /**
50
+ * A single enum member produced by `member()`. The `Name` and `Value` generics
51
+ * are preserved as literal types so `enumType()` can carry the ordered value
52
+ * tuple in its return type. `Value` is whatever the codec dictates — its type
53
+ * is constrained at `enumType` against the codec's input type, not here.
54
+ */
55
+ interface EnumMember<Name extends string, Value> {
56
+ readonly name: Name;
57
+ readonly value: Value;
58
+ }
59
+ type MembersToValues<Members extends readonly EnumMember<string, unknown>[]> = { readonly [K in keyof Members]: Members[K] extends EnumMember<string, infer V> ? V : never; };
60
+ type MembersToNames<Members extends readonly EnumMember<string, unknown>[]> = { readonly [K in keyof Members]: Members[K] extends EnumMember<infer N, unknown> ? N : never; };
61
+ type MembersAccessorMap<Members extends readonly EnumMember<string, unknown>[]> = { readonly [M in Members[number] as M['name']]: M['value']; };
62
+ declare const ENUM_TYPE_HANDLE_BRAND = "__prismaNextEnumTypeHandle__";
63
+ /** Authoring handle returned by `enumType()`. Generic over the ordered value tuple so `const Role = enumType(...)` retains literal types. */
64
+ interface EnumTypeHandle$1<Name extends string = string, Values extends readonly unknown[] = readonly unknown[], Names extends readonly string[] = readonly string[], MembersMap extends Record<string, unknown> = Record<string, unknown>> {
65
+ /** Internal brand for lowering-pipeline detection. */
66
+ readonly [ENUM_TYPE_HANDLE_BRAND]: true;
67
+ /** The enum's declared name (used as the key in domain `enum` / storage `valueSet`). */
68
+ readonly enumName: Name;
69
+ /** codecId from the codec passed to `enumType`. */
70
+ readonly codecId: string;
71
+ /** Ordered member list for lowering (name + value pairs). */
72
+ readonly enumMembers: readonly {
73
+ readonly name: string;
74
+ readonly value: Values[number];
75
+ }[];
76
+ /** Ordered literal value tuple. Declaration order is preserved. */
77
+ readonly values: Values;
78
+ /** Ordered literal name tuple. Declaration order is preserved. */
79
+ readonly names: Names;
80
+ /**
81
+ * Namespaced accessor map: `Role.members.User === 'user'`.
82
+ * Namespaced under `.members` to avoid collisions with `.values` / `.has`.
83
+ */
84
+ readonly members: MembersMap;
85
+ /** Returns `true` if `v` is a declared member value. */
86
+ has(v: Values[number]): boolean;
87
+ /** Returns the member name for a value, or `undefined` if not found. */
88
+ nameOf(v: Values[number]): string | undefined;
89
+ /** Returns the zero-based declaration index of a value, or `-1` if not found. */
90
+ ordinalOf(v: Values[number]): number;
91
+ }
92
+ /**
93
+ * A codec typemap: codecId → `{ input, output }`, the same shape the query
94
+ * lanes consume. The bound `enumType` wrappers supply the target pack's
95
+ * typemap; the core defaults to an empty map (no codec is known), so member
96
+ * values stay unconstrained.
97
+ */
98
+ type CodecTypeMap = Record<string, {
99
+ readonly input?: unknown;
100
+ }>;
101
+ /**
102
+ * The application input type the codec dictates for an enum's member values:
103
+ * looks `Codec['codecId']` up in the supplied codec typemap. When the codecId
104
+ * isn't in the map the input is unconstrained, so any member-value literal is
105
+ * accepted and inferred verbatim.
106
+ */
107
+ type CodecInput<CodecTypes extends CodecTypeMap, Codec extends {
108
+ readonly codecId: string;
109
+ }> = Codec['codecId'] extends keyof CodecTypes ? CodecTypes[Codec['codecId']] extends {
110
+ readonly input: infer In;
111
+ } ? In : unknown : unknown;
112
+ /**
113
+ * The signature of an `enumType` whose codec typemap is already bound — the
114
+ * shape a target-bound wrapper (e.g. `@internal/postgres/contract-builder`)
115
+ * exposes. The member values are constrained to the codec's input type drawn
116
+ * from `CodecTypes`, while `Name`, `Codec`, and the member tuple still infer
117
+ * from the call.
118
+ */
119
+ type BoundEnumType<CodecTypes extends CodecTypeMap> = <const Name extends string, const Codec extends Pick<ColumnTypeDescriptor, 'codecId'>, const Members extends readonly [EnumMember<string, CodecInput<CodecTypes, Codec>>, ...EnumMember<string, CodecInput<CodecTypes, Codec>>[]]>(name: Name, codec: Codec, ...members: Members) => EnumTypeHandle$1<Name, MembersToValues<[...Members]>, MembersToNames<[...Members]>, MembersAccessorMap<[...Members]>>;
120
+ //#endregion
121
+ //#region src/contract/enum-type.d.ts
122
+ /** `enumType` bound to the pack's codec types, so each `member()` value is checked against the enum codec's input type. */
123
+ declare const enumType: BoundEnumType<{
124
+ readonly "sql/char@1": Pick<{
125
+ readonly input: string;
126
+ readonly output: string;
127
+ readonly json: import("@prisma/orm-framework/contract/types").JsonValue;
128
+ readonly traits: "equality" | "order" | "textual";
129
+ }, "traits" | "output" | "input">;
130
+ readonly "sql/varchar@1": Pick<{
131
+ readonly input: string;
132
+ readonly output: string;
133
+ readonly json: import("@prisma/orm-framework/contract/types").JsonValue;
134
+ readonly traits: "equality" | "order" | "textual";
135
+ }, "traits" | "output" | "input">;
136
+ readonly "sql/int@1": Pick<{
137
+ readonly input: number;
138
+ readonly output: number;
139
+ readonly json: import("@prisma/orm-framework/contract/types").JsonValue;
140
+ readonly traits: "equality" | "order" | "numeric";
141
+ }, "traits" | "output" | "input">;
142
+ readonly "sql/float@1": Pick<{
143
+ readonly input: number;
144
+ readonly output: number;
145
+ readonly json: import("@prisma/orm-framework/contract/types").JsonValue;
146
+ readonly traits: "equality" | "order" | "numeric";
147
+ }, "traits" | "output" | "input">;
148
+ readonly "sqlite/text@1": Pick<{
149
+ readonly input: string;
150
+ readonly output: string;
151
+ readonly json: import("@prisma/orm-framework/contract/types").JsonValue;
152
+ readonly traits: "equality" | "order" | "textual";
153
+ }, "traits" | "output" | "input">;
154
+ readonly "sqlite/integer@1": Pick<{
155
+ readonly input: number;
156
+ readonly output: number;
157
+ readonly json: import("@prisma/orm-framework/contract/types").JsonValue;
158
+ readonly traits: "equality" | "order" | "numeric";
159
+ }, "traits" | "output" | "input">;
160
+ readonly "sqlite/real@1": Pick<{
161
+ readonly input: number;
162
+ readonly output: number;
163
+ readonly json: import("@prisma/orm-framework/contract/types").JsonValue;
164
+ readonly traits: "equality" | "order" | "numeric";
165
+ }, "traits" | "output" | "input">;
166
+ readonly "sqlite/blob@1": Pick<{
167
+ readonly input: Uint8Array<ArrayBufferLike>;
168
+ readonly output: Uint8Array<ArrayBufferLike>;
169
+ readonly json: import("@prisma/orm-framework/contract/types").JsonValue;
170
+ readonly traits: "equality";
171
+ }, "traits" | "output" | "input">;
172
+ readonly "sqlite/datetime@1": Pick<{
173
+ readonly input: Date;
174
+ readonly output: Date;
175
+ readonly json: import("@prisma/orm-framework/contract/types").JsonValue;
176
+ readonly traits: "equality" | "order";
177
+ }, "traits" | "output" | "input">;
178
+ readonly "sqlite/json@1": Pick<{
179
+ readonly input: import("@prisma/orm-framework/contract/types").JsonValue;
180
+ readonly output: import("@prisma/orm-framework/contract/types").JsonValue;
181
+ readonly json: import("@prisma/orm-framework/contract/types").JsonValue;
182
+ readonly traits: "equality";
183
+ }, "traits" | "output" | "input">;
184
+ readonly "sqlite/bigint@1": Pick<{
185
+ readonly input: bigint;
186
+ readonly output: bigint;
187
+ readonly json: import("@prisma/orm-framework/contract/types").JsonValue;
188
+ readonly traits: "equality" | "order" | "numeric";
189
+ }, "traits" | "output" | "input">;
190
+ readonly "sqlite/bigintnumber@1": Pick<{
191
+ readonly input: number;
192
+ readonly output: number;
193
+ readonly json: import("@prisma/orm-framework/contract/types").JsonValue;
194
+ readonly traits: "equality" | "order" | "numeric";
195
+ }, "traits" | "output" | "input">;
196
+ }>;
37
197
  //#endregion
38
- export { type ComposedAuthoringHelpers, type ContractDefinition, type ContractInput, type ContractModelBuilder, type FieldNode, type ForeignKeyNode, type IndexNode, type ModelLike, type ModelNode, type PrimaryKeyNode, type RelationNode, type ScalarFieldBuilder, type UniqueConstraintNode, autoincrement, defineContract, field, model, now, rel, sql };
198
+ export { type ComposedAuthoringHelpers, type ContractDefinition, type ContractInput, type ContractModelBuilder, type FieldNode, type ForeignKeyNode, type IndexNode, type ModelLike, type ModelNode, type PrimaryKeyNode, type RelationNode, type ScalarFieldBuilder, type UniqueConstraintNode, autoincrement, defineContract, enumType, field, member, model, now, rel, sql };
39
199
  //# sourceMappingURL=contract-builder.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-builder.d.mts","names":[],"sources":["../../../../3-extensions/sqlite/dist/contract-builder.d.mts"],"mappings":";;;;;;;;KAOK,mBAAmB;KACnB,oBAAoB;KACpB,kBAAkB,eAAe;KACjC,mBAAmB,eAAe;KAClC,aAAa,cAAc,iBAAiB,eAAe,kBAAkB,mBAAmB,eAAe,gDAAgD,kBAAkB,mBAAmB,WAAW;WACzM,QAAQ;WACR,SAAS;WACT,aAAa;WACb,kBAAkB,OAAO,sBAAsB;WAC/C,aAAa;WACb,gBAAgB;;KAEtB,mBAAmB,mBAAmB,eAAe,gDAAgD,KAAK,gBAAgB,WAAW,YAAY,sBAAsB,sBAAsB;;WAEvL,cAAc;;WAEd,iBAAiB;;KAEvB,iBAAiB,cAAc,iBAAiB,eAAe,kBAAkB,mBAAmB,eAAe,gDAAgD,mBAAmB;WAChL,QAAQ;WACR,SAAS;;KAEf,eAAe,mBAAmB,eAAe,gDAAgD,mBAAmB;iBACxG,qBAAqB,cAAc,kBAAkB,4BAA4B,eAAe,mBAAmB,4BAA4B,mBAAmB,eAAe,0DAA0D,YAAY,iBAAiB,OAAO,QAAQ,cAAc,aAAa,OAAO,QAAQ;iBACjU,qBAAqB,cAAc,kBAAkB,4BAA4B,eAAe,mBAAmB,4BAA4B,mBAAmB,eAAe,0DAA0D,UAAU,eAAe,aAAa,UAAU,SAAS,2BAA2B,WAAW,YAAY;WAC5V,QAAQ;WACR,SAAS;IAChB,aAAa,OAAO,QAAQ"}
1
+ {"version":3,"file":"contract-builder.d.mts","names":[],"sources":["../../../../3-extensions/sqlite/dist/contract-builder.d.mts"],"mappings":";;;;;;;;;;KASK,mBAAmB;KACnB,oBAAoB;KACpB,kBAAkB,eAAe;KACjC,mBAAmB,eAAe;KAClC,kBAAkB,eAAe;KACjC,aAAa,cAAc,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AAwD,qDAAqD,mBAAmB,0BAA0B;;YAEvM;;WAED,UAAU;;WAEV;;WAEA;aACE;aACA,OAAO;;;WAGT,QAAQ;;WAER,OAAO;;;;;WAKP,SAAS;;EAElB,IAAI,GAAG;;EAEP,OAAO,GAAG;;EAEV,UAAU,GAAG;;;;;;;;KAQV,eAAe;WACT;;;;;;;;KAQN,WAAW,mBAAmB,cAAc;WACtC;KACN,+BAA+B,aAAa,WAAW;WACjD,aAAa;IACpB;;;;;;;;KAQC,cAAc,mBAAmB,uBAAuB,2BAA2B,cAAc,KAAK,wCAAwC,0BAA0B,mBAAmB,WAAW,YAAY,YAAY,mBAAmB,WAAW,YAAY,YAAY,MAAM,MAAM,OAAO,UAAU,SAAS,YAAY,iBAAiB,MAAM,oBAAoB,WAAW,mBAAmB,WAAW,uBAAuB;;;;cAIxa,UAAU;WACb,cAAc;aACZ;aACA;aACA,yCAAyC;aACzC;;WAEF,iBAAiB;aACf;aACA;aACA,yCAAyC;aACzC;;WAEF,aAAa;aACX;aACA;aACA,yCAAyC;aACzC;;WAEF,eAAe;aACb;aACA;aACA,yCAAyC;aACzC;;WAEF,iBAAiB;aACf;aACA;aACA,yCAAyC;aACzC;;WAEF,oBAAoB;aAClB;aACA;aACA,yCAAyC;aACzC;;WAEF,iBAAiB;aACf;aACA;aACA,yCAAyC;aACzC;;WAEF,iBAAiB;aACf,OAAO,WAAW;aAClB,QAAQ,WAAW;aACnB,yCAAyC;aACzC;;WAEF,qBAAqB;aACnB,OAAO;aACP,QAAQ;aACR,yCAAyC;aACzC;;WAEF,iBAAiB;aACf,0CAA0C;aAC1C,2CAA2C;aAC3C,yCAAyC;aACzC;;WAEF,mBAAmB;aACjB;aACA;aACA,yCAAyC;aACzC;;WAEF,yBAAyB;aACvB;aACA;aACA,yCAAyC;aACzC"}
@@ -1,6 +1,6 @@
1
1
  import { sqliteCreateNamespace } from "@prisma/orm-target-sqlite/target/control";
2
2
  import sqlitePackRef from "@prisma/orm-target-sqlite/target/pack";
3
- import { autoincrement, buildBoundContract, field, model, now, rel, sql } from "@prisma/orm-family-sql/contract-ts/contract-builder";
3
+ import { autoincrement, bindEnumType, buildBoundContract, field, member, model, now, rel, sql } from "@prisma/orm-family-sql/contract-ts/contract-builder";
4
4
  import sqlFamilyPack from "@prisma/orm-family-sql/family/pack";
5
5
  import { assembleDataTypes } from "@prisma/orm-framework/components/codec";
6
6
  import { assembleSqliteCodecRegistry } from "@prisma/orm-target-sqlite/target/codecs";
@@ -17,7 +17,9 @@ function defineContract(definition, factory) {
17
17
  if (factory !== void 0) return buildBoundContract(sqlFamilyPack, sqlitePackRef, bound, factory);
18
18
  return buildBoundContract(sqlFamilyPack, sqlitePackRef, bound);
19
19
  }
20
+ /** `enumType` bound to the pack's codec types, so each `member()` value is checked against the enum codec's input type. */
21
+ const enumType = bindEnumType();
20
22
  //#endregion
21
- export { autoincrement, defineContract, field, model, now, rel, sql };
23
+ export { autoincrement, defineContract, enumType, field, member, model, now, rel, sql };
22
24
 
23
25
  //# sourceMappingURL=contract-builder.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-builder.mjs","names":[],"sources":["../../../../3-extensions/sqlite/dist/contract-builder.mjs"],"sourcesContent":["import { sqliteCreateNamespace } from \"@internal/target-sqlite/control\";\nimport sqlitePackRef from \"@internal/target-sqlite/pack\";\nimport { autoincrement, buildBoundContract, field, model, now, rel, sql } from \"@internal/sql-contract-ts/contract-builder\";\nimport sqlFamilyPack from \"@internal/family-sql/pack\";\nimport { assembleDataTypes } from \"@internal/framework-components/codec\";\nimport { assembleSqliteCodecRegistry } from \"@internal/target-sqlite/codecs\";\n//#region src/contract/define-contract.ts\nconst target = sqlitePackRef;\nfunction defineContract(definition, factory) {\n\tconst extensionPacks = Object.values(definition.extensions ?? {});\n\tconst bound = {\n\t\t...definition,\n\t\tcreateNamespace: sqliteCreateNamespace,\n\t\tcodecLookup: definition.codecLookup ?? assembleSqliteCodecRegistry(target, extensionPacks),\n\t\tdataTypeLookup: definition.dataTypeLookup ?? assembleDataTypes([target, ...extensionPacks]).lookup\n\t};\n\tif (factory !== void 0) return buildBoundContract(sqlFamilyPack, sqlitePackRef, bound, factory);\n\treturn buildBoundContract(sqlFamilyPack, sqlitePackRef, bound);\n}\n//#endregion\nexport { autoincrement, defineContract, field, model, now, rel, sql };\n\n//# sourceMappingURL=contract-builder.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,SAAS;AACf,SAAS,eAAe,YAAY,SAAS;CAC5C,MAAM,iBAAiB,OAAO,OAAO,WAAW,cAAc,CAAC,CAAC;CAChE,MAAM,QAAQ;EACb,GAAG;EACH,iBAAiB;EACjB,aAAa,WAAW,eAAe,4BAA4B,QAAQ,cAAc;EACzF,gBAAgB,WAAW,kBAAkB,kBAAkB,CAAC,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC;CAC7F;CACA,IAAI,YAAY,KAAK,GAAG,OAAO,mBAAmB,eAAe,eAAe,OAAO,OAAO;CAC9F,OAAO,mBAAmB,eAAe,eAAe,KAAK;AAC9D"}
1
+ {"version":3,"file":"contract-builder.mjs","names":[],"sources":["../../../../3-extensions/sqlite/dist/contract-builder.mjs"],"sourcesContent":["import { sqliteCreateNamespace } from \"@internal/target-sqlite/control\";\nimport sqlitePackRef from \"@internal/target-sqlite/pack\";\nimport { autoincrement, bindEnumType, buildBoundContract, field, member, model, now, rel, sql } from \"@internal/sql-contract-ts/contract-builder\";\nimport sqlFamilyPack from \"@internal/family-sql/pack\";\nimport { assembleDataTypes } from \"@internal/framework-components/codec\";\nimport { assembleSqliteCodecRegistry } from \"@internal/target-sqlite/codecs\";\n//#region src/contract/define-contract.ts\nconst target = sqlitePackRef;\nfunction defineContract(definition, factory) {\n\tconst extensionPacks = Object.values(definition.extensions ?? {});\n\tconst bound = {\n\t\t...definition,\n\t\tcreateNamespace: sqliteCreateNamespace,\n\t\tcodecLookup: definition.codecLookup ?? assembleSqliteCodecRegistry(target, extensionPacks),\n\t\tdataTypeLookup: definition.dataTypeLookup ?? assembleDataTypes([target, ...extensionPacks]).lookup\n\t};\n\tif (factory !== void 0) return buildBoundContract(sqlFamilyPack, sqlitePackRef, bound, factory);\n\treturn buildBoundContract(sqlFamilyPack, sqlitePackRef, bound);\n}\n//#endregion\n//#region src/contract/enum-type.ts\n/** `enumType` bound to the pack's codec types, so each `member()` value is checked against the enum codec's input type. */\nconst enumType = bindEnumType();\n//#endregion\nexport { autoincrement, defineContract, enumType, field, member, model, now, rel, sql };\n\n//# sourceMappingURL=contract-builder.mjs.map"],"mappings":";;;;;;;AAOA,MAAM,SAAS;AACf,SAAS,eAAe,YAAY,SAAS;CAC5C,MAAM,iBAAiB,OAAO,OAAO,WAAW,cAAc,CAAC,CAAC;CAChE,MAAM,QAAQ;EACb,GAAG;EACH,iBAAiB;EACjB,aAAa,WAAW,eAAe,4BAA4B,QAAQ,cAAc;EACzF,gBAAgB,WAAW,kBAAkB,kBAAkB,CAAC,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC;CAC7F;CACA,IAAI,YAAY,KAAK,GAAG,OAAO,mBAAmB,eAAe,eAAe,OAAO,OAAO;CAC9F,OAAO,mBAAmB,eAAe,eAAe,KAAK;AAC9D;;AAIA,MAAM,WAAW,aAAa"}
package/dist/runtime.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as buildSqliteStaticContext } from "./sqlite-static-BRccXxAU-BfpSVO53.mjs";
1
+ import { t as buildSqliteStaticContext } from "./sqlite-static-CX2elTbu-CoM_gcs_.mjs";
2
2
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
3
3
  import sqliteAdapter from "@prisma/orm-target-sqlite/adapter/runtime";
4
4
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/sqlite/dist/runtime.mjs"],"sourcesContent":["import { t as buildSqliteStaticContext } from \"./sqlite-static-BRccXxAU.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport sqliteAdapter from \"@internal/adapter-sqlite/runtime\";\nimport sqliteDriver from \"@internal/driver-sqlite/runtime\";\nimport { instantiateExecutionStack } from \"@internal/framework-components/execution\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { sql } from \"@internal/sql-builder/runtime\";\nimport { orm, prepareQuery } from \"@internal/sql-orm-client\";\nimport { SqlRuntimeBase, createExecutionContext, createSqlExecutionStack, withTransaction } from \"@internal/sql-runtime\";\nimport sqliteTarget, { SqliteContractSerializer } from \"@internal/target-sqlite/runtime\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { blindCast, castAs } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/errors.ts\nfunction sqliteError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/runtime/binding.ts\nfunction resolveSqliteBinding(input) {\n\treturn {\n\t\tkind: \"path\",\n\t\tpath: input.path\n\t};\n}\nfunction resolveOptionalSqliteBinding(options) {\n\tif (options.path === void 0) return;\n\treturn {\n\t\tkind: \"path\",\n\t\tpath: options.path\n\t};\n}\n//#endregion\n//#region src/runtime/sqlite-runtime.ts\nvar SqliteRuntimeImpl = class extends SqlRuntimeBase {};\n//#endregion\n//#region src/runtime/sqlite.ts\nfunction unboundOrm(orm) {\n\tconst value = orm[UNBOUND_NAMESPACE_ID];\n\tassertDefined(value, \"the unbound namespace always exists on a sqlite builder output\");\n\treturn blindCast(value);\n}\nfunction resolveContract(options) {\n\tconst serializer = new SqliteContractSerializer();\n\tif (\"contractJson\" in options && options.contractJson !== void 0) return blindCast(serializer.deserializeContract(options.contractJson));\n\tconst contract = options.contract;\n\tassertDefined(contract, \"a contract or contractJson is required\");\n\treturn blindCast(serializer.deserializeContract(serializer.serializeContract(contract)));\n}\nfunction sqlite(options) {\n\tconst contract = resolveContract(options);\n\tlet binding = resolveOptionalSqliteBinding(options);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: sqliteTarget,\n\t\tadapter: sqliteAdapter,\n\t\tdriver: sqliteDriver,\n\t\textensions: options.extensions ?? []\n\t});\n\tconst context = createExecutionContext({\n\t\tcontract,\n\t\tstack,\n\t\tdriver: sqliteDriver\n\t});\n\tconst { sql: sql$1, raw: rawSqlTag, enums } = buildSqliteStaticContext(context, stack.adapter.rawCodecInferer);\n\tlet runtimeInstance;\n\tlet runtimeDriver;\n\tlet driverConnected = false;\n\tlet connectPromise;\n\tlet closePromise;\n\tlet backgroundConnectError;\n\tlet closed = false;\n\tlet ownedDispose;\n\tconst connectDriver = async (resolvedBinding) => {\n\t\tif (driverConnected) return;\n\t\tif (!runtimeDriver) throw new InternalError(\"SQLite runtime driver missing\");\n\t\tif (connectPromise) return connectPromise;\n\t\tconnectPromise = runtimeDriver.connect(resolvedBinding).then(() => {\n\t\t\tdriverConnected = true;\n\t\t}).catch((err) => {\n\t\t\tbackgroundConnectError = err;\n\t\t\tconnectPromise = void 0;\n\t\t\tthrow err;\n\t\t});\n\t\treturn connectPromise;\n\t};\n\tconst getRuntime = () => {\n\t\tif (closed) throw sqliteError(\"DRIVER.NOT_CONNECTED\", \"SQLite client is closed\", { meta: { extension: \"sqlite\" } });\n\t\tif (backgroundConnectError !== void 0) throw backgroundConnectError;\n\t\tif (runtimeInstance) return runtimeInstance;\n\t\tconst stackInstance = instantiateExecutionStack(stack);\n\t\tconst driverDescriptor = stack.driver;\n\t\tif (!driverDescriptor) throw new InternalError(\"Driver descriptor missing from execution stack\");\n\t\tconst driver = driverDescriptor.create();\n\t\townedDispose = () => driver.close();\n\t\truntimeDriver = driver;\n\t\tif (binding !== void 0) connectDriver(binding).catch(() => void 0);\n\t\truntimeInstance = new SqliteRuntimeImpl({\n\t\t\tcontext,\n\t\t\tadapter: stackInstance.adapter,\n\t\t\tdriver,\n\t\t\t...ifDefined(\"verifyMarker\", options.verifyMarker),\n\t\t\t...ifDefined(\"middleware\", options.middleware),\n\t\t\tcloseRefusal: \"at-once\"\n\t\t});\n\t\treturn runtimeInstance;\n\t};\n\tconst orm$1 = unboundOrm(orm({\n\t\tcontext,\n\t\truntime: {\n\t\t\tquery(plan) {\n\t\t\t\treturn getRuntime().query(plan);\n\t\t\t},\n\t\t\texecute(plan) {\n\t\t\t\treturn getRuntime().execute(plan);\n\t\t\t},\n\t\t\tconnection() {\n\t\t\t\treturn getRuntime().connection();\n\t\t\t}\n\t\t}\n\t}));\n\tfunction prepare(declaration, callback) {\n\t\treturn prepareQuery(getRuntime(), declaration, callback);\n\t}\n\treturn {\n\t\tsql: sql$1,\n\t\torm: orm$1,\n\t\tenums,\n\t\traw: rawSqlTag,\n\t\tcontext,\n\t\tcontract,\n\t\tstack,\n\t\tasync connect(bindingInput) {\n\t\t\tif (closed) throw sqliteError(\"DRIVER.NOT_CONNECTED\", \"SQLite client is closed\", { meta: { extension: \"sqlite\" } });\n\t\t\tif (driverConnected || connectPromise) throw sqliteError(\"DRIVER.ALREADY_CONNECTED\", \"SQLite client already connected\", { meta: { extension: \"sqlite\" } });\n\t\t\tbackgroundConnectError = void 0;\n\t\t\tif (bindingInput !== void 0) binding = resolveSqliteBinding(bindingInput);\n\t\t\tif (binding === void 0) throw sqliteError(\"RUNTIME.BINDING_MISSING\", \"SQLite binding not configured. Pass path to sqlite(...) or call db.connect({ path }).\", { meta: { extension: \"sqlite\" } });\n\t\t\tconst runtime = getRuntime();\n\t\t\tif (driverConnected) return runtime;\n\t\t\tawait connectDriver(binding);\n\t\t\treturn runtime;\n\t\t},\n\t\truntime() {\n\t\t\treturn getRuntime();\n\t\t},\n\t\tprepare,\n\t\ttransaction(fn) {\n\t\t\tlet runtime;\n\t\t\ttry {\n\t\t\t\truntime = getRuntime();\n\t\t\t} catch (err) {\n\t\t\t\treturn Promise.reject(err);\n\t\t\t}\n\t\t\treturn withTransaction(runtime, (txCtx) => {\n\t\t\t\tconst rawCodecInferer = stack.adapter.rawCodecInferer;\n\t\t\t\tconst txSqlNamespace = sql({\n\t\t\t\t\tcontext,\n\t\t\t\t\trawCodecInferer\n\t\t\t\t})[UNBOUND_NAMESPACE_ID];\n\t\t\t\tassertDefined(txSqlNamespace, \"the unbound namespace always exists on a sqlite builder output\");\n\t\t\t\tconst txSql = blindCast(txSqlNamespace);\n\t\t\t\tconst txOrm = unboundOrm(orm({\n\t\t\t\t\truntime: {\n\t\t\t\t\t\tquery(plan) {\n\t\t\t\t\t\t\treturn txCtx.query(plan);\n\t\t\t\t\t\t},\n\t\t\t\t\t\texecute(plan) {\n\t\t\t\t\t\t\treturn txCtx.execute(plan);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tcontext\n\t\t\t\t}));\n\t\t\t\treturn fn(Object.assign(castAs(Object.create(txCtx)), {\n\t\t\t\t\tsql: txSql,\n\t\t\t\t\torm: txOrm,\n\t\t\t\t\tenums\n\t\t\t\t}));\n\t\t\t});\n\t\t},\n\t\tclose() {\n\t\t\tif (closePromise) return closePromise;\n\t\t\tclosed = true;\n\t\t\tclosePromise = (async () => {\n\t\t\t\tawait connectPromise?.catch(() => void 0);\n\t\t\t\tawait ownedDispose?.();\n\t\t\t})();\n\t\t\treturn closePromise;\n\t\t},\n\t\t[Symbol.asyncDispose]() {\n\t\t\treturn this.close();\n\t\t}\n\t};\n}\n//#endregion\nexport { SqliteRuntimeImpl, sqlite as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,YAAY,MAAM,SAAS,SAAS;CAC5C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AAGA,SAAS,qBAAqB,OAAO;CACpC,OAAO;EACN,MAAM;EACN,MAAM,MAAM;CACb;AACD;AACA,SAAS,6BAA6B,SAAS;CAC9C,IAAI,QAAQ,SAAS,KAAK,GAAG;CAC7B,OAAO;EACN,MAAM;EACN,MAAM,QAAQ;CACf;AACD;AAGA,IAAI,oBAAoB,cAAc,eAAe,CAAC;AAGtD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AG,MAAM,YAAY,2BAA2B,yFAAyF,EAAE,MAAM,EAAE,WAAW,SAAS,EAAE,CAAC;GAC/L,MAAM,UAAU,WAAW;GAC3B,IAAI,iBAAiB,OAAO;GAC5B,MAAM,cAAc,OAAO;GAC3B,OAAO;EACR;EACA,UAAU;GACT,OAAO,WAAW;EACnB;EACA;EACA,YAAY,IAAI;GACf,IAAI;GACJ,IAAI;IACH,UAAU,WAAW;GACtB,SAAS,KAAK;IACb,OAAO,QAAQ,OAAO,GAAG;GAC1B;GACA,OAAO,gBAAgB,UAAU,UAAU;IAC1C,MAAM,kBAAkB,MAAM,QAAQ;IACtC,MAAM,iBAAiB,IAAI;KAC1B;KACA;IACD,CAAC,CAAC,CAAC;IACH,cAAc,gBAAgB,gEAAgE;IAC9F,MAAM,QAAQ,UAAU,cAAc;IACtC,MAAM,QAAQ,WAAW,IAAI;KAC5B,SAAS;MACR,MAAM,MAAM;OACX,OAAO,MAAM,MAAM,IAAI;MACxB;MACA,QAAQ,MAAM;OACb,OAAO,MAAM,QAAQ,IAAI;MAC1B;KACD;KACA;IACD,CAAC,CAAC;IACF,OAAO,GAAG,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,CAAC,GAAG;KACrD,KAAK;KACL,KAAK;KACL;IACD,CAAC,CAAC;GACH,CAAC;EACF;EACA,QAAQ;GACP,IAAI,cAAc,OAAO;GACzB,SAAS;GACT,gBAAgB,YAAY;IAC3B,MAAM,gBAAgB,YAAY,KAAK,CAAC;IACxC,MAAM,eAAe;GACtB,EAAA,CAAG;GACH,OAAO;EACR;EACA,CAAC,OAAO,gBAAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
1
+ {"version":3,"file":"runtime.mjs","names":[],"sources":["../../../../3-extensions/sqlite/dist/runtime.mjs"],"sourcesContent":["import { t as buildSqliteStaticContext } from \"./sqlite-static-CX2elTbu.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport sqliteAdapter from \"@internal/adapter-sqlite/runtime\";\nimport sqliteDriver from \"@internal/driver-sqlite/runtime\";\nimport { instantiateExecutionStack } from \"@internal/framework-components/execution\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { sql } from \"@internal/sql-builder/runtime\";\nimport { orm, prepareQuery } from \"@internal/sql-orm-client\";\nimport { SqlRuntimeBase, createExecutionContext, createSqlExecutionStack, withTransaction } from \"@internal/sql-runtime\";\nimport sqliteTarget, { SqliteContractSerializer } from \"@internal/target-sqlite/runtime\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { blindCast, castAs } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/errors.ts\nfunction sqliteError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/runtime/binding.ts\nfunction resolveSqliteBinding(input) {\n\treturn {\n\t\tkind: \"path\",\n\t\tpath: input.path\n\t};\n}\nfunction resolveOptionalSqliteBinding(options) {\n\tif (options.path === void 0) return;\n\treturn {\n\t\tkind: \"path\",\n\t\tpath: options.path\n\t};\n}\n//#endregion\n//#region src/runtime/sqlite-runtime.ts\nvar SqliteRuntimeImpl = class extends SqlRuntimeBase {};\n//#endregion\n//#region src/runtime/sqlite.ts\nfunction unboundOrm(orm) {\n\tconst value = orm[UNBOUND_NAMESPACE_ID];\n\tassertDefined(value, \"the unbound namespace always exists on a sqlite builder output\");\n\treturn blindCast(value);\n}\nfunction resolveContract(options) {\n\tconst serializer = new SqliteContractSerializer();\n\tif (\"contractJson\" in options && options.contractJson !== void 0) return blindCast(serializer.deserializeContract(options.contractJson));\n\tconst contract = options.contract;\n\tassertDefined(contract, \"a contract or contractJson is required\");\n\treturn blindCast(serializer.deserializeContract(serializer.serializeContract(contract)));\n}\nfunction sqlite(options) {\n\tconst contract = resolveContract(options);\n\tlet binding = resolveOptionalSqliteBinding(options);\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: sqliteTarget,\n\t\tadapter: sqliteAdapter,\n\t\tdriver: sqliteDriver,\n\t\textensions: options.extensions ?? []\n\t});\n\tconst context = createExecutionContext({\n\t\tcontract,\n\t\tstack,\n\t\tdriver: sqliteDriver\n\t});\n\tconst { sql: sql$1, raw: rawSqlTag, enums } = buildSqliteStaticContext(context, stack.adapter.rawCodecInferer);\n\tlet runtimeInstance;\n\tlet runtimeDriver;\n\tlet driverConnected = false;\n\tlet connectPromise;\n\tlet closePromise;\n\tlet backgroundConnectError;\n\tlet closed = false;\n\tlet ownedDispose;\n\tconst connectDriver = async (resolvedBinding) => {\n\t\tif (driverConnected) return;\n\t\tif (!runtimeDriver) throw new InternalError(\"SQLite runtime driver missing\");\n\t\tif (connectPromise) return connectPromise;\n\t\tconnectPromise = runtimeDriver.connect(resolvedBinding).then(() => {\n\t\t\tdriverConnected = true;\n\t\t}).catch((err) => {\n\t\t\tbackgroundConnectError = err;\n\t\t\tconnectPromise = void 0;\n\t\t\tthrow err;\n\t\t});\n\t\treturn connectPromise;\n\t};\n\tconst getRuntime = () => {\n\t\tif (closed) throw sqliteError(\"DRIVER.NOT_CONNECTED\", \"SQLite client is closed\", { meta: { extension: \"sqlite\" } });\n\t\tif (backgroundConnectError !== void 0) throw backgroundConnectError;\n\t\tif (runtimeInstance) return runtimeInstance;\n\t\tconst stackInstance = instantiateExecutionStack(stack);\n\t\tconst driverDescriptor = stack.driver;\n\t\tif (!driverDescriptor) throw new InternalError(\"Driver descriptor missing from execution stack\");\n\t\tconst driver = driverDescriptor.create();\n\t\townedDispose = () => driver.close();\n\t\truntimeDriver = driver;\n\t\tif (binding !== void 0) connectDriver(binding).catch(() => void 0);\n\t\truntimeInstance = new SqliteRuntimeImpl({\n\t\t\tcontext,\n\t\t\tadapter: stackInstance.adapter,\n\t\t\tdriver,\n\t\t\t...ifDefined(\"verifyMarker\", options.verifyMarker),\n\t\t\t...ifDefined(\"middleware\", options.middleware),\n\t\t\tcloseRefusal: \"at-once\"\n\t\t});\n\t\treturn runtimeInstance;\n\t};\n\tconst orm$1 = unboundOrm(orm({\n\t\tcontext,\n\t\truntime: {\n\t\t\tquery(plan) {\n\t\t\t\treturn getRuntime().query(plan);\n\t\t\t},\n\t\t\texecute(plan) {\n\t\t\t\treturn getRuntime().execute(plan);\n\t\t\t},\n\t\t\tconnection() {\n\t\t\t\treturn getRuntime().connection();\n\t\t\t}\n\t\t}\n\t}));\n\tfunction prepare(declaration, callback) {\n\t\treturn prepareQuery(getRuntime(), declaration, callback);\n\t}\n\treturn {\n\t\tsql: sql$1,\n\t\torm: orm$1,\n\t\tenums,\n\t\traw: rawSqlTag,\n\t\tcontext,\n\t\tcontract,\n\t\tstack,\n\t\tasync connect(bindingInput) {\n\t\t\tif (closed) throw sqliteError(\"DRIVER.NOT_CONNECTED\", \"SQLite client is closed\", { meta: { extension: \"sqlite\" } });\n\t\t\tif (driverConnected || connectPromise) throw sqliteError(\"DRIVER.ALREADY_CONNECTED\", \"SQLite client already connected\", { meta: { extension: \"sqlite\" } });\n\t\t\tbackgroundConnectError = void 0;\n\t\t\tif (bindingInput !== void 0) binding = resolveSqliteBinding(bindingInput);\n\t\t\tif (binding === void 0) throw sqliteError(\"RUNTIME.BINDING_MISSING\", \"SQLite binding not configured. Pass path to sqlite(...) or call db.connect({ path }).\", { meta: { extension: \"sqlite\" } });\n\t\t\tconst runtime = getRuntime();\n\t\t\tif (driverConnected) return runtime;\n\t\t\tawait connectDriver(binding);\n\t\t\treturn runtime;\n\t\t},\n\t\truntime() {\n\t\t\treturn getRuntime();\n\t\t},\n\t\tprepare,\n\t\ttransaction(fn) {\n\t\t\tlet runtime;\n\t\t\ttry {\n\t\t\t\truntime = getRuntime();\n\t\t\t} catch (err) {\n\t\t\t\treturn Promise.reject(err);\n\t\t\t}\n\t\t\treturn withTransaction(runtime, (txCtx) => {\n\t\t\t\tconst rawCodecInferer = stack.adapter.rawCodecInferer;\n\t\t\t\tconst txSqlNamespace = sql({\n\t\t\t\t\tcontext,\n\t\t\t\t\trawCodecInferer\n\t\t\t\t})[UNBOUND_NAMESPACE_ID];\n\t\t\t\tassertDefined(txSqlNamespace, \"the unbound namespace always exists on a sqlite builder output\");\n\t\t\t\tconst txSql = blindCast(txSqlNamespace);\n\t\t\t\tconst txOrm = unboundOrm(orm({\n\t\t\t\t\truntime: {\n\t\t\t\t\t\tquery(plan) {\n\t\t\t\t\t\t\treturn txCtx.query(plan);\n\t\t\t\t\t\t},\n\t\t\t\t\t\texecute(plan) {\n\t\t\t\t\t\t\treturn txCtx.execute(plan);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tcontext\n\t\t\t\t}));\n\t\t\t\treturn fn(Object.assign(castAs(Object.create(txCtx)), {\n\t\t\t\t\tsql: txSql,\n\t\t\t\t\torm: txOrm,\n\t\t\t\t\tenums\n\t\t\t\t}));\n\t\t\t});\n\t\t},\n\t\tclose() {\n\t\t\tif (closePromise) return closePromise;\n\t\t\tclosed = true;\n\t\t\tclosePromise = (async () => {\n\t\t\t\tawait connectPromise?.catch(() => void 0);\n\t\t\t\tawait ownedDispose?.();\n\t\t\t})();\n\t\t\treturn closePromise;\n\t\t},\n\t\t[Symbol.asyncDispose]() {\n\t\t\treturn this.close();\n\t\t}\n\t};\n}\n//#endregion\nexport { SqliteRuntimeImpl, sqlite as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,YAAY,MAAM,SAAS,SAAS;CAC5C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AAGA,SAAS,qBAAqB,OAAO;CACpC,OAAO;EACN,MAAM;EACN,MAAM,MAAM;CACb;AACD;AACA,SAAS,6BAA6B,SAAS;CAC9C,IAAI,QAAQ,SAAS,KAAK,GAAG;CAC7B,OAAO;EACN,MAAM;EACN,MAAM,QAAQ;CACf;AACD;AAGA,IAAI,oBAAoB,cAAc,eAAe,CAAC;AAGtD,SAAS,WAAW,KAAK;CACxB,MAAM,QAAQ,IAAI;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EAAE,WAAW,SAAS,EAAE,CAAC;GAC/L,MAAM,UAAU,WAAW;GAC3B,IAAI,iBAAiB,OAAO;GAC5B,MAAM,cAAc,OAAO;GAC3B,OAAO;EACR;EACA,UAAU;GACT,OAAO,WAAW;EACnB;EACA;EACA,YAAY,IAAI;GACf,IAAI;GACJ,IAAI;IACH,UAAU,WAAW;GACtB,SAAS,KAAK;IACb,OAAO,QAAQ,OAAO,GAAG;GAC1B;GACA,OAAO,gBAAgB,UAAU,UAAU;IAC1C,MAAM,kBAAkB,MAAM,QAAQ;IACtC,MAAM,iBAAiB,IAAI;KAC1B;KACA;IACD,CAAC,CAAC,CAAC;IACH,cAAc,gBAAgB,gEAAgE;IAC9F,MAAM,QAAQ,UAAU,cAAc;IACtC,MAAM,QAAQ,WAAW,IAAI;KAC5B,SAAS;MACR,MAAM,MAAM;OACX,OAAO,MAAM,MAAM,IAAI;MACxB;MACA,QAAQ,MAAM;OACb,OAAO,MAAM,QAAQ,IAAI;MAC1B;KACD;KACA;IACD,CAAC,CAAC;IACF,OAAO,GAAG,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,CAAC,GAAG;KACrD,KAAK;KACL,KAAK;KACL;IACD,CAAC,CAAC;GACH,CAAC;EACF;EACA,QAAQ;GACP,IAAI,cAAc,OAAO;GACzB,SAAS;GACT,gBAAgB,YAAY;IAC3B,MAAM,gBAAgB,YAAY,KAAK,CAAC;IACxC,MAAM,eAAe;GACtB,EAAA,CAAG;GACH,OAAO;EACR;EACA,CAAC,OAAO,gBAAgB;GACvB,OAAO,KAAK,MAAM;EACnB;CACD;AACD"}
@@ -6,7 +6,7 @@ import sqliteTarget, { SqliteContractSerializer } from "@prisma/orm-target-sqlit
6
6
  import { assertDefined } from "@prisma/orm-framework/utils/assertions";
7
7
  import { blindCast } from "@prisma/orm-framework/utils/casts";
8
8
  import { buildNamespacedEnums } from "@prisma/orm-framework/contract/enum-accessor";
9
- //#region ../../../3-extensions/sqlite/dist/sqlite-static-BRccXxAU.mjs
9
+ //#region ../../../3-extensions/sqlite/dist/sqlite-static-CX2elTbu.mjs
10
10
  function buildSqliteStaticContext(context, rawCodecInferer) {
11
11
  const sqlNamespace = sql({
12
12
  context,
@@ -18,7 +18,7 @@ function buildSqliteStaticContext(context, rawCodecInferer) {
18
18
  context,
19
19
  rawCodecInferer
20
20
  });
21
- const enums = Object.freeze(buildNamespacedEnums(context.contract.domain))[UNBOUND_NAMESPACE_ID];
21
+ const enums = Object.freeze(buildNamespacedEnums(context.contract.domain, (codecId) => context.contractCodecs.forCodecRef({ codecId })))[UNBOUND_NAMESPACE_ID];
22
22
  assertDefined(enums, "the unbound namespace always exists on a sqlite builder output");
23
23
  return {
24
24
  context,
@@ -43,4 +43,4 @@ function sqliteStatic(options) {
43
43
  //#endregion
44
44
  export { sqliteStatic as n, buildSqliteStaticContext as t };
45
45
 
46
- //# sourceMappingURL=sqlite-static-BRccXxAU-BfpSVO53.mjs.map
46
+ //# sourceMappingURL=sqlite-static-CX2elTbu-CoM_gcs_.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite-static-CX2elTbu-CoM_gcs_.mjs","names":[],"sources":["../../../../3-extensions/sqlite/dist/sqlite-static-CX2elTbu.mjs"],"sourcesContent":["import sqliteAdapter from \"@internal/adapter-sqlite/runtime\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { createRawLane, sql } from \"@internal/sql-builder/runtime\";\nimport { createExecutionContext, createSqlExecutionStack } from \"@internal/sql-runtime\";\nimport sqliteTarget, { SqliteContractSerializer } from \"@internal/target-sqlite/runtime\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { buildNamespacedEnums } from \"@internal/contract/enum-accessor\";\n//#region src/static/sqlite-static.ts\nfunction buildSqliteStaticContext(context, rawCodecInferer) {\n\tconst sqlNamespace = sql({\n\t\tcontext,\n\t\trawCodecInferer\n\t})[UNBOUND_NAMESPACE_ID];\n\tassertDefined(sqlNamespace, \"the unbound namespace always exists on a sqlite builder output\");\n\tconst sqlDb = blindCast(sqlNamespace);\n\tconst raw = createRawLane({\n\t\tcontext,\n\t\trawCodecInferer\n\t});\n\tconst enums = Object.freeze(buildNamespacedEnums(context.contract.domain, (codecId) => context.contractCodecs.forCodecRef({ codecId })))[UNBOUND_NAMESPACE_ID];\n\tassertDefined(enums, \"the unbound namespace always exists on a sqlite builder output\");\n\treturn {\n\t\tcontext,\n\t\tcontract: context.contract,\n\t\tenums,\n\t\tsql: sqlDb,\n\t\traw\n\t};\n}\nfunction sqliteStatic(options) {\n\tconst contract = blindCast(new SqliteContractSerializer().deserializeContract(options.contractJson));\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: sqliteTarget,\n\t\tadapter: sqliteAdapter,\n\t\textensions: options.extensions ?? []\n\t});\n\treturn buildSqliteStaticContext(createExecutionContext({\n\t\tcontract,\n\t\tstack\n\t}), stack.adapter.rawCodecInferer);\n}\n//#endregion\nexport { sqliteStatic as n, buildSqliteStaticContext as t };\n\n//# sourceMappingURL=sqlite-static-CX2elTbu.mjs.map"],"mappings":";;;;;;;;;AASA,SAAS,yBAAyB,SAAS,iBAAiB;CAC3D,MAAM,eAAe,IAAI;EACxB;EACA;CACD,CAAC,CAAC,CAAC;CACH,cAAc,cAAc,gEAAgE;CAC5F,MAAM,QAAQ,UAAU,YAAY;CACpC,MAAM,MAAM,cAAc;EACzB;EACA;CACD,CAAC;CACD,MAAM,QAAQ,OAAO,OAAO,qBAAqB,QAAQ,SAAS,SAAS,YAAY,QAAQ,eAAe,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;CACzI,cAAc,OAAO,gEAAgE;CACrF,OAAO;EACN;EACA,UAAU,QAAQ;EAClB;EACA,KAAK;EACL;CACD;AACD;AACA,SAAS,aAAa,SAAS;CAC9B,MAAM,WAAW,UAAU,IAAI,yBAAyB,CAAC,CAAC,oBAAoB,QAAQ,YAAY,CAAC;CACnG,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,OAAO,yBAAyB,uBAAuB;EACtD;EACA;CACD,CAAC,GAAG,MAAM,QAAQ,eAAe;AAClC"}
package/dist/static.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as sqliteStatic } from "./sqlite-static-BRccXxAU-BfpSVO53.mjs";
1
+ import { n as sqliteStatic } from "./sqlite-static-CX2elTbu-CoM_gcs_.mjs";
2
2
  export { sqliteStatic as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-sqlite",
3
- "version": "8.0.0-rc.16-dev.5",
3
+ "version": "8.0.0-rc.16-dev.7",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -10,17 +10,17 @@
10
10
  "skills"
11
11
  ],
12
12
  "dependencies": {
13
- "@prisma/orm-family-sql": "8.0.0-rc.16-dev.5",
14
- "@prisma/orm-framework": "8.0.0-rc.16-dev.5",
15
- "@prisma/orm-target-sqlite": "8.0.0-rc.16-dev.5",
16
- "@prisma/orm-toolchain": "8.0.0-rc.16-dev.5",
13
+ "@prisma/orm-family-sql": "8.0.0-rc.16-dev.7",
14
+ "@prisma/orm-framework": "8.0.0-rc.16-dev.7",
15
+ "@prisma/orm-target-sqlite": "8.0.0-rc.16-dev.7",
16
+ "@prisma/orm-toolchain": "8.0.0-rc.16-dev.7",
17
17
  "pathe": "^2.0.3",
18
18
  "tinyglobby": "^0.2.17"
19
19
  },
20
20
  "devDependencies": {
21
- "@internal/sqlite": "8.0.0-rc.16-dev.5",
22
- "@repo/tsconfig": "8.0.0-rc.16-dev.5",
23
- "@repo/tsdown": "8.0.0-rc.16-dev.5",
21
+ "@internal/sqlite": "8.0.0-rc.16-dev.7",
22
+ "@repo/tsconfig": "8.0.0-rc.16-dev.7",
23
+ "@repo/tsdown": "8.0.0-rc.16-dev.7",
24
24
  "tsdown": "0.22.14",
25
25
  "typescript": "5.9.3"
26
26
  },
@@ -15,7 +15,7 @@ description: >-
15
15
  ORM 7 or earlier (schema.prisma + @prisma/client).
16
16
  metadata:
17
17
  library: '@prisma/orm-sqlite'
18
- library_version: '8.0.0-rc.16-dev.5'
18
+ library_version: '8.0.0-rc.16-dev.7'
19
19
  version: '2026-09-12'
20
20
  ---
21
21
 
@@ -301,6 +301,12 @@ model User {
301
301
  }
302
302
  ```
303
303
 
304
+ **Reading members at runtime (`db.enums`).** `db.enums.<namespace>.<Enum>` on Postgres, and `db.enums.<Enum>` on SQLite and Mongo, holds each member as a query returns it: a `pg/int8@1` member written `Low = "1"` is `1n`, a date or timestamp member is the `Date` or Temporal value its codec reads, and a float member written `"NaN"` is `NaN`. So `db.enums.public.Level.members.Low === row.level` holds wherever `===` applies. `has(value)`, `nameOf(value)` and `ordinalOf(value)` find a value equal to a member: a string, number or bigint must be the member itself, and an object such as a `Date` must be of the member's kind and stored as the member is, so a date equal to a member matches although it is a different object. Text a codec would normalize, such as an upper-case uuid, is no member. Each read of a mutable member, such as a `Date` or a `Uint8Array`, returns a fresh copy, so changing it does not change the enum; a Temporal member is immutable and is the same value on every read. An enum's members are decoded when the enum is first read, so a client builds without `Temporal` even when its contract has a Temporal enum. `contract.d.ts` types each member as that same value. The rule behind this: the value a codec reads from the contract's stored form equals the value a query returns for it. The stored form itself can differ from the text the database prints, such as ISO 8601 for a timestamp.
305
+
306
+ **Codecs an enum cannot use.** An enum compares values with its members, so a codec whose values cannot be compared for equality, or whose values read back never equal a member as the contract stores it, is refused, in TypeScript with `CONTRACT.ENUM_INVALID` and in PSL with `PSL_EXTENSION_INVALID_VALUE` at the `@@type`. The message says why and what to use instead. On Postgres: `pg/timestamp-string@1` and `pg/timestamptz-string@1` (use `pg/timestamp-temporal@1` or `pg/timestamptz-temporal@1`), `pg/json@1` (use `pg/jsonb@1`), and `pg/bytea@1` and `pg/tsquery@1`, for which no enum is possible (use a text enum).
307
+
308
+ **Mongo enums.** A Mongo PSL contract's collection validator lists each enum's members in their stored JSON forms, so a PSL enum needs a codec whose BSON type JSON holds: string, int, double, bool, object or array, with finite numbers for doubles. An enum over `mongo/int64@1`, `mongo/date@1` or `mongo/objectId@1` is refused with `PSL_EXTENSION_INVALID_VALUE`. A TypeScript Mongo contract has no collection validator and accepts these enums.
309
+
304
310
  **Waiving enforcement (`@noCheck`).** A field can decline the generated CHECK constraints for its column: bare `@noCheck` waives every kind the column's shape derives; `@noCheck(membership)` and `@noCheck(elementNotNull)` waive one kind (`membership` is the enum value-set check; `elementNotNull` is the no-NULL-elements check every list column gets). The TS authoring equivalent is `.noCheck(...)` on the field builder. Declared types do not change: the field still types as the enum union, and a list still types with non-null elements — once enforcement is waived, runtime values may diverge from what the types claim. That divergence is the author's accepted risk, and it is scoped to the kinds actually waived: waiving `membership` stops the database rejecting out-of-set values, waiving `elementNotNull` stops it rejecting NULL elements. A list that waives only `membership` still rejects NULL elements. `contract infer` emits `@noCheck(elementNotNull)` automatically for list columns whose source database does not carry the generated check.
305
311
 
306
312
  Canonical worked example: `examples/prisma-8-demo/src/prisma/contract.prisma`.
@@ -427,11 +433,11 @@ Infer captures indexes at full fidelity — expression, partial (`where:`), uniq
427
433
  4. **Reaching into internal packages from user code.** User-authored files (`prisma.config.ts`, `contract.ts`, `db.ts`, control clients) import only from `@internal/<target>/<subpath>` and `@internal/extension-<name>/<subpath>`. Imports from `@internal/cli/*`, `@internal/family-*`, `@internal/target-*`, `@internal/adapter-*`, `@internal/driver-*`, or `@internal/sql-contract-*` are framework-internal — the façade composes them for you. If a façade subpath you need is missing for your target, see *What Prisma 8 doesn't do yet* and route to `references/feedback.md`. The canonical worked examples are `examples/multi-extension-monorepo/app/prisma.config.ts` and `examples/prisma-8-postgis-demo/prisma.config.ts`.
428
434
  5. **Confusing the config `extensions` with the TS builder's `extensions`.** Same packs, two surfaces, one field name but two shapes: `ormConfig({ extensions: [pgvector] })` (array of *control* descriptors from `@internal/extension-<name>/control`) versus `defineContract({ extensions: { pgvector } })` (record of *pack* descriptors from `@internal/extension-<name>/pack`).
429
435
  6. **Writing a flat `prisma.config.ts`.** `export default defineConfig({ contract, extensions })` from the target config alone is the pre-rc.4 shape and fails with `CONFIG.VERSION_MARKER_MISSING`. Wrap it: `definePrismaConfig({ orm: ormConfig({...}) })`.
430
- 7. **Renaming a field and expecting the planner to detect it.** Prisma 8 has no in-contract rename hint; the planner sees a destructive drop+add. Hand-edit `migration.ts` after `migration plan` (see `references/migrations.md`), or use the keep-then-drop two-migration pattern.
436
+ 7. **Renaming a model or field and expecting the planner to detect it.** The contract does not record renames, so the planner sees a destructive drop+add. State the rename on the command line with `--rename old:new` on `migration plan` or `db update` (see `references/migrations.md`); the planner then renames instead of dropping. Do not invent a rename attribute in the contract source.
431
437
 
432
438
  ## What Prisma 8 doesn't do yet
433
439
 
434
- - **In-contract rename hint.** No `@@rename(old: ..., new: ...)` or similar. Use the workarounds in *Common Pitfalls* #7. To request first-class rename, file via `references/feedback.md`.
440
+ - **In-contract rename hint.** No `@@rename(old: ..., new: ...)` or similar; renames are stated with `--rename` on the command line, as in *Common Pitfalls* #7.
435
441
  - **Model validations.** No declarative `@validates(...)` surface. Validate in application code (arktype). To request declarative validations in the contract, file via `references/feedback.md`.
436
442
  - **Lifecycle callbacks** (`beforeSave`, `afterCreate`, etc.). Not supported. Use middleware (`references/runtime.md`) or app code. To request lifecycle callbacks, file via `references/feedback.md`.
437
443
  - **Soft delete / `paranoid: true`.** No built-in soft-delete column. Add a nullable `deletedAt DateTime?` and filter explicitly in queries (or in middleware). To request built-in soft delete, file via `references/feedback.md`.
@@ -454,8 +460,8 @@ Infer captures indexes at full fidelity — expression, partial (`where:`), uniq
454
460
  - [ ] Edited the contract source (`contract.prisma` or `contract.ts`), not an emitted artefact.
455
461
  - [ ] For new extension namespaces: added the package, imported its control descriptor (`@internal/extension-<name>/control`), added it to `extensions: [...]` in `ormConfig({...})` (and the matching pack descriptor to `defineContract({extensions: {...}})` if using the TS builder).
456
462
  - [ ] `prisma.config.ts` is the envelope form — `definePrismaConfig({ orm: ormConfig({...}) })` — not a flat `defineConfig({...})`.
457
- - [ ] For renames: hand-edited `migration.ts` after `migration plan` (or used the keep-then-drop two-migration pattern) — Prisma 8 has no rename hint today.
463
+ - [ ] For renames: passed `--rename old:new` to `migration plan` or `db update` (or hand-edited `migration.ts` where statements do not cover the rename).
458
464
  - [ ] Ran `pnpm prisma contract emit` after the edit (or let the Vite plugin re-emit on save).
459
465
  - [ ] Confirmed `contract.json` and `contract.d.ts` updated next to the source.
460
466
  - [ ] Did **not** hand-edit `contract.json` / `contract.d.ts`.
461
- - [ ] Did **not** confabulate a missing feature (validations, callbacks, soft delete, scopes, in-contract rename hint) — referred the user to *What Prisma 8 doesn't do yet* + `references/feedback.md`.
467
+ - [ ] Did **not** confabulate a missing feature (validations, callbacks, soft delete, scopes, a rename attribute in the contract source) — referred the user to *What Prisma 8 doesn't do yet* + `references/feedback.md`.
@@ -74,6 +74,9 @@ Treat the rendered import lines as framework-managed on both targets:
74
74
  | `MIGRATION.DESTRUCTIVE_CHANGES` | `db update` run non-interactively without consent | Re-run with `--confirm <database>` (the database name from the connection), or `--dry-run` to preview. |
75
75
  | `CONTRACT.MARKER_MISMATCH` | `db verify` (finding, exit 4) | The marker disagrees with the contract hash (**Postgres:** `prisma_contract.marker`; **Mongo:** `_prisma_migrations`). The DB is at a different contract version than the code thinks. Either run a migration forward, or — if the DB is correct and the marker is stale after a manual fix-up — run `db sign`. |
76
76
  | `CONTRACT.MARKER_MISSING` | `db verify` (finding, exit 4), runtime startup (warning) | The DB has no marker yet. Run `prisma db init --db <url>` to baseline an empty database, `db update --db <url>` to apply the current contract directly, or `db sign --db <url>` if the schema already matches the contract. |
77
+ | `MIGRATION.STATEMENT_INVALID` | `migration plan` / `db update` with `--rename` | The statement is malformed, mixes a model and a field, renames something to itself, swaps two names, or repeats a name. The error's next step is the statement to type instead; use it. |
78
+ | `MIGRATION.STATEMENT_UNRESOLVED` | `migration plan` / `db update` with `--rename` | A name is not where a rename needs it. The error lists the names it found and says what to type: the statement the right way round, the order that works, or to leave out a rename that has already happened. |
79
+ | `MIGRATION.STATEMENT_ORIGIN_UNKNOWN` | `db update --rename` | `db update` has no snapshot of the contract the database is at. Follow the error's steps: emit that contract, run `db update --advance-ref <name> --dry-run` and check it plans no operations, then run it without `--dry-run` to store its snapshot, then emit the new contract and run the rename. Do not drop the statements to get past it: without them the plan drops the renamed table with its rows. |
77
80
 
78
81
  ## Decision — which path do you take?
79
82
 
@@ -359,7 +362,7 @@ On Postgres the operations are **methods on the `Migration` base class**, each t
359
362
  **Postgres** operations (representative set, all `this.<name>({...})`):
360
363
 
361
364
  - Tables: `createTable`, `renameTable`, `dropTable`. `renameTable` reads the migration's start and end contracts and returns the table rename plus a rename of every constraint and index named after the old table, so spread it: `...this.renameTable({ table: 'userProfile', to: 'UserProfile' })`.
362
- - Columns: `addColumn` (`column: col(name, nativeType, { codecRef })`), `dropColumn`, `alterColumnType`, `setNotNull`, `dropNotNull`, `setDefault` (`column: col(name, nativeType, { default: lit(value) or fn(expression), codecRef })`; `fn('autoincrement()')` on a smallint, integer or bigint column creates or reuses the `{table}_{column}_seq` sequence, attaches it, and starts it past the column's largest value), `dropDefault`.
365
+ - Columns: `addColumn` (`column: col(name, nativeType, { codecRef })`), `renameColumn` (also renames the constraints and indexes named after the column, so spread it: `...this.renameColumn({ table: 'User', column: 'email', to: 'emailAddress' })`), `dropColumn`, `alterColumnType`, `setNotNull`, `dropNotNull`, `setDefault` (`column: col(name, nativeType, { default: lit(value) or fn(expression), codecRef })`; `fn('autoincrement()')` on a smallint, integer or bigint column creates or reuses the `{table}_{column}_seq` sequence, attaches it, and starts it past the column's largest value), `dropDefault`.
363
366
  - Constraints: `addPrimaryKey`, `addForeignKey`, `addUnique`, `addCheckConstraint`, `renameConstraint` (`kind`: `primaryKey`, `unique`, `foreignKey` or `checkConstraint`), `renameCheckConstraint`, `dropCheckConstraint`, `dropConstraint`.
364
367
  - Indexes: `createIndex`, `renameIndex`, `dropIndex`.
365
368
  - Enums: `createNativeEnumType`, `addNativeEnumValue`, `dropNativeEnumType`.
@@ -494,7 +497,7 @@ Interactively, consent is typing the database name back (the prompt names it). I
494
497
  6. **Aggregate `check` closure in Postgres `this.dataTransform`.** Returning `count(*)` or `bool_and(...)` breaks the precheck/postcheck contract — both sides resolve to constants. Use a rowset shape: `select('id').where(<violation>).limit(1)`.
495
498
  7. **Two contract references in one migration.** Building a query plan against a different contract than the one passed to `this.dataTransform(endContract, ...)` raises `MIGRATION.DATA_TRANSFORM_CONTRACT_MISMATCH`. Always import `endContract` once at module scope and use the same reference.
496
499
  11. **Calling Postgres operations as free functions.** `addColumn('public', 'user', {...})` does not exist as an import; the operations are `this.addColumn({ schema, table, column })` and friends on the `Migration` base class, with `col(...)` building the column. Only `col`, `rawSql`, `placeholder`, `Migration`, and `MigrationCLI` are imported.
497
- 8. **Renaming and expecting the planner to detect it (Postgres).** Prisma 8 has no in-contract rename hint today; the planner emits a destructive drop+add. Hand-edit `migration.ts` to rewrite the destructive op as a `rawSql({ ... })` that issues `ALTER TABLE ... RENAME COLUMN ...` (or use the two-migration keep / backfill / drop pattern), then self-emit. See `references/contract.md` § *Edit a field — rename*.
500
+ 8. **Renaming a model or field without a statement (Postgres, SQLite).** The planner cannot tell a rename from a drop and a create, so without a statement it plans a destructive drop+add. State the rename on the command line: `migration plan --name <slug> --rename User:Person --rename Person.email:Person.emailAddress`, or the same `--rename` flags on `db update`. A field is named through its model as the new contract names it. The planner then renames the table or column and the constraints and indexes named after it. For a rename statements do not cover, such as a model that keeps its name but changes its `@@map`, hand-edit `migration.ts` with `...this.renameTable(...)` or `...this.renameColumn(...)`, then self-emit.
498
501
  9. **Planning with no `db` ref and no `--from` in a project that already has migrations.** The origin falls through to the empty database, which would make the plan a full-create migration; `migration plan` refuses with `MIGRATION.PLAN_ORIGIN_UNKNOWN` rather than writing it. Pick the exit that matches your intent — the error lists them, and `references/migration-model.md` § *The trap* explains which to choose.
499
502
  10. **Hand-authoring `migration.ts` from a blank file, or rewriting the rendered import line.** Migration files are framework-rendered — let `prisma migration plan` (or `migration new`) render the package, then edit only the holes the framework leaves for you. On Postgres leave the rendered `@internal/postgres/migration` (or `@internal/sqlite/migration`) import path alone; on Mongo leave `@prisma/orm-mongo/target/migration` as rendered. Add symbols to the existing import line rather than introducing new import paths.
500
503
 
@@ -503,7 +506,7 @@ Interactively, consent is typing the database name back (the prompt names it). I
503
506
  - **Runtime-apply migrations.** Prisma 8 doesn't apply pending migrations from your app's startup code (the "Drizzle pattern" for serverless / edge). Workaround: run `prisma db migrate` from your deploy pipeline before the app starts. If you need runtime-apply built-in, file a feature request via the `references/feedback.md` skill.
504
507
  - **Seeds-as-first-class.** Prisma 8 doesn't ship a `prisma db seed` equivalent. Workaround: write a TypeScript script that imports your `db` instance and runs your setup queries; invoke it from `package.json`'s scripts. If you need first-class seeding, file a feature request via the `references/feedback.md` skill.
505
508
  - **Migration squashing.** Prisma 8 doesn't squash older migrations into a baseline. They accumulate; for very large histories, manual baseline-and-truncate is the path. If you need built-in squashing, file a feature request via the `references/feedback.md` skill.
506
- - **In-contract rename hints.** The planner cannot detect that a field rename is a rename rather than a drop+add. Workaround: hand-edit `migration.ts` to issue a `RENAME COLUMN` via `rawSql(...)`, or use a keep / backfill / drop pattern across two migrations. If you need a contract-level rename hint, file a feature request via the `references/feedback.md` skill.
509
+ - **Renames beyond models and fields, and renames on MongoDB.** `--rename` covers models and fields on Postgres and SQLite. It does not rename enum values, namespaces or value objects, and does not move a model to another namespace. On MongoDB, `--rename` fails with `MIGRATION.PLANNING_FAILED` and plans nothing. Workaround: follow the error's advice and make the rename by hand in `mongosh` on each database, before a plan made without `--rename` is applied there: `renameCollection` for a model, and for a field turn off the collection's validator, drop each unique index that includes the field, then `updateMany({}, { $rename: ... })`. Applying the plan then creates the new indexes and turns the validator back on. There is no Mongo rename operation to write in `migration.ts`. If you need one of these, file a feature request via the `references/feedback.md` skill.
507
510
 
508
511
  ## Graph and history commands
509
512
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"sqlite-static-BRccXxAU-BfpSVO53.mjs","names":[],"sources":["../../../../3-extensions/sqlite/dist/sqlite-static-BRccXxAU.mjs"],"sourcesContent":["import sqliteAdapter from \"@internal/adapter-sqlite/runtime\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { createRawLane, sql } from \"@internal/sql-builder/runtime\";\nimport { createExecutionContext, createSqlExecutionStack } from \"@internal/sql-runtime\";\nimport sqliteTarget, { SqliteContractSerializer } from \"@internal/target-sqlite/runtime\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { buildNamespacedEnums } from \"@internal/contract/enum-accessor\";\n//#region src/static/sqlite-static.ts\nfunction buildSqliteStaticContext(context, rawCodecInferer) {\n\tconst sqlNamespace = sql({\n\t\tcontext,\n\t\trawCodecInferer\n\t})[UNBOUND_NAMESPACE_ID];\n\tassertDefined(sqlNamespace, \"the unbound namespace always exists on a sqlite builder output\");\n\tconst sqlDb = blindCast(sqlNamespace);\n\tconst raw = createRawLane({\n\t\tcontext,\n\t\trawCodecInferer\n\t});\n\tconst enums = Object.freeze(buildNamespacedEnums(context.contract.domain))[UNBOUND_NAMESPACE_ID];\n\tassertDefined(enums, \"the unbound namespace always exists on a sqlite builder output\");\n\treturn {\n\t\tcontext,\n\t\tcontract: context.contract,\n\t\tenums,\n\t\tsql: sqlDb,\n\t\traw\n\t};\n}\nfunction sqliteStatic(options) {\n\tconst contract = blindCast(new SqliteContractSerializer().deserializeContract(options.contractJson));\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: sqliteTarget,\n\t\tadapter: sqliteAdapter,\n\t\textensions: options.extensions ?? []\n\t});\n\treturn buildSqliteStaticContext(createExecutionContext({\n\t\tcontract,\n\t\tstack\n\t}), stack.adapter.rawCodecInferer);\n}\n//#endregion\nexport { sqliteStatic as n, buildSqliteStaticContext as t };\n\n//# sourceMappingURL=sqlite-static-BRccXxAU.mjs.map"],"mappings":";;;;;;;;;AASA,SAAS,yBAAyB,SAAS,iBAAiB;CAC3D,MAAM,eAAe,IAAI;EACxB;EACA;CACD,CAAC,CAAC,CAAC;CACH,cAAc,cAAc,gEAAgE;CAC5F,MAAM,QAAQ,UAAU,YAAY;CACpC,MAAM,MAAM,cAAc;EACzB;EACA;CACD,CAAC;CACD,MAAM,QAAQ,OAAO,OAAO,qBAAqB,QAAQ,SAAS,MAAM,CAAC,CAAC,CAAC;CAC3E,cAAc,OAAO,gEAAgE;CACrF,OAAO;EACN;EACA,UAAU,QAAQ;EAClB;EACA,KAAK;EACL;CACD;AACD;AACA,SAAS,aAAa,SAAS;CAC9B,MAAM,WAAW,UAAU,IAAI,yBAAyB,CAAC,CAAC,oBAAoB,QAAQ,YAAY,CAAC;CACnG,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,OAAO,yBAAyB,uBAAuB;EACtD;EACA;CACD,CAAC,GAAG,MAAM,QAAQ,eAAe;AAClC"}