@prisma-next/family-sql 0.16.0-dev.3 → 0.16.0-dev.30
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.
- package/README.md +1 -1
- package/dist/control.d.mts +1 -1
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +24 -15
- package/dist/control.mjs.map +1 -1
- package/dist/diff.d.mts +1 -1
- package/dist/migration.d.mts +1 -1
- package/dist/psl-infer.d.mts +3 -5
- package/dist/psl-infer.d.mts.map +1 -1
- package/dist/psl-infer.mjs +11 -8
- package/dist/psl-infer.mjs.map +1 -1
- package/dist/{types-6JMCRorL.d.mts → types-DhAmOoxA.d.mts} +11 -4
- package/dist/{types-6JMCRorL.d.mts.map → types-DhAmOoxA.d.mts.map} +1 -1
- package/package.json +21 -21
- package/src/core/control-instance.ts +7 -8
- package/src/core/migrations/contract-to-schema-ir.ts +22 -9
- package/src/core/migrations/types.ts +10 -3
- package/src/core/psl-contract-infer/name-transforms.ts +0 -12
- package/src/core/psl-contract-infer/printer-config.ts +2 -3
- package/src/core/psl-contract-infer/relation-inference.ts +23 -1
- package/src/exports/psl-infer.ts +1 -2
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ const stack = createControlStack({
|
|
|
44
44
|
target: postgresTargetDescriptor,
|
|
45
45
|
adapter: postgresAdapterDescriptor,
|
|
46
46
|
driver: postgresDriverDescriptor,
|
|
47
|
-
|
|
47
|
+
extensions: [pgVectorExtensionDescriptor],
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
// Create a family instance for control-plane operations
|
package/dist/control.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as SqlControlAdapter } from "./control-adapter-CW7FdxeS.mjs";
|
|
2
|
-
import { A as SqlPlannerSuccessResult, C as SqlMigrationRunnerSuccessValue, D as SqlPlannerConflictLocation, E as SqlPlannerConflictKind, O as SqlPlannerFailureResult, S as SqlMigrationRunnerResult, T as SqlPlannerConflict, _ as SqlMigrationRunner, a as FieldEvent, b as SqlMigrationRunnerExecuteOptions, c as SqlControlAdapterDescriptor, d as SqlMigrationPlanContractInfo, f as SqlMigrationPlanOperation, g as SqlMigrationPlannerPlanOptions, h as SqlMigrationPlanner, i as ExpandNativeTypeInput, j as StorageTypePlanResult, k as SqlPlannerResult, l as SqlControlExtensionDescriptor, m as SqlMigrationPlanOperationTarget, n as CodecControlHooks, o as FieldEventContext, p as SqlMigrationPlanOperationStep, r as CreateSqlMigrationPlanOptions, s as ResolveIdentityValueInput, t as AnyRecord, u as SqlMigrationPlan, v as SqlMigrationRunnerErrorCode, w as SqlPlanTargetDetails, x as SqlMigrationRunnerFailure, y as SqlMigrationRunnerExecuteCallbacks } from "./types-
|
|
2
|
+
import { A as SqlPlannerSuccessResult, C as SqlMigrationRunnerSuccessValue, D as SqlPlannerConflictLocation, E as SqlPlannerConflictKind, O as SqlPlannerFailureResult, S as SqlMigrationRunnerResult, T as SqlPlannerConflict, _ as SqlMigrationRunner, a as FieldEvent, b as SqlMigrationRunnerExecuteOptions, c as SqlControlAdapterDescriptor, d as SqlMigrationPlanContractInfo, f as SqlMigrationPlanOperation, g as SqlMigrationPlannerPlanOptions, h as SqlMigrationPlanner, i as ExpandNativeTypeInput, j as StorageTypePlanResult, k as SqlPlannerResult, l as SqlControlExtensionDescriptor, m as SqlMigrationPlanOperationTarget, n as CodecControlHooks, o as FieldEventContext, p as SqlMigrationPlanOperationStep, r as CreateSqlMigrationPlanOptions, s as ResolveIdentityValueInput, t as AnyRecord, u as SqlMigrationPlan, v as SqlMigrationRunnerErrorCode, w as SqlPlanTargetDetails, x as SqlMigrationRunnerFailure, y as SqlMigrationRunnerExecuteCallbacks } from "./types-DhAmOoxA.mjs";
|
|
3
3
|
import { n as SqlSchemaDiffInput, r as SqlSchemaDiffResult, t as SqlSchemaDiffFn } from "./schema-differ-C8OHo1V5.mjs";
|
|
4
4
|
import { ContractSerializer, ControlFamilyDescriptor, ControlFamilyInstance, ControlStack, DiffSubjectGranularity, MigratableTargetDescriptor, MigrationOperationClass, MigrationOperationPolicy, MigrationOperationPolicy as MigrationOperationPolicy$1, MigrationPlan, MigrationPlanOperation, MigrationPlanOperation as MigrationPlanOperation$1, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerConflict as MigrationPlannerConflict$1, MigrationPlannerResult, MutationDefaultGeneratorDescriptor, OpFactoryCall, OperationPreview, OperationPreviewCapable, PslContractInferCapable, SchemaDiffIssue, SchemaVerifier, SchemaViewCapable, SignDatabaseResult, TargetMigrationsCapability, VerifyDatabaseResult, VerifyDatabaseSchemaResult, assembleAuthoringContributions } from "@prisma-next/framework-components/control";
|
|
5
5
|
import { ColumnDefault, Contract, ControlPolicy } from "@prisma-next/contract/types";
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/control-instance.ts","../src/core/control-descriptor.ts","../src/core/assembly.ts","../src/core/control-target-descriptor.ts","../src/core/migrations/contract-to-schema-ir.ts","../src/core/migrations/control-policy.ts","../src/core/migrations/field-event-planner.ts","../src/core/migrations/native-type-expander.ts","../src/core/migrations/plan-helpers.ts","../src/core/migrations/policies.ts","../src/core/timestamp-now-generator.ts","../src/exports/control.ts"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/control-instance.ts","../src/core/control-descriptor.ts","../src/core/assembly.ts","../src/core/control-target-descriptor.ts","../src/core/migrations/contract-to-schema-ir.ts","../src/core/migrations/control-policy.ts","../src/core/migrations/field-event-planner.ts","../src/core/migrations/native-type-expander.ts","../src/core/migrations/plan-helpers.ts","../src/core/migrations/policies.ts","../src/core/timestamp-now-generator.ts","../src/exports/control.ts"],"mappings":";;;;;;;;;;;;;;UAuLU;WACC;WACA;WACA;WACA;;KAGN,0BAA0B,YAAY;UAEjC;WACC,kBAAkB,cAAc;WAChC,cAAc;WACd,sBAAsB;;UAGhB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B,UAAU,SAAS;;;;;WAKnB,8BAA8B,OAAO,WAAW;;;;;;;;;;;;WAYhD,6BAA6B,OAAO;;WAEpC,oBAAoB;WACpB,uBAAuB;;;;UClKjB;;;;;WAKN,eAAe,SAAS;;;;WAIxB,aAAa,SAAS;;;;;;;;;;WAUtB,YAAY,oBAAoB;;iBAa3B,yBACd,SAAS,2CACC;;;;;;;;;iBCtDI,wBACd,sBAAsB,cAAc,mDAA8C;WAOvE;WACA;WACA,aAAa;;;;iBC4EV,oBAAoB,gBAClC,SAAS,8BAA8B,kBACtC,iBAAiB;iBAcJ,eAAe,gBAC7B,MAAM,iBAAiB,iBACvB,oBAAoB,uBACnB,wBAAwB;iBAsBX,eAAe,oBAAoB,uBAAuB;;;;iBAoB1D,cAAc;EAC5B;EACA;IACE,GAAG;;;;iBAYS,cACd,MAAM,6BACN,iBACA;EAAY;EAAc,OAAO;IAChC,MAAM;;;;;;cC1KI,sBAAsB;;;;;;;;;;;;;;iBCsBnB,iCAAiC;;;;;;;;;;;iBAqBjC,+BACR,8BACA,2BACN;WAAkB,SAAS;WAAkB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsE3C,uCACR,8BACA,2BACN;WAAkB,SAAS;WAAkB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsB3C,0BACR,8BACA,2BACN;WAAkB,SAAS;WAAkB,YAAY"}
|
package/dist/control.mjs
CHANGED
|
@@ -9,7 +9,6 @@ import { APP_SPACE_ID, SchemaTreeNode, VERIFY_CODE_HASH_MISMATCH, VERIFY_CODE_MA
|
|
|
9
9
|
import { isPlainRecord } from "@prisma-next/framework-components/ir";
|
|
10
10
|
import { assertDescriptorSelfConsistency } from "@prisma-next/migration-tools/spaces";
|
|
11
11
|
import { sqlContractCanonicalizationHooks } from "@prisma-next/sql-contract/canonicalization-hooks";
|
|
12
|
-
import { defaultIndexName } from "@prisma-next/sql-schema-ir/naming";
|
|
13
12
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
14
13
|
import { effectiveControlPolicy } from "@prisma-next/contract/types";
|
|
15
14
|
import { StorageTable, isStorageTypeInstance } from "@prisma-next/sql-contract/types";
|
|
@@ -89,7 +88,7 @@ function createVerifyResult(options) {
|
|
|
89
88
|
return result;
|
|
90
89
|
}
|
|
91
90
|
function buildSqlTypeMetadataRegistry(options) {
|
|
92
|
-
const { target, adapter,
|
|
91
|
+
const { target, adapter, extensions } = options;
|
|
93
92
|
const registry = /* @__PURE__ */ new Map();
|
|
94
93
|
const targetId = adapter.targetId;
|
|
95
94
|
const descriptors = [
|
|
@@ -117,7 +116,7 @@ function buildSqlTypeMetadataRegistry(options) {
|
|
|
117
116
|
function buildTransitiveDependsOnMap(extensions) {
|
|
118
117
|
const directDeps = /* @__PURE__ */ new Map();
|
|
119
118
|
for (const ext of extensions) {
|
|
120
|
-
const packs = ext.contractSpace?.contractJson?.
|
|
119
|
+
const packs = ext.contractSpace?.contractJson?.extensions;
|
|
121
120
|
const deps = packs !== null && typeof packs === "object" ? Object.keys(packs) : [];
|
|
122
121
|
directDeps.set(ext.id, deps);
|
|
123
122
|
}
|
|
@@ -188,7 +187,7 @@ function createSqlFamilyInstance(stack) {
|
|
|
188
187
|
if (!stack.adapter) throw new Error("SQL family requires an adapter descriptor in ControlStack");
|
|
189
188
|
const target = stack.target;
|
|
190
189
|
const adapter = stack.adapter;
|
|
191
|
-
const extensions = stack.
|
|
190
|
+
const extensions = stack.extensions;
|
|
192
191
|
for (const extension of extensions) if (extension.contractSpace) {
|
|
193
192
|
const { contractJson, headRef } = extension.contractSpace;
|
|
194
193
|
assertDescriptorSelfConsistency({
|
|
@@ -205,7 +204,7 @@ function createSqlFamilyInstance(stack) {
|
|
|
205
204
|
const typeMetadataRegistry = buildSqlTypeMetadataRegistry({
|
|
206
205
|
target,
|
|
207
206
|
adapter,
|
|
208
|
-
|
|
207
|
+
extensions
|
|
209
208
|
});
|
|
210
209
|
let controlAdapter;
|
|
211
210
|
const getControlAdapter = () => controlAdapter ??= adapter.create(stack);
|
|
@@ -515,7 +514,7 @@ function createSqlFamilyInstance(stack) {
|
|
|
515
514
|
}));
|
|
516
515
|
}
|
|
517
516
|
for (const index of table.indexes) {
|
|
518
|
-
const name = index.name
|
|
517
|
+
const name = index.name;
|
|
519
518
|
const label = index.unique ? `unique index ${name}` : `index ${name}`;
|
|
520
519
|
children.push(new SchemaTreeNode({
|
|
521
520
|
kind: "index",
|
|
@@ -672,14 +671,24 @@ function convertUnique(unique, tableName) {
|
|
|
672
671
|
dependsOn: flatColumnDependsOn(tableName, unique.columns)
|
|
673
672
|
};
|
|
674
673
|
}
|
|
675
|
-
function convertIndex(index, tableName) {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
674
|
+
function convertIndex(index, tableName, tableColumns) {
|
|
675
|
+
const base = {
|
|
676
|
+
name: index.name,
|
|
677
|
+
prefix: index.prefix,
|
|
678
|
+
where: index.where,
|
|
679
|
+
unique: index.unique,
|
|
680
|
+
partial: index.where !== void 0,
|
|
681
|
+
type: index.type,
|
|
682
|
+
options: index.options,
|
|
683
|
+
annotations: void 0,
|
|
684
|
+
dependsOn: flatColumnDependsOn(tableName, index.columns ?? tableColumns)
|
|
685
|
+
};
|
|
686
|
+
return index.expression !== void 0 ? {
|
|
687
|
+
...base,
|
|
688
|
+
expression: index.expression
|
|
689
|
+
} : {
|
|
690
|
+
...base,
|
|
691
|
+
columns: index.columns ?? []
|
|
683
692
|
};
|
|
684
693
|
}
|
|
685
694
|
/**
|
|
@@ -762,7 +771,7 @@ function convertTable(name, table, storageTypes, expandNativeType, renderDefault
|
|
|
762
771
|
} : void 0),
|
|
763
772
|
foreignKeys: table.foreignKeys.map((fk) => convertForeignKey(fk, storage)),
|
|
764
773
|
uniques: table.uniques.map((u) => convertUnique(u, name)),
|
|
765
|
-
indexes: table.indexes.map((i) => convertIndex(i, name)),
|
|
774
|
+
indexes: table.indexes.map((i) => convertIndex(i, name, Object.keys(table.columns))),
|
|
766
775
|
...ifDefined("checks", checks)
|
|
767
776
|
});
|
|
768
777
|
}
|