@prisma/orm-target-postgres 8.0.0-rc.9-dev.4 → 8.0.0-rc.9-dev.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @prisma/orm-target-postgres
2
2
 
3
- The concrete PostgreSQL target of Prisma Next: the target descriptor (DDL planning, codecs, migration rendering), the Postgres adapter, and the `pg`-based driver.
3
+ The concrete PostgreSQL target of Prisma 8: the target descriptor (DDL planning, codecs, migration rendering), the Postgres adapter, and the `pg`-based driver.
4
4
 
5
5
  Applications receive it as an exact-pinned dependency of `@prisma/orm-postgres`; app developers install that facade. Extension authors targeting Postgres and decomposed installs (for example, replacing the adapter with a custom one while keeping the target and driver) import this package directly.
6
6
 
@@ -5,9 +5,9 @@ import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-D41CePyY-B0
5
5
  import { a as postgresDiffSubjectGranularity, i as postgresDiffSubjectEntityKind } from "./postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs";
6
6
  import { t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs";
7
7
  import { r as renderDefaultLiteral } from "./planner-ddl-builders-CsfmnnKR-CNn0fLyx.mjs";
8
- import { n as contractToPostgresDatabaseSchemaNode, r as diffPostgresSchema } from "./diff-database-schema-B27W13mM-DmRNUFyg.mjs";
8
+ import { n as contractToPostgresDatabaseSchemaNode, r as diffPostgresSchema } from "./diff-database-schema-C9UxdmYu-BzQjQb1e.mjs";
9
9
  import { t as PostgresContractSerializer } from "./postgres-contract-view-dWcpuV6T-CJPsHGox.mjs";
10
- import { t as createPostgresMigrationPlanner } from "./planner-CDEcM3hy-Bd4_HNx3.mjs";
10
+ import { t as createPostgresMigrationPlanner } from "./planner-DtwSy6w3--x0IvtI9.mjs";
11
11
  import { blindCast } from "@prisma/orm-framework/utils/casts";
12
12
  import { UNBOUND_NAMESPACE_ID, coordinateKey, elementCoordinates } from "@prisma/orm-framework/components/ir";
13
13
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -201,7 +201,7 @@ var PostgresMigrationRunner = class {
201
201
  if (result.rows.length === 0) return okVoid();
202
202
  const columns = new Set(result.rows.map((row) => row.column_name));
203
203
  if (columns.has("space")) return okVoid();
204
- return runnerFailure("MIGRATION.LEGACY_MARKER_SHAPE", "Legacy marker-table shape detected on prisma_contract.marker (no `space` column). Prisma Next is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop `prisma_contract.marker` and re-run `dbInit` to reinitialise from a clean baseline.", { meta: {
204
+ return runnerFailure("MIGRATION.LEGACY_MARKER_SHAPE", "Legacy marker-table shape detected on prisma_contract.marker (no `space` column). Prisma 8 is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop `prisma_contract.marker` and re-run `dbInit` to reinitialise from a clean baseline.", { meta: {
205
205
  table: "prisma_contract.marker",
206
206
  columns: [...columns].sort()
207
207
  } });
@@ -1464,4 +1464,4 @@ const postgresTargetDescriptor = {
1464
1464
  //#endregion
1465
1465
  export { postgresTargetDescriptor as n, postgresRenderDefault as t };
1466
1466
 
1467
- //# sourceMappingURL=control-CweD3zgF.mjs.map
1467
+ //# sourceMappingURL=control-CNgGXxV6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-CNgGXxV6.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/control.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { n as postgresResolveDefault } from \"./default-normalizer-Ba5ZebHM.mjs\";\nimport { l as instantNowControlDescriptor, s as INSTANT_NOW_GENERATOR_ID } from \"./authoring-Dm1jBKhq.mjs\";\nimport { t as postgresRenderCheckExpressions } from \"./check-expressions-DFTeR0rd.mjs\";\nimport { t as postgresTargetDescriptorMeta } from \"./descriptor-meta-D41CePyY.mjs\";\nimport { a as postgresDiffSubjectGranularity, i as postgresDiffSubjectEntityKind } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { n as diffPostgresSchema, r as contractToPostgresDatabaseSchemaNode } from \"./diff-database-schema-C9UxdmYu.mjs\";\nimport { r as renderDefaultLiteral } from \"./planner-ddl-builders-CsfmnnKR.mjs\";\nimport { n as PostgresContractSerializer } from \"./postgres-contract-view-dWcpuV6T.mjs\";\nimport { t as createPostgresMigrationPlanner } from \"./planner-DtwSy6w3.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID, coordinateKey, elementCoordinates } from \"@internal/framework-components/ir\";\nimport { buildNativeTypeExpander, runnerFailure, runnerSuccess } from \"@internal/family-sql/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { composeCheckWirePrefix, computeCheckContentHash, computeIndexContentHash, formatWireName, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { APP_SPACE_ID } from \"@internal/framework-components/control\";\nimport { notOk, ok, okVoid } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { SqlSchemaVerifierBase } from \"@internal/family-sql/ir\";\nimport { SqlQueryError } from \"@internal/sql-errors\";\nimport { buildChildRelationField, deriveRelationFieldName, inferRelations, mapDefault, parseRawDefault, toEnumMemberName, toEnumName, toFieldName, toModelName } from \"@internal/family-sql/psl-infer\";\nimport { UNSPECIFIED_PSL_NAMESPACE_ID, makePslNamespace, makePslNamespaceEntries } from \"@internal/framework-components/psl-ast\";\nimport { isColumnDefault } from \"@internal/contract/types\";\n//#region src/core/migrations/runner.ts\nconst LOCK_DOMAIN = \"prisma_next.contract.marker\";\n/**\n* Deep clones and freezes a record object to prevent mutation.\n* Recursively clones nested objects and arrays to ensure complete isolation.\n*/\nfunction cloneAndFreezeRecord(value) {\n\tconst cloned = {};\n\tfor (const [key, val] of Object.entries(value)) if (val === null || val === void 0) cloned[key] = val;\n\telse if (Array.isArray(val)) cloned[key] = Object.freeze([...val]);\n\telse if (typeof val === \"object\") cloned[key] = cloneAndFreezeRecord(val);\n\telse cloned[key] = val;\n\treturn Object.freeze(cloned);\n}\nfunction createPostgresMigrationRunner(family) {\n\treturn new PostgresMigrationRunner(family);\n}\nvar PostgresMigrationRunner = class {\n\tfamily;\n\tconstructor(family) {\n\t\tthis.family = family;\n\t}\n\t/**\n\t* Body of the migration runner without transaction management. The\n\t* caller ({@link PostgresMigrationRunner.execute}) owns the\n\t* `BEGIN`/`COMMIT`/`ROLLBACK` lifecycle.\n\t*/\n\tasync executeOnConnection(options) {\n\t\tconst schema = options.schemaName ?? Object.keys(options.destinationContract.storage.namespaces).find((id) => id !== UNBOUND_NAMESPACE_ID) ?? UNBOUND_NAMESPACE_ID;\n\t\tconst driver = options.driver;\n\t\tif (options.space !== void 0 && options.space !== options.plan.spaceId) throw postgresError(\"MIGRATION.CONTRACT_SPACE_VIOLATION\", `SqlMigrationRunner: options.space (${options.space}) does not match plan.spaceId (${options.plan.spaceId})`, { meta: {\n\t\t\tspace: options.space,\n\t\t\tplanSpaceId: options.plan.spaceId\n\t\t} });\n\t\tconst space = options.plan.spaceId;\n\t\tconst lockKey = `${LOCK_DOMAIN}:${schema}:${space}`;\n\t\tconst planOps = blindCast(await Promise.all(options.plan.operations));\n\t\tconst destinationCheck = this.ensurePlanMatchesDestinationContract(options.plan.destination, options.destinationContract);\n\t\tif (!destinationCheck.ok) return destinationCheck;\n\t\tconst policyCheck = this.enforcePolicyCompatibility(options.policy, planOps);\n\t\tif (!policyCheck.ok) return policyCheck;\n\t\tawait this.acquireLock(driver, lockKey);\n\t\tconst ensureResult = await this.ensureControlTables(driver, options.destinationContract);\n\t\tif (!ensureResult.ok) return ensureResult;\n\t\tconst existingMarker = await this.family.readMarker({\n\t\t\tdriver,\n\t\t\tspace\n\t\t});\n\t\tconst markerCheck = this.ensureMarkerCompatibility(existingMarker, options.plan);\n\t\tif (!markerCheck.ok) return markerCheck;\n\t\tconst markerAtDestination = this.markerMatchesDestination(existingMarker, options.plan);\n\t\tconst isSelfEdge = options.plan.origin?.storageHash === options.plan.destination.storageHash;\n\t\tconst skipOperations = markerAtDestination && options.plan.origin != null && !isSelfEdge;\n\t\tlet applyValue;\n\t\tif (skipOperations) applyValue = {\n\t\t\toperationsExecuted: 0,\n\t\t\texecutedOperations: []\n\t\t};\n\t\telse {\n\t\t\tconst applyResult = await this.applyPlan(driver, options, planOps);\n\t\t\tif (!applyResult.ok) return applyResult;\n\t\t\tapplyValue = applyResult.value;\n\t\t}\n\t\tif (space === APP_SPACE_ID) {\n\t\t\tconst schemaNode = await this.family.introspect({\n\t\t\t\tdriver,\n\t\t\t\tcontract: options.destinationContract\n\t\t\t});\n\t\t\tconst schemaVerifyResult = this.family.verifySchema({\n\t\t\t\tcontract: options.destinationContract,\n\t\t\t\tschema: schemaNode,\n\t\t\t\tstrict: options.strictVerification ?? true,\n\t\t\t\tframeworkComponents: options.frameworkComponents\n\t\t\t});\n\t\t\tif (!schemaVerifyResult.ok) return runnerFailure(\"MIGRATION.SCHEMA_VERIFY_FAILED\", schemaVerifyResult.summary, {\n\t\t\t\twhy: \"The resulting database schema does not satisfy the destination contract.\",\n\t\t\t\tmeta: { issues: schemaVerifyResult.schema.issues }\n\t\t\t});\n\t\t}\n\t\tconst incomingInvariants = options.plan.providedInvariants ?? [];\n\t\tconst existingInvariants = new Set(existingMarker?.invariants ?? []);\n\t\tconst incomingIsSubsetOfExisting = incomingInvariants.every((id) => existingInvariants.has(id));\n\t\tif (!(isSelfEdge && applyValue.operationsExecuted === 0 && incomingIsSubsetOfExisting)) {\n\t\t\tconst markerResult = await this.upsertMarker(driver, options, existingMarker, space);\n\t\t\tif (!markerResult.ok) return markerResult;\n\t\t\tawait this.recordLedgerEntries(driver, options, applyValue.executedOperations, planOps.length);\n\t\t}\n\t\treturn runnerSuccess({\n\t\t\toperationsPlanned: planOps.length,\n\t\t\toperationsExecuted: applyValue.operationsExecuted\n\t\t});\n\t}\n\tasync execute(options) {\n\t\tconst driver = options.driver;\n\t\tconst perSpaceOptions = options.perSpaceOptions;\n\t\tif (perSpaceOptions.length === 0) return ok({ perSpaceResults: [] });\n\t\tawait this.beginTransaction(driver);\n\t\tlet committed = false;\n\t\ttry {\n\t\t\tconst perSpaceResults = [];\n\t\t\tfor (const spaceOptions of perSpaceOptions) {\n\t\t\t\tconst space = spaceOptions.space ?? spaceOptions.plan.spaceId;\n\t\t\t\tconst result = await this.executeOnConnection({\n\t\t\t\t\t...spaceOptions,\n\t\t\t\t\tdriver,\n\t\t\t\t\tspace\n\t\t\t\t});\n\t\t\t\tif (!result.ok) return notOk({\n\t\t\t\t\t...result.failure,\n\t\t\t\t\tfailingSpace: space\n\t\t\t\t});\n\t\t\t\tperSpaceResults.push({\n\t\t\t\t\tspace,\n\t\t\t\t\tvalue: result.value\n\t\t\t\t});\n\t\t\t}\n\t\t\tawait this.commitTransaction(driver);\n\t\t\tcommitted = true;\n\t\t\treturn ok({ perSpaceResults });\n\t\t} finally {\n\t\t\tif (!committed) await this.rollbackTransaction(driver);\n\t\t}\n\t}\n\tasync applyPlan(driver, options, ops) {\n\t\tconst checks = options.executionChecks;\n\t\tconst runPrechecks = checks?.prechecks !== false;\n\t\tconst runPostchecks = checks?.postchecks !== false;\n\t\tconst runIdempotency = checks?.idempotencyChecks !== false;\n\t\tlet operationsExecuted = 0;\n\t\tconst executedOperations = [];\n\t\tfor (const operation of ops) {\n\t\t\toptions.callbacks?.onOperationStart?.(operation);\n\t\t\ttry {\n\t\t\t\tif (runPostchecks && runIdempotency) {\n\t\t\t\t\tif (await this.expectationsAreSatisfied(driver, operation.postcheck)) {\n\t\t\t\t\t\texecutedOperations.push(this.createPostcheckPreSatisfiedSkipRecord(operation));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (runPrechecks) {\n\t\t\t\t\tconst precheckResult = await this.runExpectationSteps(driver, operation.precheck, operation, \"precheck\");\n\t\t\t\t\tif (!precheckResult.ok) return precheckResult;\n\t\t\t\t}\n\t\t\t\tconst executeResult = await this.runExecuteSteps(driver, operation.execute, operation);\n\t\t\t\tif (!executeResult.ok) return executeResult;\n\t\t\t\tif (runPostchecks) {\n\t\t\t\t\tconst postcheckResult = await this.runExpectationSteps(driver, operation.postcheck, operation, \"postcheck\");\n\t\t\t\t\tif (!postcheckResult.ok) return postcheckResult;\n\t\t\t\t}\n\t\t\t\texecutedOperations.push(operation);\n\t\t\t\toperationsExecuted += 1;\n\t\t\t} finally {\n\t\t\t\toptions.callbacks?.onOperationComplete?.(operation);\n\t\t\t}\n\t\t}\n\t\treturn ok({\n\t\t\toperationsExecuted,\n\t\t\texecutedOperations\n\t\t});\n\t}\n\tasync ensureControlTables(driver, contract) {\n\t\tconst lowererContext = { contract };\n\t\tconst [schemaQuery, ...tableQueries] = this.family.bootstrapControlTableQueries();\n\t\tif (schemaQuery === void 0) throw new InternalError(\"Postgres control-table bootstrap must include CREATE SCHEMA\");\n\t\tawait this.executeStatement(driver, await this.family.lowerAst(schemaQuery, lowererContext));\n\t\tconst legacyDetection = await this.detectLegacyMarkerShape(driver);\n\t\tif (!legacyDetection.ok) return legacyDetection;\n\t\tfor (const query of tableQueries) await this.executeStatement(driver, await this.family.lowerAst(query, lowererContext));\n\t\treturn okVoid();\n\t}\n\tasync detectLegacyMarkerShape(driver) {\n\t\tconst result = await driver.query(`select column_name\n from information_schema.columns\n where table_schema = 'prisma_contract'\n and table_name = 'marker'`);\n\t\tif (result.rows.length === 0) return okVoid();\n\t\tconst columns = new Set(result.rows.map((row) => row.column_name));\n\t\tif (columns.has(\"space\")) return okVoid();\n\t\treturn runnerFailure(\"MIGRATION.LEGACY_MARKER_SHAPE\", \"Legacy marker-table shape detected on prisma_contract.marker (no `space` column). Prisma 8 is in pre-1.0; the previous transitional auto-migration to the per-space-row schema has been removed. Drop `prisma_contract.marker` and re-run `dbInit` to reinitialise from a clean baseline.\", { meta: {\n\t\t\ttable: \"prisma_contract.marker\",\n\t\t\tcolumns: [...columns].sort()\n\t\t} });\n\t}\n\tasync runExpectationSteps(driver, steps, operation, phase) {\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return runnerFailure(phase === \"precheck\" ? \"MIGRATION.PRECHECK_FAILED\" : \"MIGRATION.POSTCHECK_FAILED\", `Operation ${operation.id} failed during ${phase}: ${step.description}`, { meta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\tphase,\n\t\t\t\tstepDescription: step.description\n\t\t\t} });\n\t\t}\n\t\treturn okVoid();\n\t}\n\tasync runExecuteSteps(driver, steps, operation) {\n\t\tfor (const step of steps) try {\n\t\t\tawait driver.query(step.sql, step.params ?? []);\n\t\t} catch (error) {\n\t\t\tif (SqlQueryError.is(error)) return runnerFailure(\"MIGRATION.EXECUTION_FAILED\", `Operation ${operation.id} failed during execution: ${step.description}`, {\n\t\t\t\twhy: error.message,\n\t\t\t\tmeta: {\n\t\t\t\t\toperationId: operation.id,\n\t\t\t\t\tstepDescription: step.description,\n\t\t\t\t\tsql: step.sql,\n\t\t\t\t\tsqlState: error.sqlState,\n\t\t\t\t\tconstraint: error.constraint,\n\t\t\t\t\ttable: error.table,\n\t\t\t\t\tcolumn: error.column,\n\t\t\t\t\tdetail: error.detail\n\t\t\t\t}\n\t\t\t});\n\t\t\tthrow error;\n\t\t}\n\t\treturn okVoid();\n\t}\n\tstepResultIsTrue(rows) {\n\t\tif (!rows || rows.length === 0) return false;\n\t\tconst firstRow = rows[0];\n\t\tconst firstValue = firstRow ? Object.values(firstRow)[0] : void 0;\n\t\tif (typeof firstValue === \"boolean\") return firstValue;\n\t\tif (typeof firstValue === \"number\") return firstValue !== 0;\n\t\tif (typeof firstValue === \"string\") {\n\t\t\tconst lower = firstValue.toLowerCase();\n\t\t\tif (lower === \"t\" || lower === \"true\" || lower === \"1\") return true;\n\t\t\tif (lower === \"f\" || lower === \"false\" || lower === \"0\") return false;\n\t\t\treturn firstValue.length > 0;\n\t\t}\n\t\treturn Boolean(firstValue);\n\t}\n\tasync expectationsAreSatisfied(driver, steps) {\n\t\tif (steps.length === 0) return false;\n\t\tfor (const step of steps) {\n\t\t\tconst result = await driver.query(step.sql, step.params ?? []);\n\t\t\tif (!this.stepResultIsTrue(result.rows)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\tcreatePostcheckPreSatisfiedSkipRecord(operation) {\n\t\tconst clonedMeta = operation.meta ? cloneAndFreezeRecord(operation.meta) : void 0;\n\t\tconst runnerMeta = Object.freeze({\n\t\t\tskipped: true,\n\t\t\treason: \"postcheck_pre_satisfied\"\n\t\t});\n\t\tconst mergedMeta = Object.freeze({\n\t\t\t...clonedMeta ?? {},\n\t\t\trunner: runnerMeta\n\t\t});\n\t\tconst frozenPostcheck = Object.freeze([...operation.postcheck]);\n\t\treturn Object.freeze({\n\t\t\tid: operation.id,\n\t\t\tlabel: operation.label,\n\t\t\t...ifDefined(\"summary\", operation.summary),\n\t\t\toperationClass: operation.operationClass,\n\t\t\ttarget: operation.target,\n\t\t\tprecheck: Object.freeze([]),\n\t\t\texecute: Object.freeze([]),\n\t\t\tpostcheck: frozenPostcheck,\n\t\t\t...ifDefined(\"meta\", operation.meta || mergedMeta ? mergedMeta : void 0)\n\t\t});\n\t}\n\tmarkerMatchesDestination(marker, plan) {\n\t\tif (!marker) return false;\n\t\tif (marker.storageHash !== plan.destination.storageHash) return false;\n\t\tif (plan.destination.profileHash && marker.profileHash !== plan.destination.profileHash) return false;\n\t\treturn true;\n\t}\n\tenforcePolicyCompatibility(policy, operations) {\n\t\tconst allowedClasses = new Set(policy.allowedOperationClasses);\n\t\tfor (const operation of operations) if (!allowedClasses.has(operation.operationClass)) return runnerFailure(\"MIGRATION.POLICY_VIOLATION\", `Operation ${operation.id} has class \"${operation.operationClass}\" which is not allowed by policy.`, {\n\t\t\twhy: `Policy only allows: ${policy.allowedOperationClasses.join(\", \")}.`,\n\t\t\tmeta: {\n\t\t\t\toperationId: operation.id,\n\t\t\t\toperationClass: operation.operationClass,\n\t\t\t\tallowedClasses: policy.allowedOperationClasses\n\t\t\t}\n\t\t});\n\t\treturn okVoid();\n\t}\n\tensureMarkerCompatibility(marker, plan) {\n\t\tconst origin = plan.origin ?? null;\n\t\tif (!origin) return okVoid();\n\t\tif (!marker) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Missing contract marker: expected origin storage hash ${origin.storageHash}.`, { meta: { expectedOriginStorageHash: origin.storageHash } });\n\t\tif (marker.storageHash !== origin.storageHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker (${marker.storageHash}) does not match plan origin (${origin.storageHash}).`, { meta: {\n\t\t\tmarkerStorageHash: marker.storageHash,\n\t\t\texpectedOriginStorageHash: origin.storageHash\n\t\t} });\n\t\tif (origin.profileHash && marker.profileHash !== origin.profileHash) return runnerFailure(\"MIGRATION.MARKER_ORIGIN_MISMATCH\", `Existing contract marker profile hash (${marker.profileHash}) does not match plan origin profile hash (${origin.profileHash}).`, { meta: {\n\t\t\tmarkerProfileHash: marker.profileHash,\n\t\t\texpectedOriginProfileHash: origin.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tensurePlanMatchesDestinationContract(destination, contract) {\n\t\tif (destination.storageHash !== contract.storage.storageHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination storage hash (${destination.storageHash}) does not match provided contract storage hash (${contract.storage.storageHash}).`, { meta: {\n\t\t\tplanStorageHash: destination.storageHash,\n\t\t\tcontractStorageHash: contract.storage.storageHash\n\t\t} });\n\t\tif (destination.profileHash && contract.profileHash && destination.profileHash !== contract.profileHash) return runnerFailure(\"MIGRATION.DESTINATION_CONTRACT_MISMATCH\", `Plan destination profile hash (${destination.profileHash}) does not match provided contract profile hash (${contract.profileHash}).`, { meta: {\n\t\t\tplanProfileHash: destination.profileHash,\n\t\t\tcontractProfileHash: contract.profileHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync upsertMarker(driver, options, existingMarker, space) {\n\t\tconst destination = {\n\t\t\tstorageHash: options.plan.destination.storageHash,\n\t\t\tprofileHash: options.plan.destination.profileHash ?? options.destinationContract.profileHash ?? options.plan.destination.storageHash,\n\t\t\tinvariants: options.plan.providedInvariants ?? []\n\t\t};\n\t\tif (!existingMarker) {\n\t\t\tawait this.family.initMarker({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tdestination\n\t\t\t});\n\t\t\treturn okVoid();\n\t\t}\n\t\tif (!await this.family.updateMarker({\n\t\t\tdriver,\n\t\t\tspace,\n\t\t\texpectedFrom: existingMarker.storageHash,\n\t\t\tdestination\n\t\t})) return runnerFailure(\"MIGRATION.MARKER_CAS_FAILURE\", \"Marker was modified by another process during migration execution.\", { meta: {\n\t\t\tspace,\n\t\t\texpectedStorageHash: existingMarker.storageHash,\n\t\t\tdestinationStorageHash: options.plan.destination.storageHash\n\t\t} });\n\t\treturn okVoid();\n\t}\n\tasync recordLedgerEntries(driver, options, executedOperations, planOpsLength) {\n\t\tconst space = options.plan.spaceId;\n\t\tconst edges = options.migrationEdges;\n\t\tconst totalEdgeOps = edges.reduce((sum, edge) => sum + edge.operationCount, 0);\n\t\tif (totalEdgeOps !== planOpsLength) throw new InternalError(`Ledger write: plan.operations length (${planOpsLength}) does not match sum of migrationEdges operationCount (${totalEdgeOps})`);\n\t\tlet offset = 0;\n\t\tfor (const edge of edges) {\n\t\t\tconst edgeOps = executedOperations.slice(offset, offset + edge.operationCount);\n\t\t\toffset += edge.operationCount;\n\t\t\tawait this.family.writeLedgerEntry({\n\t\t\t\tdriver,\n\t\t\t\tspace,\n\t\t\t\tentry: {\n\t\t\t\t\tedgeId: `${edge.from}->${edge.to}`,\n\t\t\t\t\tfrom: edge.from,\n\t\t\t\t\tto: edge.to,\n\t\t\t\t\tmigrationName: edge.dirName,\n\t\t\t\t\tmigrationHash: edge.migrationHash,\n\t\t\t\t\toperations: edgeOps,\n\t\t\t\t\t...ifDefined(\"destinationContractJson\", edge.destinationContractJson)\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\tasync acquireLock(driver, key) {\n\t\tawait driver.query(\"select pg_advisory_xact_lock(hashtext($1))\", [key]);\n\t}\n\tasync beginTransaction(driver) {\n\t\tawait driver.query(\"BEGIN\");\n\t}\n\tasync commitTransaction(driver) {\n\t\tawait driver.query(\"COMMIT\");\n\t}\n\tasync rollbackTransaction(driver) {\n\t\tawait driver.query(\"ROLLBACK\");\n\t}\n\tasync executeStatement(driver, statement) {\n\t\tawait driver.query(statement.sql, statement.params);\n\t}\n};\n//#endregion\n//#region src/core/postgres-schema-verifier.ts\n/**\n* Postgres target `SchemaVerifier` concretion. Plugs into the\n* SQL-shared verification surface; production verification today still\n* routes through the family verify verdict (`verifySqlSchemaByDiff` over\n* `diffPostgresSchema`), which carries options (codec hooks,\n* normalizers, framework components) that the framework-level\n* `SchemaVerifyOptions` shape does not yet surface.\n*\n* The hooks return the empty list pending the call-site migration that\n* routes the existing verifier behaviour through the SPI — at that\n* point `verifyCommonSqlSchema` will likely lift onto the family base\n* (mirroring `verifyCommonMongoSchema`) and `verifyTargetExtensions`\n* will house Postgres-only kinds (functions, RLS policies in a future\n* project).\n*/\nvar PostgresSchemaVerifier = class extends SqlSchemaVerifierBase {\n\tverifyCommonSqlSchema(_options) {\n\t\treturn [];\n\t}\n\tverifyTargetExtensions(_options) {\n\t\treturn [];\n\t}\n};\n//#endregion\n//#region src/core/psl-infer/infer-names.ts\nfunction buildFieldNamesByTable(tables) {\n\tconst fieldNamesByTable = /* @__PURE__ */ new Map();\n\tfor (const table of Object.values(tables)) {\n\t\tconst assignmentOrder = [...Object.values(table.columns).map((column, index) => {\n\t\t\tconst { name, map } = toFieldName(column.name);\n\t\t\treturn {\n\t\t\t\tcolumnName: column.name,\n\t\t\t\tdesiredFieldName: name,\n\t\t\t\tfieldMap: map,\n\t\t\t\tindex\n\t\t\t};\n\t\t})].sort((left, right) => {\n\t\t\tconst mapComparison = Number(left.fieldMap !== void 0) - Number(right.fieldMap !== void 0);\n\t\t\tif (mapComparison !== 0) return mapComparison;\n\t\t\treturn left.index - right.index;\n\t\t});\n\t\tconst usedFieldNames = /* @__PURE__ */ new Set();\n\t\tconst tableFieldNames = /* @__PURE__ */ new Map();\n\t\tfor (const column of assignmentOrder) {\n\t\t\tconst fieldName = createUniqueFieldName(column.desiredFieldName, usedFieldNames);\n\t\t\tusedFieldNames.add(fieldName);\n\t\t\ttableFieldNames.set(column.columnName, {\n\t\t\t\tfieldName,\n\t\t\t\tfieldMap: column.fieldMap\n\t\t\t});\n\t\t}\n\t\tfieldNamesByTable.set(table.name, tableFieldNames);\n\t}\n\treturn fieldNamesByTable;\n}\nfunction resolveColumnFieldName(fieldNamesByTable, tableName, columnName) {\n\treturn fieldNamesByTable.get(tableName)?.get(columnName)?.fieldName ?? toFieldName(columnName).name;\n}\nfunction createUniqueFieldName(desiredName, usedFieldNames) {\n\tif (!usedFieldNames.has(desiredName)) return desiredName;\n\tlet counter = 2;\n\twhile (usedFieldNames.has(`${desiredName}${counter}`)) counter++;\n\treturn `${desiredName}${counter}`;\n}\nfunction buildTopLevelNameMap(sources, normalize, kind, sourceKind) {\n\tconst results = /* @__PURE__ */ new Map();\n\tconst normalizedToSources = /* @__PURE__ */ new Map();\n\tfor (const source of sources) {\n\t\tconst normalized = normalize(source);\n\t\tresults.set(source, normalized);\n\t\tnormalizedToSources.set(normalized.name, [...normalizedToSources.get(normalized.name) ?? [], source]);\n\t}\n\tconst duplicates = [...normalizedToSources.entries()].filter(([, conflictingSources]) => conflictingSources.length > 1);\n\tif (duplicates.length > 0) throw postgresError(\"CONTRACT.NAME_DUPLICATE\", `PSL ${kind} name collisions detected:\\n${duplicates.map(([normalizedName, conflictingSources]) => `- ${kind} \"${normalizedName}\" from ${sourceKind}s ${conflictingSources.map((source) => `\"${source}\"`).join(\", \")}`).join(\"\\n\")}`, { meta: {\n\t\tkind,\n\t\tnames: duplicates.map(([normalizedName]) => normalizedName)\n\t} });\n\treturn results;\n}\nfunction topologicalSort(models, tables, modelNameMap) {\n\tconst modelByName = /* @__PURE__ */ new Map();\n\tfor (const model of models) modelByName.set(model.name, model);\n\tconst deps = /* @__PURE__ */ new Map();\n\tconst tableToModel = /* @__PURE__ */ new Map();\n\tfor (const tableName of Object.keys(tables)) {\n\t\tconst modelName = modelNameMap.get(tableName);\n\t\tassertDefined(modelName, `topologicalSort: no model name mapped for table \"${tableName}\"`);\n\t\ttableToModel.set(tableName, modelName);\n\t\tdeps.set(modelName, /* @__PURE__ */ new Set());\n\t}\n\tfor (const [tableName, table] of Object.entries(tables)) {\n\t\tconst modelName = tableToModel.get(tableName);\n\t\tassertDefined(modelName, `topologicalSort: no model name recorded for table \"${tableName}\"`);\n\t\tconst modelDeps = deps.get(modelName);\n\t\tassertDefined(modelDeps, `topologicalSort: no dependency set recorded for model \"${modelName}\"`);\n\t\tfor (const fk of table.foreignKeys) {\n\t\t\tconst refModelName = tableToModel.get(fk.referencedTable);\n\t\t\tif (refModelName && refModelName !== modelName) modelDeps.add(refModelName);\n\t\t}\n\t}\n\tconst result = [];\n\tconst visited = /* @__PURE__ */ new Set();\n\tconst visiting = /* @__PURE__ */ new Set();\n\tconst sortedNames = [...deps.keys()].sort();\n\tfunction visit(name) {\n\t\tif (visited.has(name)) return;\n\t\tif (visiting.has(name)) return;\n\t\tvisiting.add(name);\n\t\tconst nameDeps = deps.get(name);\n\t\tassertDefined(nameDeps, `topologicalSort: no dependency set recorded for model \"${name}\"`);\n\t\tconst sortedDeps = [...nameDeps].sort();\n\t\tfor (const dep of sortedDeps) visit(dep);\n\t\tvisiting.delete(name);\n\t\tvisited.add(name);\n\t\tconst model = modelByName.get(name);\n\t\tassertDefined(model, `topologicalSort: no model block recorded for \"${name}\"`);\n\t\tresult.push(model);\n\t}\n\tfor (const name of sortedNames) visit(name);\n\treturn result;\n}\n//#endregion\n//#region src/core/psl-infer/psl-literals.ts\nconst SYNTHETIC_SPAN = {\n\tstart: {\n\t\toffset: 0,\n\t\tline: 1,\n\t\tcolumn: 1\n\t},\n\tend: {\n\t\toffset: 0,\n\t\tline: 1,\n\t\tcolumn: 1\n\t}\n};\nfunction buildSimpleConstraintFieldAttribute(name, constraintName) {\n\tif (constraintName === void 0) return buildAttribute(\"field\", name, []);\n\treturn buildAttribute(\"field\", name, [namedArg(\"map\", `\"${escapePslString(constraintName)}\"`)]);\n}\nfunction parseDefaultAttributeString(attributeText) {\n\treturn buildAttribute(\"field\", \"default\", [positionalArg(attributeText.replace(/^@default\\(/, \"\").replace(/\\)$/, \"\"))]);\n}\nfunction buildMapAttribute(target, mapName) {\n\treturn buildAttribute(target, \"map\", [positionalArg(`\"${escapePslString(mapName)}\"`)]);\n}\nfunction buildAttribute(target, name, args) {\n\treturn {\n\t\tkind: \"attribute\",\n\t\ttarget,\n\t\tname,\n\t\targs,\n\t\tspan: SYNTHETIC_SPAN\n\t};\n}\nfunction positionalArg(value) {\n\treturn {\n\t\tkind: \"positional\",\n\t\tvalue,\n\t\tspan: SYNTHETIC_SPAN\n\t};\n}\nfunction namedArg(name, value) {\n\treturn {\n\t\tkind: \"named\",\n\t\tname,\n\t\tvalue,\n\t\tspan: SYNTHETIC_SPAN\n\t};\n}\nfunction escapePslString(value) {\n\treturn value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\").replace(/\\n/g, \"\\\\n\").replace(/\\r/g, \"\\\\r\");\n}\n/**\n* Formats a resolved literal-default array as PSL literal-list syntax\n* (`[1, 2, 3]`, `[\"a\", \"b\"]`, `[]`). PSL's list-literal grammar only accepts\n* string/number/boolean elements, so any other element (e.g. `null`, a\n* nested array/object) makes the value unrepresentable and this returns\n* `undefined`.\n*/\nfunction formatPslListLiteralValue(elements) {\n\tconst parts = [];\n\tfor (const element of elements) if (typeof element === \"string\") parts.push(`\"${escapePslString(element)}\"`);\n\telse if (typeof element === \"number\" || typeof element === \"boolean\") parts.push(String(element));\n\telse return;\n\treturn `[${parts.join(\", \")}]`;\n}\n/**\n* Resolves a `SqlColumnIR.default` value into a normalized {@link ColumnDefault}.\n*\n* `SqlSchemaIR` types the column default as `string` (a raw database default\n* expression). Some legacy fixtures and tests still pass already-normalized\n* `ColumnDefault` objects in the same slot, so we accept either shape\n* defensively at runtime.\n*/\nfunction parseColumnDefault(value, nativeType, rawDefaultParser) {\n\tif (typeof value === \"string\") return rawDefaultParser ? rawDefaultParser(value, nativeType) : void 0;\n\treturn isColumnDefault(value) ? value : void 0;\n}\n//#endregion\n//#region src/core/psl-infer/infer-enum-blocks.ts\nconst PSL_SCALAR_TYPE_NAMES = /* @__PURE__ */ new Set([\n\t\"String\",\n\t\"Boolean\",\n\t\"Int\",\n\t\"BigInt\",\n\t\"Float\",\n\t\"Decimal\",\n\t\"DateTime\",\n\t\"Json\",\n\t\"Bytes\"\n]);\n/**\n* Builds one `native_enum` extension-block AST node per introspected enum\n* definition. Block names go through the shared top-level transform\n* (`toEnumName`, intra-enum collisions throw like model collisions) and are\n* then reserved against the model names — an enum whose PSL name a model\n* already claims gets a numeric suffix, with `@@map` carrying the real type\n* name. Members print as explicit `member = \"value\"` pairs: the member name\n* is the sanitized value (deduplicated within the block), the JSON-encoded\n* value carries the truth verbatim.\n*/\nfunction buildNativeEnumBlocks(definitions, modelNames) {\n\tconst enumNames = buildTopLevelNameMap([...definitions.keys()].sort(), toEnumName, \"enum\", \"enum type\");\n\tconst usedTopLevelNames = new Set(PSL_SCALAR_TYPE_NAMES);\n\tfor (const result of modelNames.values()) usedTopLevelNames.add(result.name);\n\tconst enumNameMap = /* @__PURE__ */ new Map();\n\tconst enumBlocks = [];\n\tfor (const [typeName, result] of enumNames) {\n\t\tconst name = createUniqueFieldName(result.name, usedTopLevelNames);\n\t\tusedTopLevelNames.add(name);\n\t\tenumNameMap.set(typeName, name);\n\t\tenumBlocks.push(buildNativeEnumBlock(name, typeName, definitions.get(typeName) ?? []));\n\t}\n\treturn {\n\t\tenumNameMap,\n\t\tenumBlocks\n\t};\n}\nfunction buildNativeEnumBlock(name, typeName, values) {\n\tconst usedMemberNames = /* @__PURE__ */ new Set();\n\tconst parameters = {};\n\tfor (const value of values) {\n\t\tconst memberName = createUniqueFieldName(toEnumMemberName(value), usedMemberNames);\n\t\tusedMemberNames.add(memberName);\n\t\tparameters[memberName] = {\n\t\t\tkind: \"value\",\n\t\t\traw: JSON.stringify(value),\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"native_enum\",\n\t\tkeyword: \"native_enum\",\n\t\tname,\n\t\tparameters,\n\t\tblockAttributes: name === typeName ? [] : [{\n\t\t\tname: \"map\",\n\t\t\targs: [{\n\t\t\t\tkind: \"positional\",\n\t\t\t\tvalue: `\"${escapePslString(typeName)}\"`,\n\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t}],\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t}],\n\t\tattributes: name === typeName ? {} : { map: {\n\t\t\targs: { name: typeName },\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t} },\n\t\tspan: SYNTHETIC_SPAN\n\t};\n}\n//#endregion\n//#region src/core/psl-infer/infer-foreign-keys.ts\n/**\n* Coordinates every element a set of already-assembled contracts declare,\n* mapped to the {@link SqlDescribedContractSpace} that owns it and keyed by\n* the shared {@link coordinateKey} helper. `contract infer` uses this to omit\n* database elements a stack extension pack's contract space already\n* describes — reusing the same coordinate walk the contract-space aggregate\n* and cross-space collision check use (`elementCoordinates`), rather than a\n* bespoke per-entity-kind membership test — and, for a foreign key whose\n* referenced table an entry owns, to resolve the qualified cross-space\n* relation it describes.\n*/\nfunction describedContractOwners(describedContracts) {\n\tconst owners = /* @__PURE__ */ new Map();\n\tfor (const entry of describedContracts) for (const coordinate of elementCoordinates(entry.contract.storage)) owners.set(coordinateKey(coordinate), entry);\n\treturn owners;\n}\nfunction resolveCrossSpaceTarget(owner, namespaceId, tableName) {\n\tconst domainNamespace = owner.contract.domain.namespaces[namespaceId];\n\tif (domainNamespace === void 0) return;\n\tfor (const [modelName, model] of Object.entries(domainNamespace.models)) {\n\t\tconst storage = blindCast(model.storage);\n\t\tif (storage.namespaceId !== namespaceId || storage.table !== tableName) continue;\n\t\tconst fieldNamesByColumn = /* @__PURE__ */ new Map();\n\t\tfor (const [fieldName, fieldStorage] of Object.entries(storage.fields)) fieldNamesByColumn.set(fieldStorage.column, { fieldName });\n\t\treturn {\n\t\t\tspaceId: owner.spaceId,\n\t\t\tnamespaceId,\n\t\t\tmodelName,\n\t\t\tfieldNamesByColumn\n\t\t};\n\t}\n}\n/**\n* Classifies every foreign key on a surviving table into one of three cases.\n* A foreign key that carries a `referencedSchema` is checked against the\n* pack-owned coordinates first, so a pack-owned target wins even when a local\n* table happens to share its bare name; only foreign keys with no owned\n* coordinate fall through to the local/dangling distinction.\n*\n* - **Cross-space**: `referencedSchema` is set and a described contract owns\n* the coordinate `(referencedSchema, 'table', referencedTable)`. The\n* referenced table is absent from the tree (omitted because the pack\n* describes it, or never introspected — `contract infer` walks a single\n* namespace). Removed from `foreignKeys` (so `inferRelations` never falls\n* back to a bare, unqualified table name for it) and replaced with a\n* `RelationField` qualified with the owning pack's space id and namespace\n* id. `owners` holds only pack-declared coordinates, so an app's own table\n* (e.g. `public.users`) is never owned and cannot be captured here.\n* - **Local**: not a pack-owned coordinate, and the referenced table survived\n* introspection — left untouched, `inferRelations` handles it as before.\n* - **Dangling**: not a pack-owned coordinate, and the referenced table is\n* neither in the tree nor owned by any described contract. Removed from\n* `foreignKeys`, keeping the scalar column, rather than emitting a relation\n* to a model that was never defined.\n*\n* A pack that owns the referenced coordinate but declares no domain model\n* mapped to it is malformed; that case throws rather than degrading to a\n* silent drop, which would contradict the dangling definition above.\n*/\nfunction resolveForeignKeys(tables, owners) {\n\tconst resultTables = {};\n\tconst extraRelationsByTable = /* @__PURE__ */ new Map();\n\tconst crossSpaceFieldNamesByTable = /* @__PURE__ */ new Map();\n\tconst danglingForeignKeysByTable = /* @__PURE__ */ new Map();\n\tfor (const [tableName, table] of Object.entries(tables)) {\n\t\tconst keptForeignKeys = [];\n\t\tfor (const fk of table.foreignKeys) {\n\t\t\tif (fk.referencedSchema !== void 0) {\n\t\t\t\tconst owner = owners.get(coordinateKey({\n\t\t\t\t\tnamespaceId: fk.referencedSchema,\n\t\t\t\t\tentityKind: \"table\",\n\t\t\t\t\tentityName: fk.referencedTable\n\t\t\t\t}));\n\t\t\t\tif (owner !== void 0) {\n\t\t\t\t\tconst target = resolveCrossSpaceTarget(owner, fk.referencedSchema, fk.referencedTable);\n\t\t\t\t\tif (target === void 0) throw postgresError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `contract infer: described contract space \"${owner.spaceId}\" owns storage coordinate \"${fk.referencedSchema}.${fk.referencedTable}\" but declares no domain model mapped to it. A pack that describes a table must also declare the domain model it maps to; this pack is malformed.`, { meta: {\n\t\t\t\t\t\tspaceId: owner.spaceId,\n\t\t\t\t\t\ttableName: fk.referencedTable\n\t\t\t\t\t} });\n\t\t\t\t\tif (!crossSpaceFieldNamesByTable.has(fk.referencedTable)) crossSpaceFieldNamesByTable.set(fk.referencedTable, target.fieldNamesByColumn);\n\t\t\t\t\tconst fieldName = deriveRelationFieldName(fk.columns, fk.referencedTable);\n\t\t\t\t\tconst optional = fk.columns.some((columnName) => table.columns[columnName]?.nullable ?? false);\n\t\t\t\t\tconst relationField = {\n\t\t\t\t\t\t...buildChildRelationField(fieldName, target.modelName, fk, optional, void 0, table),\n\t\t\t\t\t\ttypeNamespaceId: target.namespaceId,\n\t\t\t\t\t\ttypeContractSpaceId: target.spaceId\n\t\t\t\t\t};\n\t\t\t\t\tconst existingRelations = extraRelationsByTable.get(tableName);\n\t\t\t\t\tif (existingRelations) existingRelations.push(relationField);\n\t\t\t\t\telse extraRelationsByTable.set(tableName, [relationField]);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (tables[fk.referencedTable] !== void 0) keptForeignKeys.push(fk);\n\t\t\telse {\n\t\t\t\tconst dangling = {\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedSchema: fk.referencedSchema,\n\t\t\t\t\treferencedTable: fk.referencedTable\n\t\t\t\t};\n\t\t\t\tconst existingDangling = danglingForeignKeysByTable.get(tableName);\n\t\t\t\tif (existingDangling) existingDangling.push(dangling);\n\t\t\t\telse danglingForeignKeysByTable.set(tableName, [dangling]);\n\t\t\t}\n\t\t}\n\t\tresultTables[tableName] = keptForeignKeys.length === table.foreignKeys.length ? table : new SqlTableIR({\n\t\t\t...table,\n\t\t\tforeignKeys: keptForeignKeys\n\t\t});\n\t}\n\treturn {\n\t\ttables: resultTables,\n\t\textraRelationsByTable,\n\t\tcrossSpaceFieldNamesByTable,\n\t\tdanglingForeignKeysByTable\n\t};\n}\n/**\n* Explains a foreign key `resolveForeignKeys` dropped as dangling: the\n* database enforces it, but its target lives outside the introspected\n* schema, so infer has no model to point a relation at. The suggested fix\n* targets the common cause — an unconfigured extension pack's schema\n* (e.g. Supabase's `auth`).\n*/\nfunction buildDanglingForeignKeyWarning(danglingForeignKeys, fieldNamesByTable, tableName) {\n\treturn `Foreign key ${danglingForeignKeys.map((fk) => {\n\t\tconst fieldNames = fk.columns.map((columnName) => resolveColumnFieldName(fieldNamesByTable, tableName, columnName));\n\t\tconst target = fk.referencedSchema !== void 0 ? `${fk.referencedSchema}.${fk.referencedTable}` : fk.referencedTable;\n\t\treturn `\"${fieldNames.join(\", \")}\" -> \"${target}\"`;\n\t}).join(\", \")} exists in the database, but its target schema is outside the introspected scope, so no relation field was generated. If the target schema is described by an extension pack, add it to extensions and re-run infer.`;\n}\n//#endregion\n//#region src/core/psl-infer/infer-index-attributes.ts\nfunction buildModelConstraintAttribute(name, fields, constraintName) {\n\tconst args = [positionalArg(`[${fields.join(\", \")}]`)];\n\tif (constraintName !== void 0) args.push(namedArg(\"map\", `\"${escapePslString(constraintName)}\"`));\n\treturn buildAttribute(\"model\", name, args);\n}\n/**\n* Emits one `@@index` attribute at full fidelity. The index's identity is\n* re-detected rather than trusted: `name:` is emitted only when the live name\n* parses as a wire name AND that hash recomputes from the introspected\n* content; otherwise the live name is adopted verbatim with `map:`.\n*/\nfunction buildIndexAttribute(index, fieldNames) {\n\tconst args = [];\n\tif (fieldNames !== void 0) args.push(positionalArg(`[${fieldNames.join(\", \")}]`));\n\telse {\n\t\tassertDefined(index.expression, `buildIndexAttribute: index \"${index.name}\" carries neither columns nor expression; SqlIndexIR enforces exactly one`);\n\t\targs.push(namedArg(\"expression\", `\"${escapePslString(index.expression)}\"`));\n\t}\n\tconst parsed = parseWireName(index.name);\n\tconst recomputed = computeIndexContentHash({\n\t\t...index.columns !== void 0 ? { columns: index.columns } : {},\n\t\t...index.expression !== void 0 ? { expression: index.expression } : {},\n\t\t...index.where !== void 0 ? { where: index.where } : {},\n\t\tunique: index.unique,\n\t\t...index.type !== void 0 ? { type: index.type } : {},\n\t\t...index.options !== void 0 ? { options: index.options } : {}\n\t});\n\tif (parsed !== void 0 && parsed.hash === recomputed) args.push(namedArg(\"name\", `\"${escapePslString(parsed.prefix)}\"`));\n\telse args.push(namedArg(\"map\", `\"${escapePslString(index.name)}\"`));\n\tif (index.where !== void 0) args.push(namedArg(\"where\", `\"${escapePslString(index.where)}\"`));\n\tif (index.unique) args.push(namedArg(\"unique\", \"true\"));\n\tconst hasOptions = index.options !== void 0 && Object.keys(index.options).length > 0;\n\tif (index.type !== void 0 || hasOptions) args.push(namedArg(\"type\", `\"${escapePslString(index.type ?? \"btree\")}\"`));\n\tif (hasOptions) {\n\t\tconst entries = Object.entries(index.options ?? {}).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, value]) => `${key}: \"${escapePslString(String(value))}\"`);\n\t\targs.push(namedArg(\"options\", `{ ${entries.join(\", \")} }`));\n\t}\n\treturn buildAttribute(\"model\", \"index\", args);\n}\n/**\n* Emits one `@@check` attribute for a live, non-derived check, always in the\n* `map:` form. Re-detecting `name:` is not attempted: the live expression is\n* Postgres's own reprint, but a wire-named check's hash was taken over the\n* author's original text, so recomputing the hash from the reprint would\n* essentially never match. `map:` plus the verbatim reprint is correct\n* regardless — a reprint compared against a later reprint of the same\n* expression is stable, so the emitted contract signs the live database with\n* zero pending operations. `buildPolicyBlocks` makes the same call for\n* `@@map` on adopted RLS policies, for the same reason.\n*/\nfunction buildCheckAttribute(check) {\n\treturn buildAttribute(\"model\", \"check\", [namedArg(\"expression\", `\"${escapePslString(check.expression)}\"`), namedArg(\"map\", `\"${escapePslString(check.name)}\"`)]);\n}\n//#endregion\n//#region src/core/psl-infer/infer-model-blocks.ts\nfunction buildModel(table, typeMap, enumNameMap, fieldNamesByTable, defaultMapping, rawDefaultParser, relationFields, danglingForeignKeys, rlsEnabled = false, policySkipNotes = []) {\n\tconst { name: modelName, map: mapName } = toModelName(table.name);\n\tconst fieldNameMap = fieldNamesByTable.get(table.name);\n\tconst pkColumns = new Set(table.primaryKey?.columns ?? []);\n\tconst isSinglePk = pkColumns.size === 1;\n\tconst singlePkConstraintName = isSinglePk ? table.primaryKey?.name : void 0;\n\tconst uniqueColumns = /* @__PURE__ */ new Map();\n\tfor (const unique of table.uniques) if (unique.columns.length === 1) {\n\t\tconst [columnName = \"\"] = unique.columns;\n\t\tconst existingConstraintName = uniqueColumns.get(columnName);\n\t\tif (!uniqueColumns.has(columnName) || existingConstraintName === void 0 && unique.name) uniqueColumns.set(columnName, unique.name);\n\t}\n\tconst derivedCheckNames = computeDerivedCheckNames(table);\n\tconst fields = [];\n\tfor (const column of Object.values(table.columns)) fields.push(buildScalarField(column, table, typeMap, enumNameMap, fieldNameMap, defaultMapping, rawDefaultParser, pkColumns, isSinglePk, singlePkConstraintName, uniqueColumns, derivedCheckNames));\n\tconst usedFieldNames = new Set(fields.map((field) => field.name));\n\tfor (const rel of relationFields) fields.push(buildRelationField(rel, table.name, fieldNamesByTable, usedFieldNames));\n\tconst modelAttributes = [];\n\tif (table.primaryKey && table.primaryKey.columns.length > 1) {\n\t\tconst pkFieldNames = table.primaryKey.columns.map((columnName) => resolveColumnFieldName(fieldNamesByTable, table.name, columnName));\n\t\tmodelAttributes.push(buildModelConstraintAttribute(\"id\", pkFieldNames, table.primaryKey.name));\n\t}\n\tfor (const unique of table.uniques) if (unique.columns.length > 1) {\n\t\tconst uniqueFieldNames = unique.columns.map((columnName) => resolveColumnFieldName(fieldNamesByTable, table.name, columnName));\n\t\tmodelAttributes.push(buildModelConstraintAttribute(\"unique\", uniqueFieldNames, unique.name));\n\t}\n\tfor (const index of table.indexes) {\n\t\tconst indexFieldNames = index.columns?.map((columnName) => resolveColumnFieldName(fieldNamesByTable, table.name, columnName));\n\t\tmodelAttributes.push(buildIndexAttribute(index, indexFieldNames));\n\t}\n\tfor (const check of table.checks ?? []) if (!derivedCheckNames.has(check.name)) modelAttributes.push(buildCheckAttribute(check));\n\tif (mapName) modelAttributes.push(buildMapAttribute(\"model\", mapName));\n\tif (rlsEnabled) modelAttributes.push(buildAttribute(\"model\", \"rls\", []));\n\tconst warnings = [];\n\tif (!table.primaryKey) warnings.push(\"This table has no primary key in the database\");\n\tif (danglingForeignKeys.length > 0) warnings.push(buildDanglingForeignKeyWarning(danglingForeignKeys, fieldNamesByTable, table.name));\n\tconst commentLines = [...warnings.length > 0 ? [`// WARNING: ${warnings.join(\" \")}`] : [], ...policySkipNotes];\n\tconst comment = commentLines.length > 0 ? commentLines.join(\"\\n\") : void 0;\n\treturn {\n\t\tkind: \"model\",\n\t\tname: modelName,\n\t\tfields,\n\t\tattributes: modelAttributes,\n\t\tspan: SYNTHETIC_SPAN,\n\t\t...comment !== void 0 ? { comment } : {}\n\t};\n}\n/**\n* The live check names that are derived: a live check's name matches\n* `formatWireName(composeCheckWirePrefix(table, column, kind), computeCheckContentHash(expression))`\n* for some column of the table and some candidate `postgresRenderCheckExpressions`\n* would render for that column. Never by comparing expressions — the live\n* body is a Postgres reprint, never the authored text. One set serves both\n* the `@noCheck` waiver below and `@@check` exclusion in `buildModel`, so the\n* two decisions cannot drift apart.\n*\n* `membership` is unreachable here today: infer never emits domain enums\n* (`enumType()` is not inferred), so no inferred column has member values and\n* no membership check is ever derived. The day domain-enum inference exists,\n* its slice extends this by threading the column's member values through.\n*/\nfunction computeDerivedCheckNames(table) {\n\tconst liveCheckNames = new Set((table.checks ?? []).map((check) => check.name));\n\tconst derivedCheckNames = /* @__PURE__ */ new Set();\n\tfor (const column of Object.values(table.columns)) for (const candidate of postgresRenderCheckExpressions({\n\t\ttableName: table.name,\n\t\tcolumnName: column.name,\n\t\tmany: column.many === true,\n\t\tmemberValues: void 0\n\t})) {\n\t\tconst derivedName = formatWireName(composeCheckWirePrefix(table.name, column.name, candidate.kind), computeCheckContentHash(candidate.expression));\n\t\tif (liveCheckNames.has(derivedName)) derivedCheckNames.add(derivedName);\n\t}\n\treturn derivedCheckNames;\n}\nfunction buildScalarField(column, table, typeMap, enumNameMap, fieldNameMap, defaultMapping, rawDefaultParser, pkColumns, isSinglePk, singlePkConstraintName, uniqueColumns, derivedCheckNames) {\n\tconst resolvedField = fieldNameMap?.get(column.name);\n\tconst fieldName = resolvedField?.fieldName ?? toFieldName(column.name).name;\n\tconst fieldMap = resolvedField?.fieldMap;\n\tconst resolution = typeMap.resolve(column.nativeType, table.annotations);\n\tif (\"unsupported\" in resolution) {\n\t\tconst attrs = [];\n\t\tif (fieldMap !== void 0) attrs.push(buildMapAttribute(\"field\", fieldMap));\n\t\treturn {\n\t\t\tkind: \"field\",\n\t\t\tname: fieldName,\n\t\t\ttypeName: `Unsupported(\"${escapePslString(resolution.nativeType)}\")`,\n\t\t\toptional: column.nullable,\n\t\t\tlist: column.many === true,\n\t\t\tattributes: attrs,\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t};\n\t}\n\tlet typeName = resolution.pslType.name;\n\tlet typeConstructor = resolution.pslType.args ? {\n\t\tkind: \"typeConstructor\",\n\t\tpath: [resolution.pslType.name],\n\t\targs: resolution.pslType.args.map(positionalArg),\n\t\tspan: SYNTHETIC_SPAN\n\t} : void 0;\n\tconst enumPslName = enumNameMap.get(column.nativeType);\n\tif (enumPslName) {\n\t\ttypeName = enumPslName;\n\t\ttypeConstructor = {\n\t\t\tkind: \"typeConstructor\",\n\t\t\tpath: [\"pg\", \"enum\"],\n\t\t\targs: [positionalArg(enumPslName)],\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t};\n\t}\n\tconst attributes = [];\n\tconst isId = isSinglePk && pkColumns.has(column.name);\n\tif (isId) attributes.push(buildSimpleConstraintFieldAttribute(\"id\", singlePkConstraintName));\n\tif (column.default === void 0 && column.resolvedDefault?.kind === \"function\" && column.resolvedDefault.expression === \"autoincrement()\") attributes.push(parseDefaultAttributeString(\"@default(autoincrement())\"));\n\telse if (column.many === true && column.resolvedDefault?.kind === \"literal\") {\n\t\tconst formatted = Array.isArray(column.resolvedDefault.value) ? formatPslListLiteralValue(column.resolvedDefault.value) : void 0;\n\t\tif (formatted !== void 0) attributes.push(parseDefaultAttributeString(`@default(${formatted})`));\n\t} else if (column.default !== void 0) {\n\t\tconst parsed = parseColumnDefault(column.default, column.nativeType, rawDefaultParser);\n\t\tif (parsed) {\n\t\t\tconst result = mapDefault(parsed, defaultMapping);\n\t\t\tif (\"attribute\" in result) attributes.push(parseDefaultAttributeString(result.attribute));\n\t\t}\n\t}\n\tif (uniqueColumns.has(column.name) && !isId) {\n\t\tconst uniqueConstraintName = uniqueColumns.get(column.name);\n\t\tattributes.push(buildSimpleConstraintFieldAttribute(\"unique\", uniqueConstraintName));\n\t}\n\tif (column.many === true) {\n\t\tconst waivedKinds = postgresRenderCheckExpressions({\n\t\t\ttableName: table.name,\n\t\t\tcolumnName: column.name,\n\t\t\tmany: true,\n\t\t\tmemberValues: void 0\n\t\t}).filter((candidate) => !derivedCheckNames.has(formatWireName(composeCheckWirePrefix(table.name, column.name, candidate.kind), computeCheckContentHash(candidate.expression)))).map((candidate) => candidate.kind);\n\t\tif (waivedKinds.length > 0) attributes.push(buildAttribute(\"field\", \"noCheck\", waivedKinds.map(positionalArg)));\n\t}\n\tif (fieldMap !== void 0) attributes.push(buildMapAttribute(\"field\", fieldMap));\n\treturn {\n\t\tkind: \"field\",\n\t\tname: fieldName,\n\t\ttypeName,\n\t\t...ifDefined(\"typeConstructor\", typeConstructor),\n\t\toptional: column.nullable,\n\t\tlist: column.many === true,\n\t\tattributes,\n\t\tspan: SYNTHETIC_SPAN\n\t};\n}\nfunction buildRelationField(rel, hostTableName, fieldNamesByTable, usedFieldNames) {\n\tconst fieldName = createUniqueFieldName(rel.fieldName, usedFieldNames);\n\tusedFieldNames.add(fieldName);\n\tconst args = [];\n\tif (rel.fields && rel.references) {\n\t\tif (rel.relationName) args.push(namedArg(\"name\", `\"${escapePslString(rel.relationName)}\"`));\n\t\targs.push(namedArg(\"fields\", `[${rel.fields.map((columnName) => resolveColumnFieldName(fieldNamesByTable, hostTableName, columnName)).join(\", \")}]`));\n\t\targs.push(namedArg(\"references\", `[${rel.references.map((columnName) => resolveColumnFieldName(fieldNamesByTable, rel.referencedTableName ?? \"\", columnName)).join(\", \")}]`));\n\t\tif (rel.onDelete) args.push(namedArg(\"onDelete\", rel.onDelete));\n\t\tif (rel.onUpdate) args.push(namedArg(\"onUpdate\", rel.onUpdate));\n\t\tif (rel.fkName) args.push(namedArg(\"map\", `\"${escapePslString(rel.fkName)}\"`));\n\t\tif (rel.index === false) args.push(namedArg(\"index\", \"false\"));\n\t} else if (rel.relationName) args.push(namedArg(\"name\", `\"${escapePslString(rel.relationName)}\"`));\n\tconst attrs = args.length > 0 ? [buildAttribute(\"field\", \"relation\", args)] : [];\n\treturn {\n\t\tkind: \"field\",\n\t\tname: fieldName,\n\t\ttypeName: rel.typeName,\n\t\t...ifDefined(\"typeNamespaceId\", rel.typeNamespaceId),\n\t\t...ifDefined(\"typeContractSpaceId\", rel.typeContractSpaceId),\n\t\toptional: rel.optional,\n\t\tlist: rel.list,\n\t\tattributes: attrs,\n\t\tspan: SYNTHETIC_SPAN\n\t};\n}\n//#endregion\n//#region src/core/psl-infer/infer-policy-blocks.ts\nconst POLICY_OPERATION_KEYWORD = {\n\tselect: \"policy_select\",\n\tinsert: \"policy_insert\",\n\tupdate: \"policy_update\",\n\tdelete: \"policy_delete\",\n\tall: \"policy_all\"\n};\n/** The PSL tokenizer's identifier grammar: leading letter/underscore, then letters/digits/`_`/`-`. */\nconst PSL_IDENTIFIER = /^[\\p{L}_][\\p{L}\\p{N}_-]*$/u;\n/** Replaces invalid character runs with `_`; prepends `_` when the first character is invalid. */\nfunction sanitizePolicyHead(raw) {\n\tlet head = raw.replace(/[^\\p{L}\\p{N}_-]+/gu, \"_\");\n\tif (!/^[\\p{L}_]/u.test(head)) head = `_${head}`;\n\treturn head;\n}\n/**\n* Builds one `policy_<operation>` block per introspected policy. Every\n* adopted policy is exact-named: a reprinted body never reliably re-hashes to\n* the live suffix, so `@@map` always carries the physical name and the head\n* is only an identifier. A policy granting to a role whose name is not a\n* legal identifier cannot be authored at all — role references have no\n* `@@map` escape — so it is skipped with a note.\n*/\nfunction buildPolicyBlocks(policiesByTable, modelNameMap, reservedHeads = /* @__PURE__ */ new Set()) {\n\tconst all = [];\n\tfor (const [tableName, policies] of policiesByTable) for (const policy of policies) all.push({\n\t\tpolicy,\n\t\ttableName\n\t});\n\tall.sort((a, b) => {\n\t\tif (a.policy.name !== b.policy.name) return a.policy.name < b.policy.name ? -1 : 1;\n\t\tif (a.tableName !== b.tableName) return a.tableName < b.tableName ? -1 : 1;\n\t\treturn a.policy.operation < b.policy.operation ? -1 : a.policy.operation > b.policy.operation ? 1 : 0;\n\t});\n\tconst usedHeads = new Set(reservedHeads);\n\tconst blocks = [];\n\tconst skipNotesByTable = /* @__PURE__ */ new Map();\n\tfor (const { policy, tableName } of all) {\n\t\tconst modelName = modelNameMap.get(tableName);\n\t\tassertDefined(modelName, `buildPolicyBlocks: policy \"${policy.name}\" targets table \"${tableName}\" with no emitted model; tables and policies come from the same introspection walk`);\n\t\tconst badRole = policy.roles.find((role) => !PSL_IDENTIFIER.test(role));\n\t\tif (badRole !== void 0) {\n\t\t\tconst notes = skipNotesByTable.get(tableName) ?? [];\n\t\t\tnotes.push(`// prisma-next: skipped policy \"${policy.name}\": role \"${badRole}\" is not a valid PSL identifier and role references cannot be escaped`);\n\t\t\tskipNotesByTable.set(tableName, notes);\n\t\t\tcontinue;\n\t\t}\n\t\tlet head = sanitizePolicyHead(parseWireName(policy.name)?.prefix ?? policy.name);\n\t\tif (usedHeads.has(head)) {\n\t\t\tlet n = 2;\n\t\t\twhile (usedHeads.has(`${head}_${n}`)) n += 1;\n\t\t\thead = `${head}_${n}`;\n\t\t}\n\t\tusedHeads.add(head);\n\t\tblocks.push({\n\t\t\tkind: \"policy\",\n\t\t\tkeyword: POLICY_OPERATION_KEYWORD[policy.operation],\n\t\t\tname: head,\n\t\t\tparameters: {\n\t\t\t\ttarget: {\n\t\t\t\t\tkind: \"ref\",\n\t\t\t\t\tidentifier: modelName,\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t},\n\t\t\t\troles: {\n\t\t\t\t\tkind: \"list\",\n\t\t\t\t\titems: policy.roles.map((role) => ({\n\t\t\t\t\t\tkind: \"ref\",\n\t\t\t\t\t\tidentifier: role,\n\t\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t\t})),\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t},\n\t\t\t\t...policy.using !== void 0 ? { using: {\n\t\t\t\t\tkind: \"value\",\n\t\t\t\t\traw: JSON.stringify(policy.using),\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t} } : {},\n\t\t\t\t...policy.withCheck !== void 0 ? { withCheck: {\n\t\t\t\t\tkind: \"value\",\n\t\t\t\t\traw: JSON.stringify(policy.withCheck),\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t} } : {},\n\t\t\t\t...policy.permissive ? {} : { permissive: {\n\t\t\t\t\tkind: \"value\",\n\t\t\t\t\traw: \"false\",\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t} }\n\t\t\t},\n\t\t\tblockAttributes: [{\n\t\t\t\tname: \"map\",\n\t\t\t\targs: [{\n\t\t\t\t\tkind: \"positional\",\n\t\t\t\t\tvalue: `\"${escapePslString(policy.name)}\"`,\n\t\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t\t}],\n\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t}],\n\t\t\tattributes: { map: {\n\t\t\t\targs: { name: policy.name },\n\t\t\t\tspan: SYNTHETIC_SPAN\n\t\t\t} },\n\t\t\tspan: SYNTHETIC_SPAN\n\t\t});\n\t}\n\treturn {\n\t\tblocks,\n\t\tskipNotesByTable\n\t};\n}\n//#endregion\n//#region src/core/psl-infer/postgres-default-mapping.ts\nconst POSTGRES_FUNCTION_ATTRIBUTES = { \"gen_random_uuid()\": \"@default(dbgenerated(\\\"gen_random_uuid()\\\"))\" };\nfunction formatDbGeneratedAttribute(expression) {\n\treturn `@default(dbgenerated(${JSON.stringify(expression)}))`;\n}\nfunction createPostgresDefaultMapping() {\n\treturn {\n\t\tfunctionAttributes: POSTGRES_FUNCTION_ATTRIBUTES,\n\t\tfallbackFunctionAttribute: formatDbGeneratedAttribute\n\t};\n}\n//#endregion\n//#region src/core/psl-infer/postgres-type-map.ts\nconst POSTGRES_TO_PSL = {\n\ttext: \"String\",\n\tbool: \"Boolean\",\n\tboolean: \"Boolean\",\n\tint4: \"Int\",\n\tinteger: \"Int\",\n\tint8: \"BigInt\",\n\tbigint: \"BigInt\",\n\tfloat8: \"Float\",\n\t\"double precision\": \"Float\",\n\tjsonb: \"Jsonb\",\n\tbytea: \"Bytes\"\n};\nconst PRESERVED_NATIVE_TYPES = {\n\t\"character varying\": \"VarChar\",\n\tcharacter: \"Char\",\n\tchar: \"Char\",\n\tvarchar: \"VarChar\",\n\tuuid: \"Uuid\",\n\tinet: \"Inet\",\n\tint2: \"SmallInt\",\n\tsmallint: \"SmallInt\",\n\tfloat4: \"Real\",\n\treal: \"Real\",\n\tnumeric: \"Numeric\",\n\tdecimal: \"Numeric\",\n\ttimestamp: \"Timestamp\",\n\t\"timestamp without time zone\": \"Timestamp\",\n\ttimestamptz: \"Timestamptz\",\n\t\"timestamp with time zone\": \"Timestamptz\",\n\tdate: \"Date\",\n\ttime: \"Time\",\n\t\"time without time zone\": \"Time\",\n\ttimetz: \"Timetz\",\n\t\"time with time zone\": \"Timetz\",\n\tjson: \"Json\"\n};\nconst PARAMETERIZED_NATIVE_TYPES = {\n\t\"character varying\": \"VarChar\",\n\tcharacter: \"Char\",\n\tchar: \"Char\",\n\tvarchar: \"VarChar\",\n\tnumeric: \"Numeric\",\n\tdecimal: \"Numeric\",\n\ttimestamp: \"Timestamp\",\n\ttimestamptz: \"Timestamptz\",\n\ttime: \"Time\",\n\ttimetz: \"Timetz\"\n};\nconst PARAMETERIZED_TYPE_PATTERN = /^(.+?)\\((.+)\\)$/;\nfunction getOwnMappingValue(map, key) {\n\treturn Object.hasOwn(map, key) ? map[key] : void 0;\n}\nfunction splitTypeParameterList(params) {\n\treturn params.split(\",\").map((part) => part.trim()).filter((part) => part.length > 0);\n}\nfunction createPostgresTypeMap(enumTypeNames) {\n\treturn { resolve(nativeType) {\n\t\tif (enumTypeNames?.has(nativeType)) return {\n\t\t\tpslType: { name: nativeType },\n\t\t\tnativeType\n\t\t};\n\t\tconst paramMatch = nativeType.match(PARAMETERIZED_TYPE_PATTERN);\n\t\tif (paramMatch) {\n\t\t\tconst [, baseType = nativeType, params = \"\"] = paramMatch;\n\t\t\tconst typeName = getOwnMappingValue(PARAMETERIZED_NATIVE_TYPES, baseType);\n\t\t\tif (typeName) return {\n\t\t\t\tpslType: {\n\t\t\t\t\tname: typeName,\n\t\t\t\t\targs: splitTypeParameterList(params)\n\t\t\t\t},\n\t\t\t\tnativeType,\n\t\t\t\ttypeParams: {\n\t\t\t\t\tbaseType,\n\t\t\t\t\tparams\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\tconst preservedType = getOwnMappingValue(PRESERVED_NATIVE_TYPES, nativeType);\n\t\tif (preservedType) return {\n\t\t\tpslType: { name: preservedType },\n\t\t\tnativeType\n\t\t};\n\t\tconst pslType = getOwnMappingValue(POSTGRES_TO_PSL, nativeType);\n\t\tif (pslType) return {\n\t\t\tpslType: { name: pslType },\n\t\t\tnativeType\n\t\t};\n\t\treturn {\n\t\t\tunsupported: true,\n\t\t\tnativeType\n\t\t};\n\t} };\n}\n//#endregion\n//#region src/core/psl-infer/infer-psl-contract.ts\n/**\n* Infers a PSL AST (for `printPsl`) from an introspected Postgres schema tree.\n*\n* Target-owned inference: it walks the `PostgresDatabaseSchemaNode` tree and\n* owns the Postgres dialect knowledge — the native type map and default map.\n* Relation inference, name transforms, generic default mapping, and raw-default\n* parsing are shape-neutral utilities imported from the SQL family.\n*\n* The tree's tables (across its namespaces — `contract infer` introspects a\n* single live namespace) are gathered into the model set and emitted in one\n* bucket, alongside native-enum and RLS policy blocks. That bucket is named\n* after the introspected schema when the content needs a `namespace { … }`\n* wrap, and is the flat `UNSPECIFIED_PSL_NAMESPACE_ID` bucket otherwise. This\n* entry point emits nothing else, so its output is always exactly one bucket\n* and byte-identical to the prior flat inference. {@link buildPslDocumentAst}\n* can emit a second, always-flat bucket for content that must stay top-level\n* even under a wrap; no caller asks for one yet.\n*\n* `describedContracts` — the stack's extension packs' already-assembled\n* contracts, each paired with its space id — is consulted while gathering\n* tables: a table whose coordinate `(schemaName, 'table', tableName)` one of\n* those contracts already declares is omitted, before the duplicate-name\n* check below and before relation inference, so it cannot spuriously\n* collide with an app table and never contributes a bare relation field. A\n* surviving table's foreign key into an omitted, pack-owned table is not\n* dropped: {@link resolveForeignKeys} rewrites it into a relation qualified\n* with the pack's space id (`<spaceId>:<namespaceId>.<Model>`) instead.\n*/\nfunction inferPostgresPslContract(tree, describedContracts) {\n\tconst namespaces = Object.values(tree.namespaces);\n\tconst owners = describedContractOwners(describedContracts ?? []);\n\tconst enumDefinitions = /* @__PURE__ */ new Map();\n\tconst packOwnedEnumTypesByNamespace = /* @__PURE__ */ new Map();\n\tconst enumNamespaceNames = /* @__PURE__ */ new Set();\n\tfor (const namespace of namespaces) for (const { typeName, members } of namespace.nativeEnums) {\n\t\tconst owner = owners.get(coordinateKey({\n\t\t\tnamespaceId: namespace.schemaName,\n\t\t\tentityKind: \"native_enum\",\n\t\t\tentityName: typeName\n\t\t}));\n\t\tif (owner !== void 0) {\n\t\t\tconst owned = packOwnedEnumTypesByNamespace.get(namespace.schemaName) ?? /* @__PURE__ */ new Map();\n\t\t\towned.set(typeName, owner.spaceId);\n\t\t\towned.set(`${namespace.schemaName}.${typeName}`, owner.spaceId);\n\t\t\tpackOwnedEnumTypesByNamespace.set(namespace.schemaName, owned);\n\t\t\tcontinue;\n\t\t}\n\t\tenumDefinitions.set(typeName, members);\n\t\tenumNamespaceNames.add(namespace.schemaName);\n\t}\n\tconst tables = {};\n\tconst tableNamespaceNames = /* @__PURE__ */ new Set();\n\tconst rlsEnabledTables = /* @__PURE__ */ new Set();\n\tconst policiesByTable = /* @__PURE__ */ new Map();\n\tfor (const namespace of namespaces) {\n\t\tconst ownedEnumTypes = packOwnedEnumTypesByNamespace.get(namespace.schemaName);\n\t\tfor (const [tableName, table] of Object.entries(namespace.tables)) {\n\t\t\tif (owners.has(coordinateKey({\n\t\t\t\tnamespaceId: namespace.schemaName,\n\t\t\t\tentityKind: \"table\",\n\t\t\t\tentityName: tableName\n\t\t\t}))) continue;\n\t\t\tif (tables[tableName] !== void 0) throw postgresError(\"CONTRACT.INFER_UNSUPPORTED\", `contract infer: duplicate table name \"${tableName}\" across schemas is not yet supported (single-namespace PSL inference emits one flat bucket; multi-namespace \\`namespace { … }\\` output is a later slice).`, { meta: { tableName } });\n\t\t\tif (ownedEnumTypes !== void 0) for (const column of Object.values(table.columns)) {\n\t\t\t\tconst owningSpaceId = ownedEnumTypes.get(column.nativeType);\n\t\t\t\tif (owningSpaceId !== void 0) throw postgresError(\"CONTRACT.INFER_UNSUPPORTED\", `contract infer: column \"${tableName}\".\"${column.name}\" is typed by native enum type \"${column.nativeType}\", which extension pack space \"${owningSpaceId}\" already describes. A cross-space enum-typed column has no authorable PSL form yet; describe the table in that pack's contract or retype the column before re-running contract infer.`, { meta: {\n\t\t\t\t\ttableName,\n\t\t\t\t\tcolumnName: column.name\n\t\t\t\t} });\n\t\t\t}\n\t\t\ttables[tableName] = new SqlTableIR(table);\n\t\t\ttableNamespaceNames.add(namespace.schemaName);\n\t\t\tif (table.rlsEnabled) rlsEnabledTables.add(tableName);\n\t\t\tif (table.policies.length > 0) policiesByTable.set(tableName, table.policies);\n\t\t}\n\t}\n\tlet wrapNamespaceName;\n\tif (enumDefinitions.size > 0 || policiesByTable.size > 0) {\n\t\tconst contentNamespaces = /* @__PURE__ */ new Set([...enumNamespaceNames, ...tableNamespaceNames]);\n\t\tif (contentNamespaces.size > 1) throw postgresError(\"CONTRACT.INFER_UNSUPPORTED\", `contract infer: adopting native enums or RLS policies with content across multiple schemas is not yet supported (single-namespace PSL inference emits one \\`namespace { … }\\` block; multi-namespace output is a later slice). Schemas: ${[...contentNamespaces].sort().join(\", \")}.`, { meta: { schemas: [...contentNamespaces].sort() } });\n\t\twrapNamespaceName = [...contentNamespaces][0];\n\t}\n\tconst { tables: resolvedTables, extraRelationsByTable, crossSpaceFieldNamesByTable, danglingForeignKeysByTable } = resolveForeignKeys(tables, owners);\n\tconst schemaIR = new SqlSchemaIR({ tables: resolvedTables });\n\tconst enumTypeNames = new Set(enumDefinitions.keys());\n\tif (wrapNamespaceName !== void 0) for (const typeName of enumDefinitions.keys()) enumTypeNames.add(`${wrapNamespaceName}.${typeName}`);\n\tconst enumInfo = {\n\t\ttypeNames: enumTypeNames,\n\t\tdefinitions: enumDefinitions\n\t};\n\treturn buildPslDocumentAst(schemaIR, {\n\t\ttypeMap: createPostgresTypeMap(enumInfo.typeNames),\n\t\tdefaultMapping: createPostgresDefaultMapping(),\n\t\tparseRawDefault,\n\t\t...enumDefinitions.size > 0 ? { enumInfo } : {}\n\t}, {\n\t\textraRelationsByTable,\n\t\tcrossSpaceFieldNamesByTable,\n\t\tdanglingForeignKeysByTable\n\t}, wrapNamespaceName, {\n\t\trlsEnabledTables,\n\t\tpoliciesByTable\n\t});\n}\n/**\n* Builds the PSL document for one introspected schema.\n*\n* `namespaceName` wraps the output in `namespace <name> { … }`; omit it for\n* flat output. `topLevelExtensionBlocks` are declarations that must stay\n* top-level even when a wrap applies, such as a recovered domain enum — a\n* family `enum` inside a namespace is a hard diagnostic. They land in their\n* own always-flat bucket when a wrap applies, and in the single flat bucket\n* when none does; either way they print unwrapped.\n*\n* Their names are reserved before the policy blocks are built, so a policy\n* renames itself out of the way. Against the rest of the top-level scope — the\n* models, the native enums, PSL's scalar type names, and the other blocks in\n* the list — a clash throws instead: a block's name is its contract key\n* (`entries.valueSet[name]`, with no `@@map` escape), so it cannot be rewritten\n* here.\n*/\nfunction buildPslDocumentAst(schemaIR, options, foreignKeyExtras, namespaceName, rlsExtras, topLevelExtensionBlocks = []) {\n\tconst { typeMap, defaultMapping, parseRawDefault: rawDefaultParser } = options;\n\tconst { extraRelationsByTable, crossSpaceFieldNamesByTable, danglingForeignKeysByTable } = foreignKeyExtras;\n\tconst modelNames = buildTopLevelNameMap(Object.keys(schemaIR.tables), toModelName, \"model\", \"table\");\n\tconst modelNameMap = new Map([...modelNames].map(([tableName, result]) => [tableName, result.name]));\n\tconst { enumNameMap: bareEnumNameMap, enumBlocks } = buildNativeEnumBlocks(options.enumInfo?.definitions ?? /* @__PURE__ */ new Map(), modelNames);\n\tconst enumNameMap = new Map(bareEnumNameMap);\n\tif (namespaceName !== void 0) for (const [typeName, pslName] of bareEnumNameMap) enumNameMap.set(`${namespaceName}.${typeName}`, pslName);\n\tconst fieldNamesByTable = new Map([...crossSpaceFieldNamesByTable, ...buildFieldNamesByTable(schemaIR.tables)]);\n\tconst { relationsByTable } = inferRelations(schemaIR.tables, modelNameMap);\n\tconst policyEmission = buildPolicyBlocks(rlsExtras?.policiesByTable ?? /* @__PURE__ */ new Map(), modelNameMap, /* @__PURE__ */ new Set([\n\t\t...modelNameMap.values(),\n\t\t...bareEnumNameMap.values(),\n\t\t...topLevelExtensionBlocks.map((block) => block.name)\n\t]));\n\tconst claimedTopLevelNames = /* @__PURE__ */ new Set([\n\t\t...PSL_SCALAR_TYPE_NAMES,\n\t\t...modelNameMap.values(),\n\t\t...bareEnumNameMap.values()\n\t]);\n\tfor (const block of topLevelExtensionBlocks) {\n\t\tif (claimedTopLevelNames.has(block.name)) throw postgresError(\"CONTRACT.NAME_DUPLICATE\", `contract infer: recovered ${block.keyword} \"${block.name}\" collides with a model, a native enum, a PSL scalar type, or another recovered declaration of the same name. Rename the recovered declaration, or exclude it.`, { meta: {\n\t\t\tkind: block.keyword,\n\t\t\tname: block.name\n\t\t} });\n\t\tclaimedTopLevelNames.add(block.name);\n\t}\n\tconst models = [];\n\tfor (const table of Object.values(schemaIR.tables)) models.push(buildModel(table, typeMap, enumNameMap, fieldNamesByTable, defaultMapping, rawDefaultParser, [...relationsByTable.get(table.name) ?? [], ...extraRelationsByTable.get(table.name) ?? []], danglingForeignKeysByTable.get(table.name) ?? [], rlsExtras?.rlsEnabledTables.has(table.name) ?? false, policyEmission.skipNotesByTable.get(table.name) ?? []));\n\tconst sortedModels = topologicalSort(models, schemaIR.tables, modelNameMap);\n\tconst separateTopLevelBucket = namespaceName !== void 0 && namespaceName !== UNSPECIFIED_PSL_NAMESPACE_ID && topLevelExtensionBlocks.length > 0;\n\tconst namespaces = [];\n\tif (separateTopLevelBucket) namespaces.push(makePslNamespace({\n\t\tkind: \"namespace\",\n\t\tname: UNSPECIFIED_PSL_NAMESPACE_ID,\n\t\tentries: makePslNamespaceEntries([], [], topLevelExtensionBlocks),\n\t\tspan: SYNTHETIC_SPAN\n\t}));\n\tnamespaces.push(makePslNamespace({\n\t\tkind: \"namespace\",\n\t\tname: namespaceName ?? UNSPECIFIED_PSL_NAMESPACE_ID,\n\t\tentries: makePslNamespaceEntries(sortedModels, [], [\n\t\t\t...separateTopLevelBucket ? [] : topLevelExtensionBlocks,\n\t\t\t...enumBlocks,\n\t\t\t...policyEmission.blocks\n\t\t]),\n\t\tspan: SYNTHETIC_SPAN\n\t}));\n\treturn {\n\t\tkind: \"document\",\n\t\tsourceId: \"<sql-schema-ir>\",\n\t\tnamespaces,\n\t\tspan: SYNTHETIC_SPAN\n\t};\n}\n//#endregion\n//#region src/exports/control.ts\nfunction postgresRenderDefault(def, column) {\n\tif (def.kind === \"function\") return def.expression;\n\treturn renderDefaultLiteral(def.value, column);\n}\nconst postgresTargetDescriptor = {\n\t...postgresTargetDescriptorMeta,\n\tcontractSerializer: new PostgresContractSerializer(),\n\tschemaVerifier: new PostgresSchemaVerifier(),\n\tinferPslContract(schema, describedContracts) {\n\t\tPostgresDatabaseSchemaNode.assert(schema);\n\t\treturn inferPostgresPslContract(schema, describedContracts);\n\t},\n\tdiffSchema(input) {\n\t\treturn diffPostgresSchema(input);\n\t},\n\tclassifySubjectGranularity: postgresDiffSubjectGranularity,\n\tclassifyEntityKind: postgresDiffSubjectEntityKind,\n\tmigrations: {\n\t\tcreatePlanner(adapter) {\n\t\t\treturn createPostgresMigrationPlanner(adapter);\n\t\t},\n\t\tcreateRunner(family) {\n\t\t\treturn createPostgresMigrationRunner(family);\n\t\t},\n\t\tcontractToSchema(contract, frameworkComponents) {\n\t\t\tconst expander = buildNativeTypeExpander(frameworkComponents);\n\t\t\treturn contractToPostgresDatabaseSchemaNode(blindCast(contract), {\n\t\t\t\tannotationNamespace: \"pg\",\n\t\t\t\t...ifDefined(\"expandNativeType\", expander),\n\t\t\t\trenderDefault: postgresRenderDefault,\n\t\t\t\tresolveDefault: postgresResolveDefault\n\t\t\t});\n\t\t}\n\t},\n\tcreate() {\n\t\treturn {\n\t\t\tfamilyId: \"sql\",\n\t\t\ttargetId: \"postgres\"\n\t\t};\n\t},\n\t/**\n\t* Direct method for SQL-specific usage.\n\t* @deprecated Use migrations.createPlanner() for CLI compatibility.\n\t*/\n\tcreatePlanner(adapter) {\n\t\treturn createPostgresMigrationPlanner(adapter);\n\t},\n\t/**\n\t* Direct method for SQL-specific usage.\n\t* @deprecated Use migrations.createRunner() for CLI compatibility.\n\t*/\n\tcreateRunner(family) {\n\t\treturn createPostgresMigrationRunner(family);\n\t}\n};\n//#endregion\nexport { INSTANT_NOW_GENERATOR_ID, postgresTargetDescriptor as default, instantNowControlDescriptor, postgresRenderDefault };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,cAAc;;;;;AAKpB,SAAS,qBAAqB,OAAO;CACpC,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,KAAK,GAAG,IAAI,QAAQ,QAAQ,QAAQ,KAAK,GAAG,OAAO,OAAO;MAC7F,IAAI,MAAM,QAAQ,GAAG,GAAG,OAAO,OAAO,OAAO,OAAO,CAAC,GAAG,GAAG,CAAC;MAC5D,IAAI,OAAO,QAAQ,UAAU,OAAO,OAAO,qBAAqB,GAAG;MACnE,OAAO,OAAO;CACnB,OAAO,OAAO,OAAO,MAAM;AAC5B;AACA,SAAS,8BAA8B,QAAQ;CAC9C,OAAO,IAAI,wBAAwB,MAAM;AAC1C;AACA,IAAI,0BAA0B,MAAM;CACnC;CACA,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;;;;;;CAMA,MAAM,oBAAoB,SAAS;EAClC,MAAM,SAAS,QAAQ,cAAc,OAAO,KAAK,QAAQ,oBAAoB,QAAQ,UAAU,CAAC,CAAC,MAAM,OAAO,OAAO,oBAAoB,KAAK;EAC9I,MAAM,SAAS,QAAQ;EACvB,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IAAI,uBAAuB;CAC3C,iBAAiB,QAAQ,oBAAoB;EAC5C,2BAA2B,OAAO,MAAM;EACxC,OAAO,yBAAyB,QAAQ,kBAAkB;CAC3D;CACA,WAAW,OAAO;EACjB,OAAO,mBAAmB,KAAK;CAChC;CACA,4BAA4B;CAC5B,oBAAoB;CACpB,YAAY;EACX,cAAc,SAAS;GACtB,OAAO,+BAA+B,OAAO;EAC9C;EACA,aAAa,QAAQ;GACpB,OAAO,8BAA8B,MAAM;EAC5C;EACA,iBAAiB,UAAU,qBAAqB;GAC/C,MAAM,WAAW,wBAAwB,mBAAmB;GAC5D,OAAO,qCAAqC,UAAU,QAAQ,GAAG;IAChE,qBAAqB;IACrB,GAAG,UAAU,oBAAoB,QAAQ;IACzC,eAAe;IACf,gBAAgB;GACjB,CAAC;EACF;CACD;CACA,SAAS;EACR,OAAO;GACN,UAAU;GACV,UAAU;EACX;CACD;;;;;CAKA,cAAc,SAAS;EACtB,OAAO,+BAA+B,OAAO;CAC9C;;;;;CAKA,aAAa,QAAQ;EACpB,OAAO,8BAA8B,MAAM;CAC5C;AACD"}
@@ -13,7 +13,7 @@ import { issueOutcome, orderIssuesByDependencies } from "@prisma/orm-framework/c
13
13
  import { RelationalSchemaNodeKind, SqlSchemaIR } from "@prisma/orm-family-sql/schema-ir/types";
14
14
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
15
15
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
16
- //#region ../../../3-targets/3-targets/postgres/dist/control-policy-HgW6zNnz.mjs
16
+ //#region ../../../3-targets/3-targets/postgres/dist/control-policy-BN8Ouun3.mjs
17
17
  /**
18
18
  * The storage-`entries` coordinate `(entityKind, entityName)` a Postgres diff
19
19
  * node addresses — a table by its name, a native enum by its physical type
@@ -649,7 +649,7 @@ function isNativeEnumSuffixAppend(actualMembers, expectedMembers) {
649
649
  }
650
650
  /** Operator-worded refusal for a native-enum member change beyond a suffix append (design ruling — tests match this verbatim). */
651
651
  function nativeEnumMemberChangeRefusal(options) {
652
- return `Native enum type "${options.ddlSchemaName}"."${options.typeName}" changed beyond appending new values (contract declares [${options.expectedMembers.join(", ")}], database has [${options.actualMembers.join(", ")}]). Prisma Next does not modify a native enum's existing values (rename, removal, reorder) — see https://pris.ly/d/postgres-native-enums. Author the change manually with \`migration new\`.`;
652
+ return `Native enum type "${options.ddlSchemaName}"."${options.typeName}" changed beyond appending new values (contract declares [${options.expectedMembers.join(", ")}], database has [${options.actualMembers.join(", ")}]). Prisma 8 does not modify a native enum's existing values (rename, removal, reorder) — see https://pris.ly/d/postgres-native-enums. Author the change manually with \`migration new\`.`;
653
653
  }
654
654
  /**
655
655
  * Managed native-enum issue -> op lowering. A missing declared type creates
@@ -1135,4 +1135,4 @@ function resolvePostgresNodeIssueControlPolicySubject(issue, contract) {
1135
1135
  //#endregion
1136
1136
  export { planIssues as a, renderPostgresSuppression as c, resolvePostgresNodeIssueControlPolicySubject as d, resolvePostgresNodeIssueCreationFactoryName as f, issueSchemaName as i, resolveNamespaceIdForDdlSchema as l, conflictForDisallowedCall as n, postgresNodeStorageCoordinate as o, issueNode as r, postgresPlannerStrategies as s, coalesceSubtreeIssues as t, resolvePostgresCallControlPolicySubject as u };
1137
1137
 
1138
- //# sourceMappingURL=control-policy-HgW6zNnz-Ds9U3rSS.mjs.map
1138
+ //# sourceMappingURL=control-policy-BN8Ouun3-BtGYeb4f.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-policy-BN8Ouun3-BtGYeb4f.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/control-policy-BN8Ouun3.mjs"],"sourcesContent":["import { r as isPostgresSchema } from \"./postgres-schema-B3t7Zr52.mjs\";\nimport { n as PostgresNativeEnumSchemaNode, o as postgresNodeEntityKind, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, F as buildTargetDetails, M as SetDefaultCall, N as SetNotNullCall, O as RawSqlCall, P as postgresDefaultToDdlColumnDefault, S as DropIndexCall, _ as DisableRowLevelSecurityCall, a as AddNotNullColumnDirectCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, g as DataTransformCall, h as CreateTableCall, i as AddNativeEnumValueCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, o as AddNotNullColumnWithTempDefaultCall, r as AddForeignKeyCall, s as AddPrimaryKeyCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall } from \"./op-factory-call-CSkQdszU.mjs\";\nimport { t as buildExpectedFormatType } from \"./planner-sql-checks-Bcngv5YZ.mjs\";\nimport { n as buildColumnTypeSql, t as buildColumnDefaultSql } from \"./planner-ddl-builders-CsfmnnKR.mjs\";\nimport { n as resolveIdentityValue } from \"./planner-identity-values-BmHn5C6U.mjs\";\nimport { i as hasUniqueConstraint, n as hasForeignKey, t as buildSchemaLookupMap } from \"./planner-schema-lookup-kMIVP2y-.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID, entityAt } from \"@internal/framework-components/ir\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport * as contractFree from \"@internal/sql-relational-core/contract-free\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR } from \"@internal/sql-schema-ir/types\";\nimport { issueOutcome, orderIssuesByDependencies } from \"@internal/framework-components/control\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/core/schema-ir/node-storage-coordinate.ts\n/**\n* The storage-`entries` coordinate `(entityKind, entityName)` a Postgres diff\n* node addresses — a table by its name, a native enum by its physical type\n* name. `undefined` for a node that is not a whole storage entity (a namespace,\n* a column, a policy). Lets ownership/subject resolution treat every entity kind\n* uniformly, the node self-describing its storage identity.\n*/\nfunction postgresNodeStorageCoordinate(node) {\n\tif (PostgresTableSchemaNode.is(node)) {\n\t\tconst entityKind = postgresNodeEntityKind(node.nodeKind);\n\t\treturn entityKind === void 0 ? void 0 : {\n\t\t\tentityKind,\n\t\t\tentityName: node.name\n\t\t};\n\t}\n\tif (PostgresNativeEnumSchemaNode.is(node)) {\n\t\tconst entityKind = postgresNodeEntityKind(node.nodeKind);\n\t\treturn entityKind === void 0 ? void 0 : {\n\t\t\tentityKind,\n\t\t\tentityName: node.typeName\n\t\t};\n\t}\n}\n//#endregion\n//#region src/core/migrations/column-ddl-rendering.ts\n/**\n* Reconstructs the `StorageColumn`-shaped fields the DDL builder functions\n* (`buildColumnTypeSql`, `buildExpectedFormatType`, `resolveIdentityValue`)\n* expect, from a column node's own stamped codec identity (`codecRef` /\n* `codecBaseNativeType` / `codecNamedType`, Decision 5) — never the\n* contract. The builders were written against `StorageColumn` and are\n* unchanged here; only the shape feeding them moves from the contract to\n* the node. An empty `storageTypes` catalog is passed alongside: the\n* node's fields are already resolved past any `typeRef` indirection, so no\n* live lookup is needed, and passing a non-empty catalog would risk a\n* false `typeRef` hit against an unrelated storage type.\n*/\nfunction columnLike(column) {\n\tif (column.codecRef === void 0 || column.codecBaseNativeType === void 0) throw new InternalError(`columnLike: expected column \"${column.name}\" carries no codec identity — the expected tree must be derived via contractToSchemaIR for planning`);\n\treturn {\n\t\tnativeType: column.codecBaseNativeType,\n\t\tcodecId: column.codecRef.codecId,\n\t\tnullable: column.nullable,\n\t\t...ifDefined(\"many\", column.many ?? column.codecRef.many),\n\t\t...ifDefined(\"typeParams\", column.codecRef.typeParams !== void 0 ? blindCast(column.codecRef.typeParams) : void 0),\n\t\t...column.codecNamedType ? { typeRef: \"<resolved>\" } : {},\n\t\t...ifDefined(\"default\", column.resolvedDefault)\n\t};\n}\n/**\n* Builds the `CREATE TABLE` / `ADD COLUMN` DDL column for an expected column\n* node, resolving type rendering from the node's codec identity against the\n* codec hooks the caller holds — the same builder the pre-`plan(start, end)`\n* op-path called, so the output is byte-identical.\n*/\nfunction renderColumnDdl(name, column, codecHooks) {\n\tconst like = columnLike(column);\n\tconst typeSql = buildColumnTypeSql(like, codecHooks, {});\n\tconst ddlDefault = postgresDefaultToDdlColumnDefault(like.default);\n\treturn contractFree.col(name, typeSql, {\n\t\t...!column.nullable ? { notNull: true } : {},\n\t\t...ifDefined(\"default\", ddlDefault),\n\t\t...ifDefined(\"codecRef\", column.codecRef)\n\t});\n}\n/**\n* Builds the `ALTER COLUMN … TYPE` operands for an expected column node.\n*/\nfunction renderColumnAlterType(column, codecHooks) {\n\tconst like = columnLike(column);\n\treturn {\n\t\tqualifiedTargetType: buildColumnTypeSql(like, codecHooks, {}, false),\n\t\tformatTypeExpected: buildExpectedFormatType(like, codecHooks, {})\n\t};\n}\n/**\n* Resolves the identity value (monoid neutral element) SQL literal used as\n* the temporary default when adding a NOT-NULL column with no contract\n* default (`notNullAddColumnCallStrategy`'s shared-temp-default backfill).\n* `null` when the column's type has no built-in/codec-provided identity\n* value.\n*/\nfunction resolveColumnTemporaryDefault(column, codecHooks) {\n\treturn resolveIdentityValue(columnLike(column), codecHooks, {});\n}\n/**\n* The column's `SET DEFAULT` clause SQL, resolved from a column-default\n* diff node. `''` when the node carries no resolved default.\n*/\nfunction renderColumnDefaultSql(defaultNode) {\n\tif (defaultNode.resolved === void 0) return \"\";\n\treturn buildColumnDefaultSql(defaultNode.resolved, {\n\t\tnativeType: defaultNode.nativeTypeContext ?? \"\",\n\t\t...ifDefined(\"many\", defaultNode.many)\n\t});\n}\n//#endregion\n//#region src/core/migrations/planner-strategies.ts\n/**\n* Look up a storage table by its explicit namespace coordinate. Returns\n* `undefined` when the namespace has no table by that name (or no such\n* namespace exists). Callers that get `undefined` MUST treat it as an\n* explicit conflict — never silently fall back to a global default\n* schema or a name-only walk, because that footgun would resolve a\n* stale or duplicate table name to whichever namespace the iteration\n* order surfaced first (a real data-loss hazard in multi-namespace\n* contracts where two namespaces can carry the same table name).\n*/\nfunction tableAt(storage, namespaceId, tableName) {\n\tconst ns = storage.namespaces[namespaceId];\n\tif (ns === void 0) return void 0;\n\treturn ns.entries.table?.[tableName];\n}\n/**\n* Recovers the contract namespace id for a DDL schema name embedded in a\n* diff-issue path (`path[1]`). The strategies need the CONTRACT column/table\n* (for codec-hook reads and eligibility probes the retained subsystems still\n* run) even though the issue itself only carries the resolved DDL schema —\n* this is the reverse of `resolveDdlSchemaForNamespace`.\n*/\nfunction namespaceIdForDdlSchema(ctx, ddlSchemaName) {\n\treturn resolveNamespaceIdForDdlSchema(ctx.toContract, ddlSchemaName);\n}\n/** A `not-equal` column issue whose node pair is narrowed to `SqlColumnIR`. */\nfunction columnNodePair(issue) {\n\tconst node = issueNode(issue);\n\tif (node === void 0 || node.nodeKind !== RelationalSchemaNodeKind.column) return void 0;\n\tif (issue.expected === void 0 || issue.actual === void 0) return void 0;\n\treturn {\n\t\texpected: blindCast(issue.expected),\n\t\tactual: blindCast(issue.actual)\n\t};\n}\nconst notNullBackfillCallStrategy = (issues, ctx) => {\n\tif (!ctx.policy.allowedOperationClasses.includes(\"data\")) return { kind: \"no_match\" };\n\tconst matched = [];\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-found\") continue;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || node.nodeKind !== RelationalSchemaNodeKind.column) continue;\n\t\tconst expected = blindCast(issue.expected);\n\t\tif (expected.nullable !== false || expected.resolvedDefault !== void 0) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\t\tmatched.push(issue);\n\t\tconst ddl = renderColumnDdl(expected.name, expected, ctx.codecHooks);\n\t\tconst nullableSpec = contractFree.col(ddl.name, ddl.type, { ...ddl.codecRef !== void 0 ? { codecRef: ddl.codecRef } : {} });\n\t\tcalls.push(new AddColumnCall(schemaName, tableName, nullableSpec), new DataTransformCall(`backfill-${tableName}-${expected.name}`, `backfill-${tableName}-${expected.name}:check`, `backfill-${tableName}-${expected.name}:run`), new SetNotNullCall(schemaName, tableName, expected.name));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\nconst SAFE_WIDENINGS = /* @__PURE__ */ new Set([\n\t\"int2→int4\",\n\t\"int2→int8\",\n\t\"int4→int8\",\n\t\"float4→float8\"\n]);\n/**\n* Handles `not-equal` column issues whose TYPE differs. `fromContract` is\n* only supplied by `migration plan` — for reconciliation (`db update` /\n* `db init`, `fromContract === null`) this strategy never fires, mirroring\n* the legacy `typeChangeCallStrategy`'s requirement of a prior contract:\n* `mapNodeIssueToCall`'s in-place ALTER covers reconciliation directly.\n*\n* A single node issue can carry BOTH type and nullability drift (Postgres\n* alters in place, so the differ emits one `not-equal` column issue where\n* the legacy coordinate walk emitted two: `type_mismatch` +\n* `nullability_mismatch`). When this strategy consumes the issue for its\n* type portion, it also emits whatever nullability delta the same node pair\n* carries — using the same construction `nullableTighteningCallStrategy` /\n* the mapper's direct dispatch would have used — so the issue is never\n* partially handled.\n*/\nconst typeChangeCallStrategy = (issues, ctx) => {\n\tif (ctx.fromContract === null) return { kind: \"no_match\" };\n\tconst dataAllowed = ctx.policy.allowedOperationClasses.includes(\"data\");\n\tconst matched = [];\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-equal\") continue;\n\t\tconst pair = columnNodePair(issue);\n\t\tif (pair === void 0) continue;\n\t\tconst { expected, actual } = pair;\n\t\tif (!columnTypeChangedNativeOnly(expected, actual)) continue;\n\t\tconst fromType = actual.nativeType;\n\t\tconst toType = expected.nativeType;\n\t\tconst isSafeWidening = SAFE_WIDENINGS.has(`${fromType}→${toType}`);\n\t\tif (!isSafeWidening && !dataAllowed) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\t\tmatched.push(issue);\n\t\tconst { qualifiedTargetType, formatTypeExpected } = renderColumnAlterType(expected, ctx.codecHooks);\n\t\tconst alterOpts = {\n\t\t\tqualifiedTargetType,\n\t\t\tformatTypeExpected,\n\t\t\trawTargetTypeForLabel: qualifiedTargetType\n\t\t};\n\t\tif (isSafeWidening) calls.push(new AlterColumnTypeCall(schemaName, tableName, expected.name, alterOpts));\n\t\telse calls.push(new DataTransformCall(`typechange-${tableName}-${expected.name}`, `typechange-${tableName}-${expected.name}:check`, `typechange-${tableName}-${expected.name}:run`), new AlterColumnTypeCall(schemaName, tableName, expected.name, alterOpts));\n\t\tif (expected.nullable !== actual.nullable) if (expected.nullable) calls.push(new DropNotNullCall(schemaName, tableName, expected.name));\n\t\telse if (dataAllowed) calls.push(new DataTransformCall(`handle-nulls-${tableName}-${expected.name}`, `handle-nulls-${tableName}-${expected.name}:check`, `handle-nulls-${tableName}-${expected.name}:run`), new SetNotNullCall(schemaName, tableName, expected.name));\n\t\telse calls.push(new SetNotNullCall(schemaName, tableName, expected.name));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\n/**\n* Whether the raw (unresolved) native type differs — the SAME comparison\n* `typeChangeCallStrategy` always used (`fromColumn.nativeType !==\n* toColumn.nativeType`), which for the widenable numeric/float types\n* `SAFE_WIDENINGS` lists is identical to the resolved comparison\n* `columnTypeChanged` (in `issue-planner.ts`) performs.\n*/\nfunction columnTypeChangedNativeOnly(expected, actual) {\n\treturn expected.nativeType !== actual.nativeType;\n}\n/**\n* Handles `not-equal` column issues whose type did NOT change but\n* nullability tightened (contract requires NOT NULL, live column is\n* nullable). A type-changed issue's nullability delta (if any) is already\n* handled by `typeChangeCallStrategy`, which runs first — this strategy\n* only ever sees issues that strategy left behind.\n*/\nconst nullableTighteningCallStrategy = (issues, ctx) => {\n\tif (!ctx.policy.allowedOperationClasses.includes(\"data\")) return { kind: \"no_match\" };\n\tconst matched = [];\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-equal\") continue;\n\t\tconst pair = columnNodePair(issue);\n\t\tif (pair === void 0) continue;\n\t\tconst { expected, actual } = pair;\n\t\tif (columnTypeChangedNativeOnly(expected, actual)) continue;\n\t\tif (expected.nullable !== false || actual.nullable !== true) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\t\tmatched.push(issue);\n\t\tcalls.push(new DataTransformCall(`handle-nulls-${tableName}-${expected.name}`, `handle-nulls-${tableName}-${expected.name}:check`, `handle-nulls-${tableName}-${expected.name}:run`), new SetNotNullCall(schemaName, tableName, expected.name));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\n/**\n* Dispatches codec-typed storage types through their codec's\n* `planTypeOperations` hook (the authoritative source for codec-driven DDL\n* such as custom type creation). Codec extension/type ops are not modeled as\n* diff nodes — this strategy drives entirely off `ctx.toContract.storage.types`\n* + codec hooks, consuming nothing from the node issue list (there is no\n* node-vocabulary equivalent of `type_missing` / `enum_values_changed`).\n*/\nconst storageTypePlanCallStrategy = (issues, ctx) => {\n\tconst storageTypes = ctx.toContract.storage.types ?? {};\n\tif (Object.keys(storageTypes).length === 0) return { kind: \"no_match\" };\n\tconst calls = [];\n\tfor (const [typeName, typeInstance] of Object.entries(storageTypes).sort(([a], [b]) => a.localeCompare(b))) {\n\t\tconst codecInstance = typeInstance;\n\t\tconst hook = ctx.codecHooks.get(codecInstance.codecId);\n\t\tif (!hook?.planTypeOperations) continue;\n\t\tconst planResult = hook.planTypeOperations({\n\t\t\ttypeName,\n\t\t\ttypeInstance: codecInstance,\n\t\t\tcontract: ctx.toContract,\n\t\t\tschema: ctx.schema,\n\t\t\tschemaName: ctx.schemaName,\n\t\t\tpolicy: ctx.policy\n\t\t});\n\t\tif (!planResult) continue;\n\t\tfor (const op of planResult.operations) calls.push(new RawSqlCall({\n\t\t\t...op,\n\t\t\ttarget: {\n\t\t\t\tid: op.target.id,\n\t\t\t\tdetails: buildTargetDetails(\"type\", typeName, ctx.schemaName)\n\t\t\t}\n\t\t}));\n\t}\n\tif (calls.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues,\n\t\tcalls\n\t};\n};\n/**\n* Handles `not-found` column issues for NOT NULL columns without a contract\n* default. Replaces the legacy `buildAddColumnItem` non-default branches.\n*\n* Two shapes:\n* - Shared-temp-default safe: emit a single atomic composite op (add\n* nullable → backfill identity value → `SET NOT NULL` → `DROP DEFAULT`).\n* The temp-default value is resolved from the column node's `codecRef`\n* (`resolveColumnTemporaryDefault`, wrapping `resolveIdentityValue`).\n* - Empty-table guarded: emit a hand-built op with a `tableIsEmptyCheck`\n* precheck so the failure message is \"table is not empty\" rather than the\n* raw PG NOT NULL violation.\n*\n* \"Normal\" not-found column cases (nullable or has a contract default) are\n* left for `mapNodeIssueToCall`'s default `AddColumnCall` emission.\n*/\nconst notNullAddColumnCallStrategy = (issues, ctx) => {\n\tconst matched = [];\n\tconst calls = [];\n\tconst schemaLookups = buildSchemaLookupMap(ctx.schema);\n\tconst mutableCodecHooks = ctx.codecHooks;\n\tconst mutableStorageTypes = ctx.storageTypes;\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-found\") continue;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || node.nodeKind !== RelationalSchemaNodeKind.column) continue;\n\t\tconst expected = blindCast(issue.expected);\n\t\tif (expected.nullable !== false || expected.resolvedDefault !== void 0) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst namespaceId = namespaceIdForDdlSchema(ctx, ddlSchemaName);\n\t\tconst schemaName = namespaceId === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchemaName;\n\t\tconst contractTable = tableAt(ctx.toContract.storage, namespaceId, tableName);\n\t\tconst column = contractTable?.columns[expected.name];\n\t\tif (!contractTable || !column) continue;\n\t\tconst schemaTable = ctx.schema.tables[tableName];\n\t\tif (!schemaTable) continue;\n\t\tconst temporaryDefault = resolveColumnTemporaryDefault(expected, ctx.codecHooks);\n\t\tconst schemaLookup = schemaLookups.get(tableName);\n\t\tconst canUseSharedTempDefault = temporaryDefault !== null && canUseSharedTemporaryDefaultStrategy({\n\t\t\ttable: contractTable,\n\t\t\tschemaTable,\n\t\t\tschemaLookup,\n\t\t\tcolumnName: expected.name\n\t\t});\n\t\tmatched.push(issue);\n\t\tif (canUseSharedTempDefault && temporaryDefault !== null) {\n\t\t\tcalls.push(new AddNotNullColumnWithTempDefaultCall({\n\t\t\t\tschemaName,\n\t\t\t\ttableName,\n\t\t\t\tcolumnName: expected.name,\n\t\t\t\tcolumn,\n\t\t\t\tcodecHooks: mutableCodecHooks,\n\t\t\t\tstorageTypes: mutableStorageTypes,\n\t\t\t\ttemporaryDefault\n\t\t\t}));\n\t\t\tcontinue;\n\t\t}\n\t\tcalls.push(new AddNotNullColumnDirectCall(schemaName, tableName, expected.name, renderColumnDdl(expected.name, expected, ctx.codecHooks)));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls\n\t};\n};\nfunction canUseSharedTemporaryDefaultStrategy(options) {\n\tconst { table, schemaTable, schemaLookup, columnName } = options;\n\tif (table.primaryKey?.columns.includes(columnName) && !schemaTable.primaryKey) return false;\n\tfor (const unique of table.uniques) {\n\t\tif (!unique.columns.includes(columnName)) continue;\n\t\tif (!schemaLookup || !hasUniqueConstraint(schemaLookup, unique.columns)) return false;\n\t}\n\tfor (const foreignKey of table.foreignKeys) {\n\t\tif (!foreignKey.source.columns.includes(columnName)) continue;\n\t\tif (!schemaLookup || !hasForeignKey(schemaLookup, foreignKey)) return false;\n\t}\n\treturn true;\n}\n/**\n* Ordered list of Postgres planner strategies, shared by `migration plan`\n* and `db update` / `db init`. The issue planner runs each strategy in\n* order, letting it consume any issues it handles, and routes whatever's\n* left through `mapNodeIssueToCall`. Behavior diverges purely on\n* `policy.allowedOperationClasses`:\n*\n* - When `'data'` is allowed (`migration plan`), the data-safe strategies\n* (`notNullBackfillCallStrategy`, `typeChangeCallStrategy`,\n* `nullableTighteningCallStrategy`) consume their matching issues and emit\n* `DataTransformCall` placeholders or recipe ops.\n*\n* - When `'data'` is not allowed (`db update` / `db init`), the\n* placeholder-emitting strategies short-circuit to `no_match`, leaving\n* the issue for the downstream strategies (`storageTypePlanCallStrategy`,\n* `notNullAddColumnCallStrategy`) or the `mapNodeIssueToCall` default to\n* handle with direct DDL.\n*\n* Codec-typed storage type entries are dispatched through\n* `storageTypePlanCallStrategy`.\n*/\nconst postgresPlannerStrategies = [\n\tnotNullBackfillCallStrategy,\n\ttypeChangeCallStrategy,\n\tnullableTighteningCallStrategy,\n\tstorageTypePlanCallStrategy,\n\tnotNullAddColumnCallStrategy\n];\n//#endregion\n//#region src/core/migrations/issue-planner.ts\nfunction issueConflict(kind, summary, location) {\n\treturn {\n\t\tkind,\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\t...location ? { location } : {}\n\t};\n}\n/**\n* Classifies calls into DDL sequencing buckets. The order matches the\n* legacy walk-schema planner's emission order so `db init` and `db update`\n* produce byte-identical plans for the shared shape (deps → drops → tables\n* → columns → alters → PKs → uniques → indexes → FKs).\n*\n* `dropType` (DROP TYPE for a managed native enum) is its own bucket, ordered\n* after the general drop bucket: a type can only be dropped once every table\n* whose column uses it is gone. A column→enum edge would make this precise,\n* but `coalesceSubtreeIssues` removes the column issue under a whole-table\n* drop, so the edge never reaches the graph; the coarse bucket stands in until\n* that edge lands (the coordinate work is a later slice).\n*/\nfunction classifyCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"createExtension\":\n\t\tcase \"createSchema\":\n\t\tcase \"createNativeEnumType\":\n\t\tcase \"addNativeEnumValue\": return \"dep\";\n\t\tcase \"dropNativeEnumType\": return \"dropType\";\n\t\tcase \"dropTable\":\n\t\tcase \"dropColumn\":\n\t\tcase \"dropConstraint\":\n\t\tcase \"dropCheckConstraint\":\n\t\tcase \"dropIndex\":\n\t\tcase \"dropDefault\": return \"drop\";\n\t\tcase \"addCheckConstraint\":\n\t\tcase \"renameCheckConstraint\": return \"unique\";\n\t\tcase \"createTable\": return \"table\";\n\t\tcase \"enableRowLevelSecurity\":\n\t\tcase \"disableRowLevelSecurity\": return \"rlsEnable\";\n\t\tcase \"createRlsPolicy\": return \"rlsPolicy\";\n\t\tcase \"dropRlsPolicy\": return \"drop\";\n\t\tcase \"addColumn\": return \"column\";\n\t\tcase \"alterColumnType\":\n\t\tcase \"setNotNull\":\n\t\tcase \"dropNotNull\":\n\t\tcase \"setDefault\": return \"alter\";\n\t\tcase \"addPrimaryKey\": return \"primaryKey\";\n\t\tcase \"addUnique\": return \"unique\";\n\t\tcase \"createIndex\":\n\t\tcase \"renameIndex\": return \"index\";\n\t\tcase \"addForeignKey\": return \"foreignKey\";\n\t\tcase \"rawSql\":\n\t\t\tif (call.op?.target?.details?.objectType === \"type\") return \"dep\";\n\t\t\treturn \"alter\";\n\t\tdefault: return \"alter\";\n\t}\n}\nconst DEFAULT_POLICY = { allowedOperationClasses: [\n\t\"additive\",\n\t\"widening\",\n\t\"destructive\",\n\t\"data\"\n] };\nfunction emptySchemaIR() {\n\treturn new SqlSchemaIR({ tables: {} });\n}\nfunction conflictKindForCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"alterColumnType\": return \"typeMismatch\";\n\t\tcase \"setNotNull\":\n\t\tcase \"dropNotNull\": return \"nullabilityConflict\";\n\t\tcase \"addForeignKey\":\n\t\tcase \"dropConstraint\": return \"foreignKeyConflict\";\n\t\tcase \"createIndex\":\n\t\tcase \"renameIndex\":\n\t\tcase \"dropIndex\": return \"indexIncompatible\";\n\t\tcase \"createRlsPolicy\":\n\t\tcase \"dropRlsPolicy\":\n\t\tcase \"renameRlsPolicy\": return \"rlsPolicyIncompatible\";\n\t\tdefault: return \"missingButNonAdditive\";\n\t}\n}\nfunction locationForCall(call) {\n\tconst anyCall = call;\n\tconst location = {};\n\tif (anyCall.tableName) {\n\t\tlocation.entityKind = \"table\";\n\t\tlocation.entityName = anyCall.tableName;\n\t} else if (anyCall.typeName) {\n\t\tlocation.entityKind = \"native_enum\";\n\t\tlocation.entityName = anyCall.typeName;\n\t}\n\tif (anyCall.columnName) location.column = anyCall.columnName;\n\tif (anyCall.indexName) location.index = anyCall.indexName;\n\telse if (anyCall.newIndexName) location.index = anyCall.newIndexName;\n\tif (anyCall.constraintName) location.constraint = anyCall.constraintName;\n\telse if (anyCall.newConstraintName) location.constraint = anyCall.newConstraintName;\n\tif (anyCall.policyName) location.rlsPolicy = anyCall.policyName;\n\telse if (anyCall.policy?.name) location.rlsPolicy = anyCall.policy.name;\n\telse if (anyCall.newPolicyName) location.rlsPolicy = anyCall.newPolicyName;\n\treturn Object.keys(location).length > 0 ? location : void 0;\n}\nfunction conflictForDisallowedCall(call, allowed) {\n\tconst summary = `Operation \"${call.label}\" requires class \"${call.operationClass}\", but policy allows only: ${allowed.join(\", \")}`;\n\tconst location = locationForCall(call);\n\treturn {\n\t\tkind: conflictKindForCall(call),\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\t...location ? { location } : {}\n\t};\n}\n/** The diff node an issue concerns — expected when present, else the actual (extra) node. */\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node);\n}\n/** DDL schema segment of a table-or-descendant issue path: `[database, ddlSchema, table, …]`. */\nfunction issueSchemaName(issue) {\n\treturn issue.path[1];\n}\n/** Table segment of a table-or-descendant issue path: `[database, ddlSchema, table, …]`. */\nfunction issueTableName(issue) {\n\treturn issue.path[2];\n}\n/** Column name embedded in a column/default issue path segment (`column:<name>`). */\nfunction issueColumnName(issue) {\n\tconst segment = issue.path[3];\n\tif (segment === void 0 || !segment.startsWith(\"column:\")) return void 0;\n\treturn segment.slice(7);\n}\n/**\n* The DDL schema name to use when EMITTING an op against `ddlSchemaName` (the\n* diff tree's resolved physical schema, `issueSchemaName(issue)`). The\n* unbound namespace's diff-tree identity resolves to `public` (a concrete\n* physical default the differ needs in order to compare its tree against\n* introspection — `resolveDdlSchemaForNamespaceStorage`), but DDL EMISSION\n* must stay unqualified so the live connection's `search_path` resolves it\n* at runtime (`boundSchema`). Recovers the logical namespace id via the\n* contract and substitutes the unbound sentinel back in when it resolves\n* there; every other namespace's `ddlSchemaName` already agrees between the\n* two resolution paths, so it passes through unchanged.\n*/\nfunction emissionSchemaName(ctx, ddlSchemaName) {\n\treturn resolveNamespaceIdForDdlSchema(ctx.toContract, ddlSchemaName) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchemaName;\n}\n/** Whether the expected/actual native type (resolved, or raw+many fallback) differs — mirrors `SqlColumnIR.isEqualTo`'s type comparison. */\nfunction columnTypeChanged(expected, actual) {\n\tif (expected.resolvedNativeType !== void 0 && actual.resolvedNativeType !== void 0) return expected.resolvedNativeType !== actual.resolvedNativeType;\n\treturn expected.nativeType !== actual.nativeType || Boolean(expected.many) !== Boolean(actual.many);\n}\n/**\n* The generic differ is total: a missing/extra table (or column) emits an\n* issue for itself AND for every node in its subtree. `CreateTable`/`DropTable`\n* and `AddColumn`/`DropColumn` already account for the whole subtree, so the\n* nested issues are redundant — coalescing drops any issue whose path is a\n* strict descendant of a `not-found`/`not-expected` issue's path. Run over the\n* relational subset ONLY (policy issues and synthesized namespace issues are\n* handled on their own paths, never coalesced against tables).\n*/\nfunction coalesceSubtreeIssues(issues) {\n\tconst collapsingPaths = issues.filter((issue) => issueOutcome(issue) !== \"not-equal\").map((issue) => issue.path);\n\tif (collapsingPaths.length === 0) return issues;\n\treturn issues.filter((issue) => !collapsingPaths.some((ancestor) => isStrictDescendantPath(issue.path, ancestor)));\n}\nfunction isStrictDescendantPath(path, ancestor) {\n\tif (path.length <= ancestor.length) return false;\n\tfor (let i = 0; i < ancestor.length; i += 1) if (path[i] !== ancestor[i]) return false;\n\treturn true;\n}\nfunction fkSpecFromNode(fk, tableName) {\n\treturn {\n\t\tname: fk.name ?? `${tableName}_${fk.columns.join(\"_\")}_fkey`,\n\t\tcolumns: [...fk.columns],\n\t\treferences: {\n\t\t\tschema: fk.referencedSchema ?? \"\",\n\t\t\ttable: fk.referencedTable,\n\t\t\tcolumns: [...fk.referencedColumns]\n\t\t},\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate)\n\t};\n}\n/**\n* Builds the `CreateTable` + child `CreateIndex` / `AddForeignKey` / `AddUnique`\n* calls for a newly-expected table, reading only the table node's children. The\n* PK and every declared CHECK go inline as table constraints; indexes\n* (declared + FK-backing, already merged and ordered at derivation) and the\n* FK / unique constraints are separate calls (re-bucketed downstream). Every\n* column's DDL is resolved from its `codecRef` via `renderColumnDdl`.\n*/\nfunction buildCreateTableCallsFromNode(schemaName, ddlSchemaName, table, codecHooks) {\n\tconst ddlColumns = Object.values(table.columns).map((c) => renderColumnDdl(c.name, c, codecHooks));\n\tconst primaryKeyConstraints = table.primaryKey ? [contractFree.primaryKey([...table.primaryKey.columns], { ...ifDefined(\"name\", table.primaryKey.name) })] : [];\n\tconst declaredChecks = (table.checks ?? []).map((c) => contractFree.checkExpression(c.name, c.expression));\n\tconst allTableConstraints = [...primaryKeyConstraints, ...declaredChecks];\n\tconst calls = [new CreateTableCall(schemaName, table.name, ddlColumns, allTableConstraints.length > 0 ? allTableConstraints : void 0)];\n\tfor (const index of table.indexes) calls.push(createIndexCallFromNode(index, schemaName, table.name));\n\tfor (const fk of table.foreignKeys) calls.push(new AddForeignKeyCall(schemaName, table.name, fkSpecFromNode(fk, table.name)));\n\tfor (const unique of table.uniques) {\n\t\tconst constraintName = unique.name ?? `${table.name}_${unique.columns.join(\"_\")}_key`;\n\t\tcalls.push(new AddUniqueCall(schemaName, table.name, constraintName, [...unique.columns]));\n\t}\n\tif (table.rlsEnabled) calls.push(new EnableRowLevelSecurityCall(ddlSchemaName, table.name));\n\treturn calls;\n}\nfunction nodeConflict(kind, message) {\n\treturn issueConflict(kind, message);\n}\n/**\n* True when `actualMembers` (the live database's ordered members) is a\n* strict, order-preserving prefix of `expectedMembers` (the contract's) —\n* the database already carries every contract member, in declaration\n* order, and the contract declares at least one member the database still\n* lacks. Any other relationship — a renamed value, a removed value, a\n* reordering, or the database holding members the contract lacks — is not\n* a suffix append.\n*/\nfunction isNativeEnumSuffixAppend(actualMembers, expectedMembers) {\n\tif (actualMembers.length >= expectedMembers.length) return false;\n\treturn actualMembers.every((member, index) => member === expectedMembers[index]);\n}\n/** Operator-worded refusal for a native-enum member change beyond a suffix append (design ruling — tests match this verbatim). */\nfunction nativeEnumMemberChangeRefusal(options) {\n\treturn `Native enum type \"${options.ddlSchemaName}\".\"${options.typeName}\" changed beyond appending new values (contract declares [${options.expectedMembers.join(\", \")}], database has [${options.actualMembers.join(\", \")}]). Prisma 8 does not modify a native enum's existing values (rename, removal, reorder) — see https://pris.ly/d/postgres-native-enums. Author the change manually with \\`migration new\\`.`;\n}\n/**\n* Managed native-enum issue -> op lowering. A missing declared type creates\n* it; an unclaimed live type drops it (ownership-scoped upstream by\n* `retainUnownedExtras`, destructiveness gated by the operation-class\n* policy); a paired member-value mismatch lowers to one `ALTER TYPE ... ADD\n* VALUE` per appended member when the database's members are a strict,\n* order-preserving prefix of the contract's — any other change (rename,\n* removal, reorder, or the database holding members the contract lacks) is\n* refused with a NAMED diagnostic, never a silent no-op and never a\n* drop-and-recreate.\n*/\nfunction mapNativeEnumNodeIssue(issue, ctx) {\n\tconst ddlSchemaName = issueSchemaName(issue);\n\tif (ddlSchemaName === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Enum issue has no schema in its path: ${issue.path.join(\"/\")}`));\n\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst expected = blindCast(issue.expected);\n\t\treturn ok([new CreateNativeEnumTypeCall(schemaName, expected.typeName, expected.members)]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropNativeEnumTypeCall(schemaName, blindCast(issue.actual).typeName)]);\n\tconst expected = blindCast(issue.expected);\n\tconst actual = blindCast(issue.actual);\n\tif (isNativeEnumSuffixAppend(actual.members, expected.members)) return ok(expected.members.slice(actual.members.length).map((value) => new AddNativeEnumValueCall(schemaName, expected.typeName, value)));\n\treturn notOk(nodeConflict(\"unsupportedOperation\", nativeEnumMemberChangeRefusal({\n\t\tddlSchemaName,\n\t\ttypeName: expected.typeName,\n\t\texpectedMembers: expected.members,\n\t\tactualMembers: actual.members\n\t})));\n}\nfunction mapTableNodeIssue(issue, schemaName, ddlSchemaName, codecHooks) {\n\tif (issueOutcome(issue) === \"not-found\") return ok(buildCreateTableCallsFromNode(schemaName, ddlSchemaName, blindCast(issue.expected), codecHooks));\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropTableCall(schemaName, blindCast(issue.actual).name)]);\n\tconst expected = blindCast(issue.expected);\n\tconst actual = blindCast(issue.actual);\n\tif (expected.rlsEnabled && !actual.rlsEnabled) return ok([new EnableRowLevelSecurityCall(ddlSchemaName, expected.name)]);\n\tif (!expected.rlsEnabled && actual.rlsEnabled) return ok([new DisableRowLevelSecurityCall(ddlSchemaName, expected.name)]);\n\treturn notOk(nodeConflict(\"unsupportedOperation\", `unhandled table-attribute drift on \"${expected.name}\": table not-equal with no rlsEnabled delta (a second table attribute drifted)`));\n}\nfunction mapColumnNodeIssue(issue, schemaName, tableName, codecHooks) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst column = blindCast(issue.expected);\n\t\treturn ok([new AddColumnCall(schemaName, tableName, renderColumnDdl(column.name, column, codecHooks))]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropColumnCall(schemaName, tableName, blindCast(issue.actual).name)]);\n\tconst expected = blindCast(issue.expected);\n\tconst actual = blindCast(issue.actual);\n\tconst calls = [];\n\tif (columnTypeChanged(expected, actual)) {\n\t\tconst { qualifiedTargetType, formatTypeExpected } = renderColumnAlterType(expected, codecHooks);\n\t\tcalls.push(new AlterColumnTypeCall(schemaName, tableName, expected.name, {\n\t\t\tqualifiedTargetType,\n\t\t\tformatTypeExpected,\n\t\t\trawTargetTypeForLabel: qualifiedTargetType\n\t\t}));\n\t}\n\tif (expected.nullable !== actual.nullable) calls.push(expected.nullable ? new DropNotNullCall(schemaName, tableName, expected.name) : new SetNotNullCall(schemaName, tableName, expected.name));\n\treturn ok(calls);\n}\nfunction mapColumnDefaultNodeIssue(issue, schemaName, tableName, columnName) {\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropDefaultCall(schemaName, tableName, columnName)]);\n\tif (issue.expected === void 0) return ok([]);\n\tconst defaultSql = renderColumnDefaultSql(blindCast(issue.expected));\n\tif (!defaultSql) return ok([]);\n\treturn ok([new SetDefaultCall(schemaName, tableName, columnName, defaultSql, issueOutcome(issue) === \"not-equal\" ? \"widening\" : \"additive\")]);\n}\nfunction mapPrimaryKeyNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst pk = blindCast(issue.expected);\n\t\treturn ok([new AddPrimaryKeyCall(schemaName, tableName, pk.name ?? `${tableName}_pkey`, [...pk.columns])]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropConstraintCall(schemaName, tableName, blindCast(issue.actual).name ?? `${tableName}_pkey`, \"primaryKey\")]);\n\treturn notOk(nodeConflict(\"indexIncompatible\", issue.path.join(\"/\")));\n}\nfunction mapForeignKeyNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") return ok([new AddForeignKeyCall(schemaName, tableName, fkSpecFromNode(blindCast(issue.expected), tableName))]);\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst fk = blindCast(issue.actual);\n\t\treturn ok([new DropConstraintCall(schemaName, tableName, fk.name ?? `${tableName}_${fk.columns.join(\"_\")}_fkey`, \"foreignKey\")]);\n\t}\n\treturn notOk(nodeConflict(\"foreignKeyConflict\", issue.path.join(\"/\")));\n}\nfunction mapUniqueNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst unique = blindCast(issue.expected);\n\t\treturn ok([new AddUniqueCall(schemaName, tableName, unique.name ?? `${tableName}_${unique.columns.join(\"_\")}_key`, [...unique.columns])]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst unique = blindCast(issue.actual);\n\t\treturn ok([new DropConstraintCall(schemaName, tableName, unique.name ?? `${tableName}_${unique.columns.join(\"_\")}_key`, \"unique\")]);\n\t}\n\treturn notOk(nodeConflict(\"indexIncompatible\", issue.path.join(\"/\")));\n}\n/**\n* The CreateIndexCall for a name-identified index node: the node's own name\n* verbatim, its element list (column tuple or opaque expression), and the\n* unique/type/options/where attributes carried through.\n*/\nfunction createIndexCallFromNode(index, schemaName, tableName) {\n\tconst extras = {};\n\tif (index.type !== void 0) extras.type = index.type;\n\tif (index.options !== void 0) extras.options = index.options;\n\tif (index.where !== void 0) extras.where = index.where;\n\tif (index.unique) extras.unique = true;\n\treturn new CreateIndexCall(schemaName, tableName, index.name, index.columns !== void 0 ? { columns: [...index.columns] } : { expression: index.expression ?? \"\" }, extras);\n}\nfunction mapIndexNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") return ok([createIndexCallFromNode(blindCast(issue.expected), schemaName, tableName)]);\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropIndexCall(schemaName, tableName, blindCast(issue.actual).name)]);\n\treturn notOk(nodeConflict(\"indexIncompatible\", issue.path.join(\"/\")));\n}\n/**\n* The index treatment: a missing check is added, an undeclared live check is\n* dropped, and a paired divergence is a conflict. `not-equal` is reachable only\n* for an exact-named expected check — a wire-named one compares by name, so a\n* changed predicate re-suffixes the name and arrives as missing + extra\n* instead.\n*/\nfunction mapCheckNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst check = blindCast(issue.expected);\n\t\treturn ok([new AddCheckConstraintCall(schemaName, tableName, check.name, check.expression)]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropCheckConstraintCall(schemaName, tableName, blindCast(issue.actual).name)]);\n\treturn notOk(nodeConflict(\"unsupportedOperation\", issue.path.join(\"/\")));\n}\n/**\n* Maps one node-typed diff issue to its migration call(s), dispatching on the\n* node's `nodeKind` and the issue's presence-derived `issueOutcome`, reading\n* nodes and resolving column DDL from `codecRef` via `column-ddl-rendering.ts`.\n*/\nfunction mapNodeIssueToCall(issue, ctx) {\n\tconst node = issueNode(issue);\n\tif (node === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Issue carries neither an expected nor an actual node: ${issue.path.join(\"/\")}`));\n\tif (node.nodeKind === PostgresSchemaNodeKind.namespace) {\n\t\tif (issueOutcome(issue) !== \"not-found\") return notOk(nodeConflict(\"unsupportedOperation\", `Unexpected namespace drift: ${issue.path.join(\"/\")}`));\n\t\treturn ok([new CreateSchemaCall(blindCast(issue.expected).schemaName)]);\n\t}\n\tif (node.nodeKind === PostgresSchemaNodeKind.nativeEnum) return mapNativeEnumNodeIssue(issue, ctx);\n\tconst ddlSchemaName = issueSchemaName(issue);\n\tconst tableName = issueTableName(issue);\n\tif (ddlSchemaName === void 0 || tableName === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Issue has no schema/table in its path: ${issue.path.join(\"/\")}`));\n\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\tswitch (node.nodeKind) {\n\t\tcase PostgresSchemaNodeKind.table: return mapTableNodeIssue(issue, schemaName, ddlSchemaName, ctx.codecHooks);\n\t\tcase RelationalSchemaNodeKind.column: return mapColumnNodeIssue(issue, schemaName, tableName, ctx.codecHooks);\n\t\tcase RelationalSchemaNodeKind.columnDefault: {\n\t\t\tconst columnName = issueColumnName(issue);\n\t\t\tif (columnName === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Default issue has no column in its path: ${issue.path.join(\"/\")}`));\n\t\t\treturn mapColumnDefaultNodeIssue(issue, schemaName, tableName, columnName);\n\t\t}\n\t\tcase RelationalSchemaNodeKind.primaryKey: return mapPrimaryKeyNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.foreignKey: return mapForeignKeyNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.unique: return mapUniqueNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.index: return mapIndexNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.check: return mapCheckNodeIssue(issue, schemaName, tableName);\n\t\tdefault: return notOk(nodeConflict(\"unsupportedOperation\", `Unhandled node kind: ${node.nodeKind}`));\n\t}\n}\n/**\n* Runs the ordered strategy list over the node-typed diff issues, maps\n* leftover issues via {@link mapNodeIssueToCall}, applies operation-class\n* policy gating, and buckets calls into the fixed DDL emission order (dep →\n* drop → table → column → recipe → alter → primaryKey → unique → index →\n* foreignKey).\n*/\nfunction planIssues(options) {\n\tconst policyProvided = options.policy !== void 0;\n\tconst policy = options.policy ?? DEFAULT_POLICY;\n\tconst schema = options.schema ?? emptySchemaIR();\n\tconst frameworkComponents = options.frameworkComponents ?? [];\n\tconst context = {\n\t\ttoContract: options.toContract,\n\t\tfromContract: options.fromContract,\n\t\tschemaName: options.schemaName,\n\t\tcodecHooks: options.codecHooks,\n\t\tstorageTypes: options.storageTypes,\n\t\tschema,\n\t\tpolicy,\n\t\tframeworkComponents\n\t};\n\tconst strategies = options.strategies ?? postgresPlannerStrategies;\n\tlet remaining = options.issues;\n\tconst recipeCalls = [];\n\tconst bucketablePatternCalls = [];\n\tfor (const strategy of strategies) {\n\t\tconst result = strategy(remaining, context);\n\t\tif (result.kind === \"match\") {\n\t\t\tremaining = result.issues;\n\t\t\tif (result.recipe) recipeCalls.push(...result.calls);\n\t\t\telse bucketablePatternCalls.push(...result.calls);\n\t\t}\n\t}\n\tconst sorted = orderIssuesByDependencies(remaining);\n\tconst defaultCalls = [];\n\tconst conflicts = [];\n\tfor (const issue of sorted) {\n\t\tconst result = mapNodeIssueToCall(issue, context);\n\t\tif (result.ok) defaultCalls.push(...result.value);\n\t\telse conflicts.push(result.failure);\n\t}\n\tconst allowed = policy.allowedOperationClasses;\n\tlet gatedDefault = defaultCalls;\n\tlet gatedRecipe = recipeCalls;\n\tlet gatedBucketable = bucketablePatternCalls;\n\tif (policyProvided) {\n\t\tconst keepIfAllowed = (bucket) => (call) => {\n\t\t\tif (allowed.includes(call.operationClass)) {\n\t\t\t\tbucket.push(call);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconflicts.push(conflictForDisallowedCall(call, allowed));\n\t\t};\n\t\tconst gatedDefaultBucket = [];\n\t\tconst gatedRecipeBucket = [];\n\t\tconst gatedBucketableBucket = [];\n\t\tdefaultCalls.forEach(keepIfAllowed(gatedDefaultBucket));\n\t\trecipeCalls.forEach(keepIfAllowed(gatedRecipeBucket));\n\t\tbucketablePatternCalls.forEach(keepIfAllowed(gatedBucketableBucket));\n\t\tgatedDefault = gatedDefaultBucket;\n\t\tgatedRecipe = gatedRecipeBucket;\n\t\tgatedBucketable = gatedBucketableBucket;\n\t}\n\tif (conflicts.length > 0) return notOk(conflicts);\n\tconst combinedBucketable = [...gatedDefault, ...gatedBucketable];\n\tconst byCategory = (cat) => combinedBucketable.filter((c) => classifyCall(c) === cat);\n\treturn ok({ calls: [\n\t\t...byCategory(\"dep\"),\n\t\t...byCategory(\"drop\"),\n\t\t...byCategory(\"dropType\"),\n\t\t...byCategory(\"table\"),\n\t\t...byCategory(\"column\"),\n\t\t...gatedRecipe,\n\t\t...byCategory(\"alter\"),\n\t\t...byCategory(\"primaryKey\"),\n\t\t...byCategory(\"unique\"),\n\t\t...byCategory(\"index\"),\n\t\t...byCategory(\"foreignKey\"),\n\t\t...byCategory(\"rlsEnable\")\n\t] });\n}\n//#endregion\n//#region src/core/migrations/control-policy.ts\n/**\n* Factory calls that create a whole, previously-absent top-level storage\n* object. Used to decide whether `tolerated` permits a call (it only allows\n* creating absent objects, never modifying existing ones).\n*\n* Deliberately an explicit, closed set rather than a `factoryName`\n* create/alter/drop classification: it answers exactly one yes/no question\n* and is fail-closed. Any call not listed here — including future or\n* extension-contributed factories — is treated as NOT object-creation, so it\n* is suppressed under `tolerated` rather than permissively emitted.\n*\n* Lists the creation factories that actually reach the call-side resolver\n* (`resolvePostgresCallControlPolicySubject`) — today only RLS policy\n* creation, from `planPostgresSchemaDiff`. Every other whole-object create\n* (table, schema, native enum, and RLS enablement) is constructed inside\n* `planIssues` and graded on the node side by\n* `resolvePostgresNodeIssueCreationFactoryName`, so none of them are listed\n* here.\n*/\nconst OBJECT_CREATION_FACTORIES = /* @__PURE__ */ new Set([\"createRlsPolicy\"]);\nfunction createsNewTopLevelObject(call) {\n\treturn OBJECT_CREATION_FACTORIES.has(call.factoryName);\n}\nfunction ddlSchemaNameForNamespace(contract, namespaceId) {\n\tconst namespace = contract.storage.namespaces[namespaceId];\n\treturn isPostgresSchema(namespace) ? namespace.ddlSchemaName(contract.storage) : namespaceId;\n}\n/**\n* Resolve the namespace a declared storage entity lives in by walking every\n* namespace for one whose `entries` map actually contains the coordinate —\n* a table by its name, a native enum by its physical type name (see\n* {@link postgresNodeStorageCoordinate}). When `ddlSchemaName` is given, the\n* match must also land in that DDL schema (disambiguates same-named entities\n* declared under different namespaces); when omitted, the first namespace\n* that declares the entity wins. Falls back to {@link UNBOUND_NAMESPACE_ID}\n* when no namespace declares it — e.g. an extra/dropped entity the contract\n* doesn't claim at all.\n*/\nfunction resolveNamespaceIdForEntity(contract, coordinate, ddlSchemaName) {\n\tfor (const namespaceId of Object.keys(contract.storage.namespaces)) {\n\t\tif (!entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t})) continue;\n\t\tif (ddlSchemaName === void 0 || ddlSchemaNameForNamespace(contract, namespaceId) === ddlSchemaName) return namespaceId;\n\t}\n\treturn UNBOUND_NAMESPACE_ID;\n}\nfunction resolveNamespaceIdForTable(contract, tableName, ddlSchemaName) {\n\treturn resolveNamespaceIdForEntity(contract, {\n\t\tentityKind: \"table\",\n\t\tentityName: tableName\n\t}, ddlSchemaName);\n}\nfunction resolveNamespaceIdForDdlSchema(contract, ddlSchemaName) {\n\tfor (const namespaceId of Object.keys(contract.storage.namespaces)) {\n\t\tconst ns = contract.storage.namespaces[namespaceId];\n\t\tif (isPostgresSchema(ns) && ns.ddlSchemaName(contract.storage) === ddlSchemaName) return namespaceId;\n\t\tif (namespaceId === ddlSchemaName) return namespaceId;\n\t}\n\treturn UNBOUND_NAMESPACE_ID;\n}\nfunction postgresCallFields(call) {\n\treturn {\n\t\t...ifDefined(\"schemaName\", \"schemaName\" in call ? call.schemaName : void 0),\n\t\t...ifDefined(\"tableName\", \"tableName\" in call ? call.tableName : void 0),\n\t\t...ifDefined(\"columnName\", \"columnName\" in call ? call.columnName : void 0)\n\t};\n}\nfunction formatSuppressionSubjectLabel(subject, contract) {\n\tif (subject === void 0) return \"unknown\";\n\tconst ddlSchema = ddlSchemaNameForNamespace(contract, subject.namespaceId);\n\tif (subject.entityKind !== void 0 && subject.entityName !== void 0) {\n\t\tconst entityLabel = `${subject.entityKind} \"${ddlSchema}.${subject.entityName}\"`;\n\t\treturn subject.rlsPolicy !== void 0 ? `RLS policy \"${subject.rlsPolicy}\" on ${entityLabel}` : entityLabel;\n\t}\n\treturn `namespace \"${ddlSchema}\"`;\n}\nfunction postgresSuppressionSummary(subjectLabel, subject, policy) {\n\tconst namespace = subject?.namespaceId ?? \"unknown\";\n\tconst declared = subject?.explicitNodeControlPolicy;\n\tif (policy === \"external\" && declared === \"managed\") return `control policy suppressed: ${subjectLabel} — namespace '${namespace}' has effective control 'external' but declared 'managed'`;\n\treturn `control policy suppressed: ${subjectLabel} — namespace '${namespace}' has effective control '${policy}'${declared ? ` but declared '${declared}'` : \"\"}`;\n}\n/**\n* Render one family {@link SuppressionRecord} into a target `SqlPlannerConflict`.\n* The family decides *that* a subject is suppressed and hands over the raw\n* coordinate + policy; the label, message, and location are rendered here,\n* driven entirely by the subject's own `(entityKind, entityName)` coordinate\n* — no target-owned table-vs-enum vocabulary.\n*/\nfunction renderPostgresSuppression(record, contract) {\n\tconst subject = record.subject;\n\treturn {\n\t\tkind: \"controlPolicySuppressedCall\",\n\t\tsummary: postgresSuppressionSummary(formatSuppressionSubjectLabel(subject, contract), subject, record.policy),\n\t\tlocation: {\n\t\t\t...ifDefined(\"namespaceId\", subject?.namespaceId),\n\t\t\t...ifDefined(\"entityKind\", subject?.entityKind),\n\t\t\t...ifDefined(\"entityName\", subject?.entityName),\n\t\t\t...ifDefined(\"column\", subject?.column),\n\t\t\t...ifDefined(\"rlsPolicy\", subject?.rlsPolicy)\n\t\t},\n\t\tmeta: {\n\t\t\tcontrolPolicy: record.policy,\n\t\t\t...ifDefined(\"factoryName\", record.factoryName),\n\t\t\t...ifDefined(\"rlsPolicy\", subject?.rlsPolicy),\n\t\t\t...ifDefined(\"declaredControlPolicy\", subject?.explicitNodeControlPolicy)\n\t\t}\n\t};\n}\nfunction resolvePostgresCallControlPolicySubject(call, contract) {\n\tconst callFields = postgresCallFields(call);\n\tconst createsNewObject = createsNewTopLevelObject(call);\n\tif (call.factoryName === \"createSchema\" && callFields.schemaName) return {\n\t\tnamespaceId: resolveNamespaceIdForDdlSchema(contract, callFields.schemaName),\n\t\tcreatesNewObject\n\t};\n\tif (callFields.tableName) {\n\t\tconst namespaceId = resolveNamespaceIdForTable(contract, callFields.tableName, callFields.schemaName);\n\t\tconst tableControlPolicy = entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: callFields.tableName\n\t\t})?.control;\n\t\treturn {\n\t\t\tnamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: callFields.tableName,\n\t\t\t...ifDefined(\"column\", callFields.columnName),\n\t\t\t...ifDefined(\"explicitNodeControlPolicy\", tableControlPolicy),\n\t\t\tcreatesNewObject\n\t\t};\n\t}\n\tif (callFields.schemaName) return {\n\t\tnamespaceId: resolveNamespaceIdForDdlSchema(contract, callFields.schemaName),\n\t\tcreatesNewObject\n\t};\n}\n/**\n* Node kinds whose *absence* is the creation of a whole, top-level Postgres\n* object: a namespace, a table, or a native enum. Used by\n* {@link resolvePostgresNodeIssueCreationFactoryName} to decide whether a\n* `tolerated` subject permits the issue to flow into the planner\n* (create-if-absent) and to seed the suppressed-subject warning's\n* `factoryName` when the planner is skipped. RLS policy creation is not\n* listed here — policy issues never reach this issue-based partition (they\n* are routed to `planPostgresSchemaDiff` and gated via the call-based\n* {@link resolvePostgresCallControlPolicySubject} instead).\n*/\nconst POSTGRES_NODE_CREATION_FACTORY = Object.freeze({\n\t[PostgresSchemaNodeKind.namespace]: \"createSchema\",\n\t[PostgresSchemaNodeKind.table]: \"createTable\",\n\t[PostgresSchemaNodeKind.nativeEnum]: \"createNativeEnumType\"\n});\n/**\n* A table `not-equal` issue whose `rlsEnabled` flips OFF→ON (expected on,\n* actual off) is enablement toward `ENABLE ROW LEVEL SECURITY`. It is\n* creation-class on the node side because `isEnablementCreationIssue` and\n* {@link resolvePostgresNodeIssueCreationFactoryName} treat this OFF→ON delta\n* as a creation: enabling RLS establishes the fail-closed guard the declared\n* policy set attaches to, the same grant `tolerated` extends to creating the\n* policies themselves. The opposite direction (`DISABLE`) is a modification\n* and stays managed-only. Keying on the actual delta (not just the expected\n* bit) keeps this correct if a second table attribute ever joins\n* `isEqualTo`: a not-equal with no `rlsEnabled` delta is not enablement, so\n* it is not admitted as creation-class here.\n*/\nfunction isEnablementCreationIssue(issue) {\n\tif (issueOutcome(issue) !== \"not-equal\") return false;\n\tconst { expected, actual } = issue;\n\treturn expected !== void 0 && actual !== void 0 && PostgresTableSchemaNode.is(expected) && PostgresTableSchemaNode.is(actual) && expected.rlsEnabled === true && actual.rlsEnabled === false;\n}\nfunction resolvePostgresNodeIssueCreationFactoryName(issue) {\n\tif (isEnablementCreationIssue(issue)) return \"enableRowLevelSecurity\";\n\tif (issueOutcome(issue) !== \"not-found\") return void 0;\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn POSTGRES_NODE_CREATION_FACTORY[node.nodeKind];\n}\n/**\n* Resolves the control-policy subject for a node-typed {@link SchemaDiffIssue}\n* (the issue-side mirror of `resolvePostgresCallControlPolicySubject`).\n* Storage entities resolve off their node coordinate; a sub-entity issue\n* resolves off the enclosing table read from the issue path; an unclaimed\n* extra falls back to the unbound coordinate. A role always resolves\n* `'external'` — roles are referenced, never owned.\n*/\nfunction resolvePostgresNodeIssueControlPolicySubject(issue, contract) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\tif (node.nodeKind === PostgresSchemaNodeKind.namespace) return {\n\t\tnamespaceId: resolveNamespaceIdForDdlSchema(contract, blindCast(node).schemaName),\n\t\tcreatesNewObject: issueOutcome(issue) === \"not-found\"\n\t};\n\tif (node.nodeKind === PostgresSchemaNodeKind.role) {\n\t\tconst roleName = issue.path[1];\n\t\treturn {\n\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\texplicitNodeControlPolicy: (roleName === void 0 ? void 0 : entityAt(contract.storage, {\n\t\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\t\tentityKind: \"role\",\n\t\t\t\tentityName: roleName\n\t\t\t}))?.control ?? \"external\",\n\t\t\tcreatesNewObject: false\n\t\t};\n\t}\n\tconst coordinate = postgresNodeStorageCoordinate(node);\n\tif (coordinate !== void 0) {\n\t\tconst namespaceId = resolveNamespaceIdForEntity(contract, coordinate, issue.path[1]);\n\t\tconst entityControl = entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t})?.control;\n\t\treturn {\n\t\t\tnamespaceId,\n\t\t\t...coordinate,\n\t\t\t...ifDefined(\"column\", issueColumnName(issue)),\n\t\t\t...ifDefined(\"explicitNodeControlPolicy\", entityControl),\n\t\t\tcreatesNewObject: resolvePostgresNodeIssueCreationFactoryName(issue) !== void 0\n\t\t};\n\t}\n\tconst tableName = issue.path[2];\n\tif (tableName === void 0) return void 0;\n\tconst ddlSchemaName = issue.path[1];\n\tconst namespaceId = resolveNamespaceIdForTable(contract, tableName, ddlSchemaName);\n\tconst table = entityAt(contract.storage, {\n\t\tnamespaceId,\n\t\tentityKind: \"table\",\n\t\tentityName: tableName\n\t});\n\treturn {\n\t\tnamespaceId,\n\t\tentityKind: \"table\",\n\t\tentityName: tableName,\n\t\t...ifDefined(\"column\", issueColumnName(issue)),\n\t\t...ifDefined(\"explicitNodeControlPolicy\", table?.control),\n\t\tcreatesNewObject: resolvePostgresNodeIssueCreationFactoryName(issue) !== void 0\n\t};\n}\n//#endregion\nexport { resolvePostgresNodeIssueCreationFactoryName as a, issueNode as c, postgresPlannerStrategies as d, postgresNodeStorageCoordinate as f, resolvePostgresNodeIssueControlPolicySubject as i, issueSchemaName as l, resolveNamespaceIdForDdlSchema as n, coalesceSubtreeIssues as o, resolvePostgresCallControlPolicySubject as r, conflictForDisallowedCall as s, renderPostgresSuppression as t, planIssues as u };\n\n//# sourceMappingURL=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AK,IAAI,SAAS,SAAS,SAAS;IACrF,aAAa;IACb,YAAY;IACZ,YAAY;GACb,CAAC,EAAA,EAAI,WAAW;GAChB,kBAAkB;EACnB;CACD;CACA,MAAM,aAAa,8BAA8B,IAAI;CACrD,IAAI,eAAe,KAAK,GAAG;EAC1B,MAAM,cAAc,4BAA4B,UAAU,YAAY,MAAM,KAAK,EAAE;EACnF,MAAM,gBAAgB,SAAS,SAAS,SAAS;GAChD;GACA,GAAG;EACJ,CAAC,CAAC,EAAE;EACJ,OAAO;GACN;GACA,GAAG;GACH,GAAG,UAAU,UAAU,gBAAgB,KAAK,CAAC;GAC7C,GAAG,UAAU,6BAA6B,aAAa;GACvD,kBAAkB,4CAA4C,KAAK,MAAM,KAAK;EAC/E;CACD;CACA,MAAM,YAAY,MAAM,KAAK;CAC7B,IAAI,cAAc,KAAK,GAAG,OAAO,KAAK;CACtC,MAAM,gBAAgB,MAAM,KAAK;CACjC,MAAM,cAAc,2BAA2B,UAAU,WAAW,aAAa;CACjF,MAAM,QAAQ,SAAS,SAAS,SAAS;EACxC;EACA,YAAY;EACZ,YAAY;CACb,CAAC;CACD,OAAO;EACN;EACA,YAAY;EACZ,YAAY;EACZ,GAAG,UAAU,UAAU,gBAAgB,KAAK,CAAC;EAC7C,GAAG,UAAU,6BAA6B,OAAO,OAAO;EACxD,kBAAkB,4CAA4C,KAAK,MAAM,KAAK;CAC/E;AACD"}
@@ -4,7 +4,7 @@ import { n as postgresResolveDefault } from "./default-normalizer-Ba5ZebHM-isV86
4
4
  import { a as postgresDiffSubjectGranularity, n as PostgresSchemaNodeKind, r as PostgresTableSchemaNode, t as PostgresNativeEnumSchemaNode } from "./postgres-table-schema-node-BBkitBQh-DT1T5VWU.mjs";
5
5
  import { i as PostgresRoleSchemaNode, n as PostgresNamespaceSchemaNode, r as PostgresPolicySchemaNode, t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs";
6
6
  import { t as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-Cab6g5MC-SRco-A7L.mjs";
7
- import { d as resolvePostgresNodeIssueControlPolicySubject } from "./control-policy-HgW6zNnz-Ds9U3rSS.mjs";
7
+ import { d as resolvePostgresNodeIssueControlPolicySubject } from "./control-policy-BN8Ouun3-BtGYeb4f.mjs";
8
8
  import { blindCast } from "@prisma/orm-framework/utils/casts";
9
9
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
10
10
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -13,7 +13,7 @@ import { diffSchemas, issueOutcome } from "@prisma/orm-framework/components/cont
13
13
  import { buildNativeTypeExpander, contractNamespaceToSchemaIR } from "@prisma/orm-family-sql/family/control";
14
14
  import { PrimaryKey, RelationalSchemaNodeKind, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from "@prisma/orm-family-sql/schema-ir/types";
15
15
  import { classifyDiffSubjectGranularity } from "@prisma/orm-family-sql/family/diff";
16
- //#region ../../../3-targets/3-targets/postgres/dist/diff-database-schema-B27W13mM.mjs
16
+ //#region ../../../3-targets/3-targets/postgres/dist/diff-database-schema-C9UxdmYu.mjs
17
17
  /** The database root's fixed sentinel id (`PostgresDatabaseSchemaNode#id`). */
18
18
  function databaseStep() {
19
19
  return {
@@ -387,4 +387,4 @@ function buildPostgresPlanDiff(input) {
387
387
  //#endregion
388
388
  export { contractToPostgresDatabaseSchemaNode as n, diffPostgresSchema as r, buildPostgresPlanDiff as t };
389
389
 
390
- //# sourceMappingURL=diff-database-schema-B27W13mM-DmRNUFyg.mjs.map
390
+ //# sourceMappingURL=diff-database-schema-C9UxdmYu-BzQjQb1e.mjs.map