@prisma/orm-target-postgres 8.0.0-rc.17-dev.6 → 8.0.0-rc.17-dev.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/adapter__control.mjs +2 -2
  2. package/dist/adapter__runtime.mjs +1 -1
  3. package/dist/{authoring-CL05jlfX-CKUKjRVV.mjs → authoring-BsVnEibY-DEWnQRiF.mjs} +62 -55
  4. package/dist/authoring-BsVnEibY-DEWnQRiF.mjs.map +1 -0
  5. package/dist/{authoring-CLNoGwgA-DPDmJeBt.d.mts → authoring-DWd5pnnV-g81c_ETF.d.mts} +10 -10
  6. package/dist/authoring-DWd5pnnV-g81c_ETF.d.mts.map +1 -0
  7. package/dist/{control-CDAHFmyX.mjs → control-KIoUTWJ_.mjs} +48 -9
  8. package/dist/control-KIoUTWJ_.mjs.map +1 -0
  9. package/dist/{descriptor-meta-ClvaJRgh-Dlo6A0nL.mjs → descriptor-meta-DkzkByC8-WIm-Vvrd.mjs} +3 -3
  10. package/dist/{descriptor-meta-ClvaJRgh-Dlo6A0nL.mjs.map → descriptor-meta-DkzkByC8-WIm-Vvrd.mjs.map} +1 -1
  11. package/dist/{infer-psl-contract-lnoCopbJ-DRVPVZyI.mjs → infer-psl-contract-D0iF_YRT-DwW3Imk5.mjs} +62 -16
  12. package/dist/infer-psl-contract-D0iF_YRT-DwW3Imk5.mjs.map +1 -0
  13. package/dist/migration-PTHAY9Cv.mjs.map +1 -1
  14. package/dist/{pack-C3Y2SBNH.d.mts → pack-BOVET-UW.d.mts} +3 -3
  15. package/dist/{pack-C3Y2SBNH.d.mts.map → pack-BOVET-UW.d.mts.map} +1 -1
  16. package/dist/{planner-BLGCBKzQ-BFmyE8A2.mjs → planner-an3B45Ri-2-1c8dYN.mjs} +4 -4
  17. package/dist/{planner-BLGCBKzQ-BFmyE8A2.mjs.map → planner-an3B45Ri-2-1c8dYN.mjs.map} +1 -1
  18. package/dist/{planner-produced-postgres-migration-8cUeUjsL-DwO8p6_t.mjs → planner-produced-postgres-migration-LNElx7_r-B4yTRRyt.mjs} +3 -3
  19. package/dist/{planner-produced-postgres-migration-8cUeUjsL-DwO8p6_t.mjs.map → planner-produced-postgres-migration-LNElx7_r-B4yTRRyt.mjs.map} +1 -1
  20. package/dist/{postgres-contract-view-BpZ_4qOD-BuCMIaSB.mjs → postgres-contract-view-BpmiHSDZ-C6ntn6T7.mjs} +3 -3
  21. package/dist/{postgres-contract-view-BpZ_4qOD-BuCMIaSB.mjs.map → postgres-contract-view-BpmiHSDZ-C6ntn6T7.mjs.map} +1 -1
  22. package/dist/{postgres-migration-Deb4XrMA-DO7iGvl2.mjs → postgres-migration-BtlvhcXs-UjWm8cAb.mjs} +3 -3
  23. package/dist/{postgres-migration-Deb4XrMA-DO7iGvl2.mjs.map → postgres-migration-BtlvhcXs-UjWm8cAb.mjs.map} +1 -1
  24. package/dist/{prisma7-binding-C1fIMMTb.d.mts → prisma7-binding-BQ5VOUjh.d.mts} +3 -3
  25. package/dist/{prisma7-binding-C1fIMMTb.d.mts.map → prisma7-binding-BQ5VOUjh.d.mts.map} +1 -1
  26. package/dist/{prisma7-binding-DE7hezAQ.mjs → prisma7-binding-Dq-vT_9_.mjs} +4 -4
  27. package/dist/{prisma7-binding-DE7hezAQ.mjs.map → prisma7-binding-Dq-vT_9_.mjs.map} +1 -1
  28. package/dist/target.d.mts +2 -2
  29. package/dist/target.mjs +7 -7
  30. package/dist/target__control.mjs +3 -3
  31. package/dist/target__migration.mjs +1 -1
  32. package/dist/target__pack.d.mts +1 -1
  33. package/dist/target__pack.mjs +1 -1
  34. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  35. package/dist/target__planner.mjs +1 -1
  36. package/dist/target__prisma7-binding.d.mts +1 -1
  37. package/dist/target__prisma7-binding.mjs +1 -1
  38. package/dist/target__runtime.mjs +2 -2
  39. package/dist/target__runtime.mjs.map +1 -1
  40. package/package.json +9 -9
  41. package/dist/authoring-CL05jlfX-CKUKjRVV.mjs.map +0 -1
  42. package/dist/authoring-CLNoGwgA-DPDmJeBt.d.mts.map +0 -1
  43. package/dist/control-CDAHFmyX.mjs.map +0 -1
  44. package/dist/infer-psl-contract-lnoCopbJ-DRVPVZyI.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"postgres-migration-Deb4XrMA-DO7iGvl2.mjs","names":["#current","#endView","#startView","#renames"],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-migration-Deb4XrMA.mjs"],"sourcesContent":["import { t as errorPostgresMigrationStackMissing } from \"./errors-DYyzTYzE.mjs\";\nimport { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { _ as PostgresRlsPolicy } from \"./postgres-schema-DIaAgaL6.mjs\";\nimport { n as postgresResolveDefault } from \"./default-normalizer-Bf_Fhv4v.mjs\";\nimport { r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { t as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-b746rtzf.mjs\";\nimport { r as contractToPostgresDatabaseSchemaNode, t as buildPostgresPlanDiff } from \"./diff-database-schema-CByLrBg6.mjs\";\nimport { c as issueNode, n as resolveNamespaceIdForDdlSchema } from \"./control-policy-DbDoLxrp.mjs\";\nimport { A as RenameConstraintCall, B as renameTableStatement, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, F as SetNotNullCall, H as installExtension, M as RenamePostgresRlsPolicyCall, N as RenameTableCall, P as SetDefaultCall, S as DropIndexCall, T as DropPostgresRlsPolicyCall, _ as DisableRowLevelSecurityCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, h as CreateTableCall, i as AddNativeEnumValueCall, j as RenameIndexCall, k as RenameColumnCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, p as CreatePostgresRlsPolicyCall, 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-BfGiIbUO.mjs\";\nimport { n as renderDefaultLiteral } from \"./planner-ddl-builders-Y0_96xpe.mjs\";\nimport { n as defaultPrimaryKeyName, r as defaultUniqueName, t as defaultForeignKeyName } from \"./default-constraint-names-CtcRXhV8.mjs\";\nimport { t as PostgresContractView } from \"./postgres-contract-view-BpZ_4qOD.mjs\";\nimport { t as dataTransform } from \"./data-transform-Bo32KRbq.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { resolveColumnRenameAgainst, resolveTableRenameAgainst, sqlTypeLookupsOf, unmatchedColumnRename, unmatchedTableRename } from \"@internal/family-sql/control\";\nimport { namingOf, namingOfLiveName, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlCheckConstraintIR, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from \"@internal/sql-schema-ir/types\";\nimport { isArrayEqual } from \"@internal/utils/array-equal\";\nimport { errorMigrationOperationOptionRemoved } from \"@internal/errors/migration\";\nimport { Migration } from \"@internal/family-sql/migration\";\nimport { MigrationContractViews } from \"@internal/migration-tools/migration\";\n//#region src/core/migrations/postgres-contract-to-schema.ts\nfunction postgresRenderDefault(def, column, type) {\n\tif (def.kind === \"function\") return def.expression;\n\treturn renderDefaultLiteral(def.value, {\n\t\tmany: column.many,\n\t\t...type\n\t});\n}\n/**\n* The Postgres schema tree a contract describes, as the planner's \"from\" side:\n* the target descriptor's `migrations.contractToSchema` hook and the trees\n* `renameTable` compares to find its companion renames both go through here,\n* so they are built with the same type lookups, default renderer and default resolver.\n*/\nfunction postgresContractToSchema(contract, frameworkComponents) {\n\tconst types = sqlTypeLookupsOf(frameworkComponents);\n\treturn contractToPostgresDatabaseSchemaNode(blindCast(contract), {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\trenderDefault: postgresRenderDefault,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n}\n//#endregion\n//#region src/core/migrations/index-and-check-renames.ts\n/**\n* Rename post-pass for indexes, per `(schema, table)`, widening-only,\n* deterministic by sorted names — the same structure as the policy pass\n* below (which stays untouched: policies pair by hash only).\n*\n* Hash pairing (prefix-only renames): extras whose live names parse as\n* wire names, grouped by `(schema, table, hash)`; missing nodes iterated\n* in sorted-name order consume the sorted-name-first candidate.\n*\n* Content pairing (exact→wire convergence), after hash pairing has\n* consumed its matches: the remaining wire-named-missing nodes\n* (`prefix` defined) against the remaining extras of any name shape,\n* paired iff content-equal (columns ordered-strict both-defined-or-\n* both-undefined, `unique`/`type` strict, `options` loose, bodies\n* byte-equal).\n*\n* Leftovers proceed as create/drop exactly as before; without the\n* widening allowance the pass is skipped and pairing degrades to the\n* additive half, like the policy pass.\n*/\nfunction pairIndexRenames(options, issues) {\n\tconst consumed = /* @__PURE__ */ new Set();\n\tconst calls = [];\n\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst missing = [];\n\tconst extra = [];\n\tfor (const issue of issues) {\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || !SqlIndexIR.is(node)) continue;\n\t\tconst ddlSchema = issue.path[1];\n\t\tconst tableName = issue.path[2];\n\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t}\n\tif (missing.length === 0 || extra.length === 0) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\tfinding.ddlSchema,\n\t\tfinding.tableName,\n\t\thash\n\t]);\n\tconst rename = (missingFinding, candidate) => {\n\t\tconsumed.add(missingFinding.issue);\n\t\tconsumed.add(candidate.issue);\n\t\tcalls.push(new RenameIndexCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, candidate.node.name, missingFinding.node.name));\n\t};\n\tconst sortedMissing = [...missing].sort(byName);\n\tconst extrasByHash = /* @__PURE__ */ new Map();\n\tfor (const finding of extra) {\n\t\tconst parsed = parseWireName(finding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst key = pairingKey(finding, parsed.hash);\n\t\tconst group = extrasByHash.get(key) ?? [];\n\t\tgroup.push(finding);\n\t\textrasByHash.set(key, group);\n\t}\n\tfor (const group of extrasByHash.values()) group.sort(byName);\n\tfor (const missingFinding of sortedMissing) {\n\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\tif (candidate === void 0) continue;\n\t\trename(missingFinding, candidate);\n\t}\n\tconst sortedExtras = [...extra].sort(byName);\n\tfor (const missingFinding of sortedMissing) {\n\t\tif (consumed.has(missingFinding.issue)) continue;\n\t\tif (missingFinding.node.prefix === void 0) continue;\n\t\tconst candidate = sortedExtras.find((extraFinding) => !consumed.has(extraFinding.issue) && extraFinding.ddlSchema === missingFinding.ddlSchema && extraFinding.tableName === missingFinding.tableName && missingFinding.node.contentEquals(extraFinding.node, {\n\t\t\tcolumnPresence: \"matching\",\n\t\t\tbodies: \"verbatim\"\n\t\t}));\n\t\tif (candidate === void 0) continue;\n\t\trename(missingFinding, candidate);\n\t}\n\treturn {\n\t\tcalls,\n\t\tconsumed\n\t};\n}\n/**\n* Check-constraint rename post-pass: a `not-found` and a `not-expected`\n* check on the same table whose wire-name content hashes match but whose\n* prefixes differ is a prefix-only rename, and collapses into one\n* `ALTER TABLE … RENAME CONSTRAINT`.\n*\n* This is the index pass's hash-pairing phase and nothing else. There is\n* deliberately no content-pairing phase: a live check body is whatever\n* Postgres reprinted, so it never byte-matches the authored text, and\n* pairing an exact-named live check by content would bless whatever\n* predicate is actually live. Adoption of an old exact-named check stays\n* drop + add.\n*\n* Runs only when the policy allows `widening` (rename's class). Without it\n* the pass no-ops and the pair degrades to an add and a drop, and the drop,\n* which is `widening` too, is refused as a conflict.\n*/\nfunction pairCheckRenames(options, issues) {\n\tconst consumed = /* @__PURE__ */ new Set();\n\tconst calls = [];\n\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst missing = [];\n\tconst extra = [];\n\tfor (const issue of issues) {\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || !SqlCheckConstraintIR.is(node)) continue;\n\t\tconst ddlSchema = issue.path[1];\n\t\tconst tableName = issue.path[2];\n\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t}\n\tif (missing.length === 0 || extra.length === 0) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\tfinding.ddlSchema,\n\t\tfinding.tableName,\n\t\thash\n\t]);\n\tconst sortedMissing = [...missing].sort(byName);\n\tconst extrasByHash = /* @__PURE__ */ new Map();\n\tfor (const finding of extra) {\n\t\tconst parsed = parseWireName(finding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst key = pairingKey(finding, parsed.hash);\n\t\tconst group = extrasByHash.get(key) ?? [];\n\t\tgroup.push(finding);\n\t\textrasByHash.set(key, group);\n\t}\n\tfor (const group of extrasByHash.values()) group.sort(byName);\n\tfor (const missingFinding of sortedMissing) {\n\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\tif (candidate === void 0) continue;\n\t\tconsumed.add(missingFinding.issue);\n\t\tconsumed.add(candidate.issue);\n\t\tcalls.push(new RenameConstraintCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, \"checkConstraint\", candidate.node.name, missingFinding.node.name));\n\t}\n\treturn {\n\t\tcalls,\n\t\tconsumed\n\t};\n}\n//#endregion\n//#region src/core/migrations/schema-tables.ts\n/**\n* The tables of a Postgres schema, addressed by `contract`'s namespace ids, each mapped to its DDL\n* schema.\n*/\nfunction postgresSchemaTables(schema, contract) {\n\tconst tableIn = (namespaceId, table) => schema.namespaces[resolveDdlSchemaForNamespaceStorage(contract.storage, namespaceId)]?.tables[table];\n\tconst hasTable = (namespaceId, table) => tableIn(namespaceId, table) !== void 0;\n\treturn {\n\t\thasTable,\n\t\thasColumn: (namespaceId, table, column) => Object.hasOwn(tableIn(namespaceId, table)?.columns ?? {}, column),\n\t\ttablesNamed: (namespaceId, table) => hasTable(namespaceId, table) ? [table] : [],\n\t\tcolumnsNamed: (namespaceId, table, column) => Object.hasOwn(tableIn(namespaceId, table)?.columns ?? {}, column) ? [column] : [],\n\t\tnamespacesWithTable: (table) => Object.keys(contract.storage.namespaces).filter((namespaceId) => hasTable(namespaceId, table))\n\t};\n}\n//#endregion\n//#region src/core/migrations/table-rename-constraint-renames.ts\n/**\n* The constraint renames that follow a table rename. Each primary key, unique constraint and\n* foreign key of the renamed table is paired with the destination constraint of the same kind on\n* the same columns, and for a foreign key the same referenced columns. Foreign keys pair first\n* with destination keys to the same referenced table, and the rest then pair with keys to another\n* table, because a later rename in the same plan may change that table and a foreign key's derived\n* name never depends on it. A paired constraint is renamed to the destination's explicit name, or else\n* to the name the planner derives from the new table name, when that differs from its name in the\n* database. Each destination constraint pairs with at most one constraint, in order. An unpaired\n* constraint is being dropped or changed and keeps its name. Indexes and checks are not handled\n* here: their wire names pair by content hash in the index and check rename passes.\n*/\nfunction constraintRenamesForTableRename(input) {\n\treturn pairedConstraintRenames(input, {\n\t\tprimaryKey: true,\n\t\tonColumns: () => true\n\t});\n}\n/**\n* The renames of the constraints in `scope` that pair with a destination constraint of the same\n* kind on the same columns, to the destination's explicit name or else the derived one.\n*/\nfunction pairedConstraintRenames(input, scope) {\n\tconst { schemaName, previous, next } = input;\n\tconst table = next.name;\n\tconst rename = (kind, actualName, target) => {\n\t\tassertDefined(actualName, `the table \"${previous.name}\" has a ${kind} that has no name; the working schema names every primary key, unique and foreign key a rename can change`);\n\t\treturn target === void 0 || target === actualName ? [] : [new RenameConstraintCall(schemaName, table, kind, actualName, target)];\n\t};\n\tconst nextPrimaryKey = next.primaryKey;\n\tconst primaryKey = previous.primaryKey === void 0 || !scope.primaryKey ? [] : rename(\"primaryKey\", previous.primaryKey.name, nextPrimaryKey !== void 0 && isArrayEqual(previous.primaryKey.columns, nextPrimaryKey.columns) ? nextPrimaryKey.name ?? defaultPrimaryKeyName(table) : void 0);\n\tconst pairedUniques = /* @__PURE__ */ new Set();\n\tconst uniques = previous.uniques.filter((unique) => scope.onColumns(unique.columns)).flatMap((unique) => {\n\t\tconst paired = next.uniques.find((candidate) => !pairedUniques.has(candidate) && isArrayEqual(candidate.columns, unique.columns));\n\t\tif (paired !== void 0) pairedUniques.add(paired);\n\t\treturn rename(\"unique\", unique.name, paired === void 0 ? void 0 : paired.name ?? defaultUniqueName(table, paired.columns));\n\t});\n\tconst previousForeignKeys = previous.foreignKeys.filter((fk) => scope.onColumns(fk.columns));\n\tconst pairing = pairForeignKeys(previousForeignKeys, next.foreignKeys);\n\tconst foreignKeys = previousForeignKeys.flatMap((fk) => {\n\t\tconst paired = pairing.get(fk);\n\t\treturn rename(\"foreignKey\", fk.name, paired === void 0 ? void 0 : paired.name ?? defaultForeignKeyName(table, fk.columns));\n\t});\n\treturn [\n\t\t...primaryKey,\n\t\t...uniques,\n\t\t...foreignKeys\n\t];\n}\n/**\n* Pairs old foreign keys with destination keys on the same columns and referenced columns. Every\n* key to the same referenced table pairs first, so an old key with no such match cannot take the\n* destination key another old key keeps; the remaining keys then pair in order.\n*/\nfunction pairForeignKeys(previous, next) {\n\tconst pairs = /* @__PURE__ */ new Map();\n\tconst taken = /* @__PURE__ */ new Set();\n\tconst pass = (accepts) => {\n\t\tfor (const fk of previous) {\n\t\t\tif (pairs.has(fk)) continue;\n\t\t\tconst paired = next.find((candidate) => !taken.has(candidate) && isArrayEqual(candidate.columns, fk.columns) && isArrayEqual(candidate.referencedColumns, fk.referencedColumns) && accepts(fk, candidate));\n\t\t\tif (paired === void 0) continue;\n\t\t\tpairs.set(fk, paired);\n\t\t\ttaken.add(paired);\n\t\t}\n\t};\n\tpass((fk, candidate) => candidate.referencedTable === fk.referencedTable && candidate.resolvedReferencedNamespace === fk.resolvedReferencedNamespace);\n\tpass(() => true);\n\treturn pairs;\n}\n//#endregion\n//#region src/core/migrations/column-rename-constraint-renames.ts\n/**\n* The constraint renames that follow a column rename. Each unique constraint and foreign key on\n* the renamed column is paired with the destination constraint of the same kind on the same\n* columns, and renamed to the destination's explicit name, or else to the name the planner derives\n* from the table and the new column names, when that differs from its name in the database. The\n* primary key's derived name does not depend on its columns, so it is left alone. `previous` is\n* the table after the column rename, its constraint names as they are in the database.\n*/\nfunction constraintRenamesForColumnRename(input) {\n\treturn pairedConstraintRenames(input, {\n\t\tprimaryKey: false,\n\t\tonColumns: (columns) => columns.includes(input.column)\n\t});\n}\n//#endregion\n//#region src/core/migrations/working-schema.ts\nfunction ddlSchemaOf(callSchemaName) {\n\treturn callSchemaName === UNBOUND_NAMESPACE_ID ? DEFAULT_NAMESPACE_ID : callSchemaName;\n}\nfunction rewriteRefs(refs, rewrite) {\n\treturn refs?.map(rewrite);\n}\n/**\n* Rewrites the step of `kind` and `id` in a ref that runs through the given table, and the table\n* step itself when `kind` is the table kind.\n*/\nfunction stepRewrite(schemaName, tableName, kind, fromId, toId) {\n\treturn (ref) => {\n\t\tconst namespaceStep = ref[1];\n\t\tconst tableStep = ref[2];\n\t\tif (namespaceStep?.nodeKind !== PostgresSchemaNodeKind.namespace || namespaceStep.id !== schemaName || tableStep?.nodeKind !== PostgresSchemaNodeKind.table || tableStep.id !== tableName) return ref;\n\t\treturn ref.map((step, index) => index >= 2 && step.nodeKind === kind && step.id === fromId ? {\n\t\t\tnodeKind: kind,\n\t\t\tid: toId\n\t\t} : step);\n\t};\n}\nfunction withColumnName(column, name) {\n\treturn new SqlColumnIR({\n\t\tname,\n\t\tnativeType: column.nativeType,\n\t\tnullable: column.nullable,\n\t\t...ifDefined(\"default\", column.default),\n\t\t...ifDefined(\"annotations\", column.annotations),\n\t\t...ifDefined(\"many\", column.many),\n\t\t...ifDefined(\"resolvedNativeType\", column.resolvedNativeType),\n\t\t...ifDefined(\"resolvedDefault\", column.resolvedDefault),\n\t\t...ifDefined(\"authoredDefault\", column.authoredDefault),\n\t\t...ifDefined(\"codecRef\", column.codecRef),\n\t\t...ifDefined(\"codecBaseNativeType\", column.codecBaseNativeType),\n\t\t...ifDefined(\"dataType\", column.dataType),\n\t\t...ifDefined(\"toCanonicalForm\", column.toCanonicalForm)\n\t});\n}\nfunction withPrimaryKey(primaryKey, name, rewrite, columnName) {\n\treturn new PrimaryKey({\n\t\tcolumns: primaryKey.columns.map(columnName),\n\t\t...ifDefined(\"name\", name),\n\t\t...ifDefined(\"dependsOn\", rewriteRefs(primaryKey.dependsOn, rewrite))\n\t});\n}\nfunction withUnique(unique, name, rewrite, columnName) {\n\treturn new SqlUniqueIR({\n\t\tcolumns: unique.columns.map(columnName),\n\t\t...ifDefined(\"name\", name),\n\t\t...ifDefined(\"annotations\", unique.annotations),\n\t\t...ifDefined(\"dependsOn\", rewriteRefs(unique.dependsOn, rewrite))\n\t});\n}\nfunction withForeignKey(fk, overrides, rewrite, columnName) {\n\treturn new SqlForeignKeyIR({\n\t\tcolumns: fk.columns.map(columnName),\n\t\treferencedTable: overrides.referencedTable,\n\t\treferencedColumns: overrides.referencedColumns ?? fk.referencedColumns,\n\t\t...ifDefined(\"referencedSchema\", fk.referencedSchema),\n\t\t...ifDefined(\"name\", overrides.name),\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t...ifDefined(\"resolvedReferencedNamespace\", fk.resolvedReferencedNamespace),\n\t\t...ifDefined(\"dependsOn\", rewriteRefs(fk.dependsOn, rewrite))\n\t});\n}\n/**\n* An index whose definition carries SQL text, an expression or a predicate, keeps its columns as\n* they are: a column named inside the text cannot be renamed here, so the diff plans the index.\n*/\nfunction withIndex(index, naming, rewrite, columnName) {\n\tconst columnsFollow = index.expression === void 0 && index.where === void 0;\n\tconst base = {\n\t\tnaming,\n\t\twhere: index.where,\n\t\tunique: index.unique,\n\t\tpartial: index.partial,\n\t\ttype: index.type,\n\t\toptions: index.options,\n\t\tannotations: index.annotations,\n\t\tdependsOn: rewriteRefs(index.dependsOn, rewrite)\n\t};\n\treturn new SqlIndexIR(index.expression !== void 0 ? {\n\t\t...base,\n\t\texpression: index.expression\n\t} : {\n\t\t...base,\n\t\tcolumns: (index.columns ?? []).map(columnsFollow ? columnName : (c) => c)\n\t});\n}\nfunction withCheck(check, naming, rewrite) {\n\treturn new SqlCheckConstraintIR({\n\t\tnaming,\n\t\texpression: check.expression,\n\t\tdependsOn: rewriteRefs(check.dependsOn, rewrite)\n\t});\n}\nfunction withPolicy(policy, overrides, rewrite) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: overrides.naming,\n\t\ttableName: overrides.tableName,\n\t\tnamespaceId: policy.namespaceId,\n\t\toperation: policy.operation,\n\t\troles: policy.roles,\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: rewriteRefs(policy.dependsOn, rewrite)\n\t});\n}\nfunction unchangedEdit(table) {\n\treturn {\n\t\tname: table.name,\n\t\tprimaryKeyName: (primaryKey) => primaryKey.name,\n\t\tuniqueName: (unique) => unique.name,\n\t\tforeignKey: (fk) => ({\n\t\t\tname: fk.name,\n\t\t\treferencedTable: fk.referencedTable\n\t\t}),\n\t\tcolumnName: (column) => column,\n\t\tindexNaming: (index) => namingOf(index.name, index.prefix),\n\t\tcheckNaming: (check) => namingOf(check.name, check.prefix),\n\t\tpolicy: (policy) => ({\n\t\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\t\ttableName: policy.tableName\n\t\t})\n\t};\n}\nfunction rebuildTable(table, edit, rewrite) {\n\tconst { columnName } = edit;\n\treturn new PostgresTableSchemaNode({\n\t\tname: edit.name,\n\t\tcolumns: Object.fromEntries(Object.values(table.columns).map((column) => {\n\t\t\tconst name = columnName(column.name);\n\t\t\treturn [name, name === column.name ? column : withColumnName(column, name)];\n\t\t})),\n\t\t...ifDefined(\"primaryKey\", table.primaryKey === void 0 ? void 0 : withPrimaryKey(table.primaryKey, edit.primaryKeyName(table.primaryKey), rewrite, columnName)),\n\t\tuniques: table.uniques.map((unique) => withUnique(unique, edit.uniqueName(unique), rewrite, columnName)),\n\t\tforeignKeys: table.foreignKeys.map((fk) => withForeignKey(fk, edit.foreignKey(fk), rewrite, columnName)),\n\t\tindexes: table.indexes.map((index) => withIndex(index, edit.indexNaming(index), rewrite, columnName)),\n\t\t...ifDefined(\"checks\", table.checks?.map((check) => withCheck(check, edit.checkNaming(check), rewrite))),\n\t\t...ifDefined(\"annotations\", table.annotations),\n\t\tpolicies: table.policies.map((policy) => withPolicy(policy, edit.policy(policy), rewrite)),\n\t\trlsEnabled: table.rlsEnabled\n\t});\n}\n/**\n* Rebuilds every table of the schema: `editFor` returns the edit for a table, or `undefined` to\n* only rewrite its dependencies.\n*/\nfunction mapTables(schema, rewrite, editFor) {\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces: Object.fromEntries(Object.entries(schema.namespaces).map(([key, namespace]) => [key, new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: namespace.schemaName,\n\t\t\tnativeEnums: namespace.nativeEnums,\n\t\t\ttables: Object.fromEntries(Object.values(namespace.tables).map((table) => {\n\t\t\t\tconst rebuilt = rebuildTable(table, editFor(namespace.schemaName, table) ?? unchangedEdit(table), rewrite);\n\t\t\t\treturn [rebuilt.name, rebuilt];\n\t\t\t}))\n\t\t})])),\n\t\troles: schema.roles,\n\t\texistingSchemas: schema.existingSchemas,\n\t\tpgVersion: schema.pgVersion\n\t});\n}\n/**\n* The schema with one table under its new name. Foreign keys anywhere that reference the table\n* follow it, its policies and every dependency that names it move with it, and row-level security\n* is carried. Constraint, index, check and policy names do not change: a primary key, unique\n* constraint or foreign key whose name was derived from the old table name gets that name spelled\n* out, since it no longer derives from the table it is on.\n*/\nfunction renameTableInPostgresSchema(schema, rename) {\n\tconst { schemaName, from, to } = rename;\n\tconst rewrite = stepRewrite(schemaName, from, PostgresSchemaNodeKind.table, from, to);\n\tconst referencesRenamed = (ownSchema, fk) => (fk.resolvedReferencedNamespace ?? ownSchema) === schemaName && fk.referencedTable === from;\n\treturn mapTables(schema, rewrite, (tableSchema, table) => {\n\t\tconst unchanged = unchangedEdit(table);\n\t\tconst followReference = (fk) => ({\n\t\t\tname: fk.name,\n\t\t\treferencedTable: referencesRenamed(tableSchema, fk) ? to : fk.referencedTable\n\t\t});\n\t\tif (tableSchema !== schemaName || table.name !== from) return {\n\t\t\t...unchanged,\n\t\t\tforeignKey: followReference\n\t\t};\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tname: to,\n\t\t\tprimaryKeyName: (primaryKey) => primaryKey.name ?? defaultPrimaryKeyName(from),\n\t\t\tuniqueName: (unique) => unique.name ?? defaultUniqueName(from, unique.columns),\n\t\t\tforeignKey: (fk) => ({\n\t\t\t\t...followReference(fk),\n\t\t\t\tname: fk.name ?? defaultForeignKeyName(from, fk.columns)\n\t\t\t}),\n\t\t\tpolicy: (policy) => ({\n\t\t\t\t...unchanged.policy(policy),\n\t\t\t\ttableName: to\n\t\t\t})\n\t\t};\n\t});\n}\n/**\n* The schema with one column under its new name. The table's primary key, unique constraints,\n* foreign keys and plain column indexes name it under the new name, foreign keys anywhere that\n* reference it follow it, and every dependency that names it moves with it. An index with an\n* expression or a predicate, and a check, keep their SQL text. Constraint and index names do not\n* change: a unique constraint or foreign key on the column whose name was derived from the old\n* column name gets that name spelled out.\n*/\nfunction renameColumnInPostgresSchema(schema, rename) {\n\tconst { schemaName, table: tableName, from, to } = rename;\n\tconst rewrite = stepRewrite(schemaName, tableName, RelationalSchemaNodeKind.column, `column:${from}`, `column:${to}`);\n\tconst renamed = (column) => column === from ? to : column;\n\tconst referencesTable = (ownSchema, fk) => (fk.resolvedReferencedNamespace ?? ownSchema) === schemaName && fk.referencedTable === tableName;\n\treturn mapTables(schema, rewrite, (tableSchema, table) => {\n\t\tconst unchanged = unchangedEdit(table);\n\t\tconst followReference = (fk) => ({\n\t\t\tname: fk.name,\n\t\t\treferencedTable: fk.referencedTable,\n\t\t\treferencedColumns: referencesTable(tableSchema, fk) ? fk.referencedColumns.map(renamed) : fk.referencedColumns\n\t\t});\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return {\n\t\t\t...unchanged,\n\t\t\tforeignKey: followReference\n\t\t};\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tcolumnName: renamed,\n\t\t\tuniqueName: (unique) => unique.name ?? (unique.columns.includes(from) ? defaultUniqueName(tableName, unique.columns) : void 0),\n\t\t\tforeignKey: (fk) => ({\n\t\t\t\t...followReference(fk),\n\t\t\t\tname: fk.name ?? (fk.columns.includes(from) ? defaultForeignKeyName(tableName, fk.columns) : void 0)\n\t\t\t})\n\t\t};\n\t});\n}\nfunction renamedNaming(previous, name) {\n\treturn previous.prefix === void 0 ? namingOf(name, void 0) : namingOfLiveName(name);\n}\nfunction renameConstraint(schema, call) {\n\tconst schemaName = ddlSchemaOf(call.schemaName);\n\tconst { tableName, oldConstraintName, newConstraintName } = call;\n\tconst renamed = (name, derived) => (name ?? derived) === oldConstraintName ? newConstraintName : name;\n\treturn mapTables(schema, stepRewrite(schemaName, tableName, RelationalSchemaNodeKind.check, `check:${oldConstraintName}`, `check:${newConstraintName}`), (tableSchema, table) => {\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return void 0;\n\t\tconst unchanged = unchangedEdit(table);\n\t\tswitch (call.kind) {\n\t\t\tcase \"primaryKey\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tprimaryKeyName: (primaryKey) => renamed(primaryKey.name, defaultPrimaryKeyName(tableName))\n\t\t\t};\n\t\t\tcase \"unique\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tuniqueName: (unique) => renamed(unique.name, defaultUniqueName(tableName, unique.columns))\n\t\t\t};\n\t\t\tcase \"foreignKey\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tforeignKey: (fk) => ({\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\tname: renamed(fk.name, defaultForeignKeyName(tableName, fk.columns))\n\t\t\t\t})\n\t\t\t};\n\t\t\tcase \"checkConstraint\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tcheckNaming: (check) => check.name === oldConstraintName ? renamedNaming(check, newConstraintName) : unchanged.checkNaming(check)\n\t\t\t};\n\t\t}\n\t});\n}\nfunction renameIndex(schema, call) {\n\tconst schemaName = ddlSchemaOf(call.schemaName);\n\tconst { tableName, oldIndexName, newIndexName } = call;\n\treturn mapTables(schema, stepRewrite(schemaName, tableName, RelationalSchemaNodeKind.index, `index:${oldIndexName}`, `index:${newIndexName}`), (tableSchema, table) => {\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return void 0;\n\t\tconst unchanged = unchangedEdit(table);\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tindexNaming: (index) => index.name === oldIndexName ? renamedNaming(index, newIndexName) : unchanged.indexNaming(index)\n\t\t};\n\t});\n}\nfunction renamePolicy(schema, call) {\n\tconst schemaName = ddlSchemaOf(call.schemaName);\n\tconst { tableName, oldPolicyName, newPolicyName } = call;\n\treturn mapTables(schema, stepRewrite(schemaName, tableName, PostgresSchemaNodeKind.policy, oldPolicyName, newPolicyName), (tableSchema, table) => {\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return void 0;\n\t\tconst unchanged = unchangedEdit(table);\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tpolicy: (policy) => policy.name === oldPolicyName ? {\n\t\t\t\tnaming: renamedNaming(policy, newPolicyName),\n\t\t\t\ttableName: policy.tableName\n\t\t\t} : unchanged.policy(policy)\n\t\t};\n\t});\n}\nfunction applied(schema, call) {\n\tif (call instanceof RenameTableCall) {\n\t\tconst renamed = renameTableInPostgresSchema(schema, {\n\t\t\tschemaName: ddlSchemaOf(call.schemaName),\n\t\t\tfrom: call.oldTableName,\n\t\t\tto: call.tableName\n\t\t});\n\t\treturn call.companions.reduce(applied, renamed);\n\t}\n\tif (call instanceof RenameColumnCall) {\n\t\tconst renamed = renameColumnInPostgresSchema(schema, {\n\t\t\tschemaName: ddlSchemaOf(call.schemaName),\n\t\t\ttable: call.tableName,\n\t\t\tfrom: call.oldColumnName,\n\t\t\tto: call.columnName\n\t\t});\n\t\treturn call.companions.reduce(applied, renamed);\n\t}\n\tif (call instanceof RenameConstraintCall) return renameConstraint(schema, call);\n\tif (call instanceof RenameIndexCall) return renameIndex(schema, call);\n\treturn renamePolicy(schema, call);\n}\n/** The working schema of a plan or a migration, starting from `initial`. */\nfunction createWorkingSchema(initial) {\n\treturn new WorkingSchemaImpl(initial);\n}\nvar WorkingSchemaImpl = class {\n\t#current;\n\tconstructor(initial) {\n\t\tthis.#current = initial;\n\t}\n\tget current() {\n\t\treturn this.#current;\n\t}\n\tapply(call) {\n\t\tthis.#current = applied(this.#current, call);\n\t}\n};\n//#endregion\n//#region src/core/migrations/table-rename-calls.ts\nconst RENAME_POLICY = { allowedOperationClasses: [\"widening\"] };\nfunction emissionSchemaForNamespace(contract, namespaceId) {\n\treturn namespaceId === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : resolveDdlSchemaForNamespaceStorage(contract.storage, namespaceId);\n}\n/**\n* The `renameTable` call a user writes in `migration.ts` for `rename`. `schema` names the namespace\n* the facade resolves the table in, and is left out for the unbound namespace or when not given.\n*/\nfunction renderRenameTableCall(rename) {\n\treturn new RenameTableCall(rename.namespaceId ?? UNBOUND_NAMESPACE_ID, rename.from, rename.to, []).renderTypeScript();\n}\n/** The SQL a user runs against the database to rename the table by hand. */\nfunction renameTableByHandStatements(contract, rename) {\n\treturn [renameTableStatement(emissionSchemaForNamespace(contract, rename.namespaceId), rename.from, rename.to)];\n}\nfunction tableNode(schema, ddlSchema, tableName) {\n\tconst table = schema.namespaces[ddlSchema]?.tables[tableName];\n\tassertDefined(table, `a resolved rename names table \"${tableName}\" in schema \"${ddlSchema}\"`);\n\treturn table;\n}\n/**\n* The call that renames a table, carrying as companions the renames of the objects on the table\n* whose names derive from the table name: each primary key, unique constraint and foreign key the\n* destination keeps, named as the destination names it, and each wire-named index and check whose\n* prefix changes. `previous` is the schema before the rename; the renamed copy is diffed against\n* the destination built from `contract`.\n*/\nfunction postgresTableRenameCall(input) {\n\tconst { contract, rename } = input;\n\tconst schemaName = emissionSchemaForNamespace(contract, rename.namespaceId);\n\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, rename.namespaceId);\n\tconst renamed = renameTableInPostgresSchema(input.previous, {\n\t\tschemaName: ddlSchema,\n\t\tfrom: rename.from,\n\t\tto: rename.to\n\t});\n\tconst { expected, issues } = buildPostgresPlanDiff({\n\t\tcontract,\n\t\tactualSchema: renamed,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst onRenamedTable = (call) => call.schemaName === schemaName && call.tableName === rename.to;\n\tconst pairing = {\n\t\tcontract,\n\t\tpolicy: RENAME_POLICY\n\t};\n\treturn new RenameTableCall(schemaName, rename.from, rename.to, [\n\t\t...constraintRenamesForTableRename({\n\t\t\tschemaName,\n\t\t\tprevious: tableNode(renamed, ddlSchema, rename.to),\n\t\t\tnext: tableNode(expected, ddlSchema, rename.to)\n\t\t}),\n\t\t...pairIndexRenames(pairing, issues).calls.filter(onRenamedTable),\n\t\t...pairCheckRenames(pairing, issues).calls.filter(onRenamedTable)\n\t]);\n}\n/**\n* The call that renames a column, carrying as companions the renames of the objects on its table\n* whose names derive from the column name: each unique constraint and foreign key on the column\n* the destination keeps, named as the destination names it, and each index on the column renamed\n* to the destination's wire name. `previous` is the schema before the rename; the renamed copy is\n* diffed against the destination built from `contract`. A check on the column keeps its name: its\n* expression names the column, so the diff replaces it.\n*/\nfunction postgresColumnRenameCall(input) {\n\tconst { contract, rename } = input;\n\tconst schemaName = emissionSchemaForNamespace(contract, rename.namespaceId);\n\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, rename.namespaceId);\n\tconst renamed = renameColumnInPostgresSchema(input.previous, {\n\t\tschemaName: ddlSchema,\n\t\ttable: rename.table,\n\t\tfrom: rename.from,\n\t\tto: rename.to\n\t});\n\tconst { expected, issues } = buildPostgresPlanDiff({\n\t\tcontract,\n\t\tactualSchema: renamed,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst table = tableNode(renamed, ddlSchema, rename.table);\n\tconst destination = expected.namespaces[ddlSchema]?.tables[rename.table];\n\tconst indexesOnColumn = new Set(table.indexes.filter((index) => index.columns?.includes(rename.to)).map((index) => index.name));\n\tconst indexRenames = pairIndexRenames({\n\t\tcontract,\n\t\tpolicy: RENAME_POLICY\n\t}, issues).calls.filter((call) => call.schemaName === schemaName && call.tableName === rename.table && indexesOnColumn.has(call.oldIndexName));\n\treturn new RenameColumnCall(schemaName, rename.table, rename.from, rename.to, [...destination === void 0 ? [] : constraintRenamesForColumnRename({\n\t\tschemaName,\n\t\tcolumn: rename.to,\n\t\tprevious: table,\n\t\tnext: destination\n\t}), ...indexRenames]);\n}\n//#endregion\n//#region src/core/migrations/postgres-migration.ts\n/**\n* Target-owned base class for Postgres migrations.\n*\n* Fixes the `SqlMigration` generic to `PostgresPlanTargetDetails` and the\n* abstract `targetId` to the Postgres target-id string literal, so both\n* user-authored migrations and renderer-generated scaffolds (the output of\n* `renderCallsToTypeScript`) can extend `PostgresMigration` directly without\n* redeclaring target-local identity.\n*\n* Mirrors `MongoMigration` in `@internal/family-mongo`: the renderer\n* emits `extends Migration` against a facade re-export of this class\n* from `@internal/postgres/migration`, keeping the authoring surface\n* target-scoped rather than family-scoped.\n*\n* The constructor materializes a single Postgres `SqlControlAdapter` from\n* `stack.adapter.create(stack)` and stores it; the protected `dataTransform`\n* instance method forwards to the free `dataTransform` factory with that\n* stored adapter, so user migrations can write `this.dataTransform(...)`\n* without threading the adapter through every call.\n*\n* Every method requires an explicit `schema`. Postgres migrations name their\n* schema deliberately — there is no default and no `search_path`-relative\n* option. A migration that left the schema unspecified would resolve against\n* whatever `search_path` the connection happened to carry, and that ambiguity\n* is an antipattern in a migration. (The unbound/unspecified namespace concept\n* remains for SQLite, which has no schemas, and for Mongo's connection `db`.)\n*/\nvar PostgresMigration = class extends Migration {\n\ttargetId = \"postgres\";\n\t/**\n\t* Materialized Postgres control adapter, created once per migration\n\t* instance from the injected stack. `undefined` only when the migration\n\t* was instantiated without a stack (test fixtures); `controlAdapterFor`\n\t* throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING in that case to surface the misuse.\n\t*/\n\tcontrolAdapter;\n\t/** The rename calls this read of `operations` has made so far, in order. */\n\t#renames = [];\n\t#endView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\t#startView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\tconstructor(stack) {\n\t\tsuper(stack);\n\t\tthis.controlAdapter = stack?.adapter ? blindCast(stack.adapter.create(stack)) : void 0;\n\t}\n\tframeworkComponents() {\n\t\tconst stack = this.stack;\n\t\tif (stack === void 0) return [];\n\t\treturn [\n\t\t\tstack.target,\n\t\t\t...stack.adapter === void 0 ? [] : [stack.adapter],\n\t\t\t...stack.extensions\n\t\t];\n\t}\n\t/**\n\t* Returns the materialized control adapter, or throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING naming\n\t* `operation` when the migration was constructed without a `ControlStack`.\n\t* Single home for the null-check that every DDL/DML method shares.\n\t*/\n\tcontrolAdapterFor(operation) {\n\t\tif (!this.controlAdapter) throw errorPostgresMigrationStackMissing(operation);\n\t\treturn this.controlAdapter;\n\t}\n\t/**\n\t* The typed, schema-qualified Postgres view over this migration's end-state\n\t* contract — `this.endContract.namespace.<schema>.table.<name>`, etc. Throws\n\t* if no `endContractJson` was provided.\n\t*/\n\tget endContract() {\n\t\treturn this.#endView.endContract;\n\t}\n\t/**\n\t* The typed Postgres view over this migration's start-state contract, or\n\t* `null` for a baseline migration (no `startContractJson`).\n\t*/\n\tget startContract() {\n\t\treturn this.#startView.startContract;\n\t}\n\t/**\n\t* Instance-method wrapper around the free `dataTransform` factory that\n\t* supplies the stored control adapter. Authors call this from inside\n\t* `get operations()`; the adapter argument is hidden from the call site.\n\t*/\n\tdataTransform(contract, name, options) {\n\t\treturn dataTransform(contract, name, options, this.controlAdapterFor(\"dataTransform\"));\n\t}\n\t/**\n\t* Emit a `CREATE TABLE` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateTable(options) {\n\t\treturn new CreateTableCall(options.schema, options.table, options.columns, options.constraints).toOp(this.controlAdapterFor(\"createTable\"));\n\t}\n\t/**\n\t* Emit a `CREATE SCHEMA` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateSchema(options) {\n\t\treturn new CreateSchemaCall(options.schema).toOp(this.controlAdapterFor(\"createSchema\"));\n\t}\n\t/**\n\t* Emit a `CREATE TYPE ... AS ENUM (...)` migration operation for a managed\n\t* native enum. Builds a typed DDL node and lowers it through the stored\n\t* control adapter (members render in declaration order). Throws if no adapter\n\t* is present.\n\t*/\n\tcreateNativeEnumType(options) {\n\t\treturn new CreateNativeEnumTypeCall(options.schema, options.typeName, options.members).toOp(this.controlAdapterFor(\"createNativeEnumType\"));\n\t}\n\t/**\n\t* Emit a `DROP TYPE` migration operation for a managed native enum, lowered\n\t* through the stored control adapter. Throws if no adapter is present.\n\t*/\n\tdropNativeEnumType(options) {\n\t\treturn new DropNativeEnumTypeCall(options.schema, options.typeName).toOp(this.controlAdapterFor(\"dropNativeEnumType\"));\n\t}\n\t/**\n\t* Emit an `ALTER TYPE ... ADD VALUE` migration operation appending one\n\t* member to a managed native enum, lowered through the stored control\n\t* adapter. Throws if no adapter is present. Every appended value is its\n\t* own operation — call this once per value to append more than one.\n\t*/\n\taddNativeEnumValue(options) {\n\t\treturn new AddNativeEnumValueCall(options.schema, options.typeName, options.value).toOp(this.controlAdapterFor(\"addNativeEnumValue\"));\n\t}\n\taddColumn(options) {\n\t\treturn new AddColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"addColumn\"));\n\t}\n\taddPrimaryKey(options) {\n\t\treturn new AddPrimaryKeyCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addPrimaryKey\"));\n\t}\n\taddUnique(options) {\n\t\treturn new AddUniqueCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addUnique\"));\n\t}\n\taddForeignKey(options) {\n\t\treturn new AddForeignKeyCall(options.schema, options.table, options.foreignKey).toOp(this.controlAdapterFor(\"addForeignKey\"));\n\t}\n\taddCheckConstraint(options) {\n\t\treturn new AddCheckConstraintCall(options.schema, options.table, options.constraint, options.expression).toOp(this.controlAdapterFor(\"addCheckConstraint\"));\n\t}\n\trenameCheckConstraint(options) {\n\t\treturn this.renameConstraint({\n\t\t\t...options,\n\t\t\tkind: \"checkConstraint\"\n\t\t});\n\t}\n\trenameConstraint(options) {\n\t\tconst call = new RenameConstraintCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.kind, options.from, options.to);\n\t\tconst adapter = this.controlAdapterFor(\"renameConstraint\");\n\t\tthis.#renames.push(call);\n\t\treturn call.toOp(adapter);\n\t}\n\tdropCheckConstraint(options) {\n\t\treturn new DropCheckConstraintCall(options.schema, options.table, options.constraint).toOp(this.controlAdapterFor(\"dropCheckConstraint\"));\n\t}\n\tdropConstraint(options) {\n\t\treturn new DropConstraintCall(options.schema, options.table, options.constraint, options.kind ?? \"unique\").toOp(this.controlAdapterFor(\"dropConstraint\"));\n\t}\n\t/**\n\t* Emit the operations that rename a table: the table rename, then a rename of each primary key,\n\t* unique constraint, foreign key, index and check whose name was derived from the old table name.\n\t* The old name is resolved against the schema as this migration's earlier rename calls\n\t* (`renameTable`, `renameIndex`, `renameConstraint`, `renameRlsPolicy`) leave it, and the new\n\t* name against the end contract, so the companions start from names an earlier rename gave.\n\t* Spread the result into `operations`:\n\t* `...this.renameTable({ table: 'userProfile', to: 'UserProfile' })`. `schema` names the table's\n\t* namespace when more than one declares the table. Throws `MIGRATION.TABLE_RENAME_UNMATCHED` when\n\t* the table does not exist at that point of the migration or the end contract lacks the new name.\n\t*/\n\trenameTable(options) {\n\t\tconst adapter = this.controlAdapterFor(\"renameTable\");\n\t\tconst rename = {\n\t\t\tnamespaceId: options.schema,\n\t\t\tfrom: options.table,\n\t\t\tto: options.to\n\t\t};\n\t\tconst startContract = this.startContract;\n\t\tif (startContract === null) throw unmatchedTableRename(rename, \"the migration has no start contract\");\n\t\tconst current = this.schemaAfterRenames(startContract);\n\t\tconst endContract = this.endContract;\n\t\tconst resolved = resolveTableRenameAgainst(postgresSchemaTables(current, startContract), endContract, rename);\n\t\tif (!resolved.ok) throw resolved.failure;\n\t\tconst call = postgresTableRenameCall({\n\t\t\tprevious: current,\n\t\t\tcontract: endContract,\n\t\t\trename: resolved.value,\n\t\t\tframeworkComponents: this.frameworkComponents()\n\t\t});\n\t\tthis.#renames.push(call);\n\t\treturn call.toOps(adapter).map(async (op) => op);\n\t}\n\t/**\n\t* Emit the operations that rename a column: the column rename, then a rename of each unique\n\t* constraint, foreign key and index on the column whose name was derived from the old column\n\t* name, to the name the end contract gives it. The column is resolved against the schema as this\n\t* migration's earlier rename calls leave it, so a column of a table an earlier `renameTable`\n\t* renamed is named on the table's new name. Spread the result into `operations`:\n\t* `...this.renameColumn({ table: 'User', column: 'name', to: 'fullName' })`. `schema` names the\n\t* table's namespace when more than one declares the table. Throws\n\t* `MIGRATION.COLUMN_RENAME_UNMATCHED` when the table or column does not exist at that point of\n\t* the migration, the table already has the new column, or the end contract lacks it.\n\t*/\n\trenameColumn(options) {\n\t\tconst adapter = this.controlAdapterFor(\"renameColumn\");\n\t\tconst rename = {\n\t\t\tnamespaceId: options.schema,\n\t\t\ttable: options.table,\n\t\t\tfrom: options.column,\n\t\t\tto: options.to\n\t\t};\n\t\tconst startContract = this.startContract;\n\t\tif (startContract === null) throw unmatchedColumnRename(rename, \"the migration has no start contract\");\n\t\tconst current = this.schemaAfterRenames(startContract);\n\t\tconst endContract = this.endContract;\n\t\tconst resolved = resolveColumnRenameAgainst(postgresSchemaTables(current, startContract), endContract, rename);\n\t\tif (!resolved.ok) throw resolved.failure;\n\t\tconst call = postgresColumnRenameCall({\n\t\t\tprevious: current,\n\t\t\tcontract: endContract,\n\t\t\trename: resolved.value,\n\t\t\tframeworkComponents: this.frameworkComponents()\n\t\t});\n\t\tthis.#renames.push(call);\n\t\treturn call.toOps(adapter).map(async (op) => op);\n\t}\n\t/**\n\t* The start contract's schema with this read's rename calls applied in order. It is built only\n\t* when a `renameTable` needs it, so a migration that renames no table never reads its start\n\t* contract.\n\t*/\n\tschemaAfterRenames(startContract) {\n\t\tconst working = createWorkingSchema(postgresContractToSchema(startContract, this.frameworkComponents()));\n\t\tfor (const call of this.#renames) working.apply(call);\n\t\treturn working.current;\n\t}\n\tbeginOperationsRead() {\n\t\tthis.#renames = [];\n\t}\n\tdropTable(options) {\n\t\treturn new DropTableCall(options.schema, options.table).toOp(this.controlAdapterFor(\"dropTable\"));\n\t}\n\tdropColumn(options) {\n\t\treturn new DropColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropColumn\"));\n\t}\n\talterColumnType(options) {\n\t\treturn new AlterColumnTypeCall(options.schema, options.table, options.column, options.options, options.operationClass).toOp(this.controlAdapterFor(\"alterColumnType\"));\n\t}\n\tsetNotNull(options) {\n\t\treturn new SetNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"setNotNull\"));\n\t}\n\tdropNotNull(options) {\n\t\treturn new DropNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropNotNull\"));\n\t}\n\tsetDefault(options) {\n\t\trefuseEarlierSetDefaultOptions(options);\n\t\treturn new SetDefaultCall(options.schema, options.table, options.column, options.operationClass).toOp(this.controlAdapterFor(\"setDefault\"));\n\t}\n\tdropDefault(options) {\n\t\treturn new DropDefaultCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropDefault\"));\n\t}\n\tcreateIndex(options) {\n\t\treturn new CreateIndexCall(options.schema, options.table, options.index, options.columns !== void 0 ? { columns: options.columns } : { expression: options.expression }, options.extras).toOp(this.controlAdapterFor(\"createIndex\"));\n\t}\n\trenameIndex(options) {\n\t\tconst call = new RenameIndexCall(options.schema, options.table, options.from, options.to);\n\t\tconst adapter = this.controlAdapterFor(\"renameIndex\");\n\t\tthis.#renames.push(call);\n\t\treturn call.toOp(adapter);\n\t}\n\tdropIndex(options) {\n\t\treturn new DropIndexCall(options.schema, options.table, options.index).toOp(this.controlAdapterFor(\"dropIndex\"));\n\t}\n\tinstallExtension(options) {\n\t\treturn installExtension(options, this.controlAdapterFor(\"installExtension\"));\n\t}\n\tenableRowLevelSecurity(options) {\n\t\treturn new EnableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"enableRowLevelSecurity\"));\n\t}\n\tdisableRowLevelSecurity(options) {\n\t\treturn new DisableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"disableRowLevelSecurity\"));\n\t}\n\tcreateRlsPolicy(options) {\n\t\treturn new CreatePostgresRlsPolicyCall(options.schema, options.table, new PostgresRlsPolicy({\n\t\t\t...options.policy,\n\t\t\tusing: options.policy.using,\n\t\t\twithCheck: options.policy.withCheck\n\t\t})).toOp(this.controlAdapterFor(\"createRlsPolicy\"));\n\t}\n\tdropRlsPolicy(options) {\n\t\treturn new DropPostgresRlsPolicyCall(options.schema, options.table, options.policy).toOp(this.controlAdapterFor(\"dropRlsPolicy\"));\n\t}\n\trenameRlsPolicy(options) {\n\t\tconst call = new RenamePostgresRlsPolicyCall(options.schema, options.table, options.from, options.to);\n\t\tconst adapter = this.controlAdapterFor(\"renameRlsPolicy\");\n\t\tthis.#renames.push(call);\n\t\treturn call.toOp(adapter);\n\t}\n};\n/**\n* `setDefault` options an earlier version wrote carry the column's name in `column` and its default as SQL text in `defaultSql`.\n*/\nfunction refuseEarlierSetDefaultOptions(options) {\n\tconst column = options.column;\n\tconst columnIsName = typeof column === \"string\";\n\tif (!columnIsName && !Object.hasOwn(options, \"defaultSql\")) return;\n\tthrow errorMigrationOperationOptionRemoved({\n\t\toperation: \"setDefault\",\n\t\toption: \"defaultSql\",\n\t\tsubject: `column ${JSON.stringify(columnIsName ? column : options.column.name)} of table ${JSON.stringify(options.table)}`,\n\t\trewrite: \"Pass the column as `col(name, type, { default, codecRef })`, with its default written as `lit(value)` or `fn(expression)`, in place of its name and `defaultSql`.\",\n\t\tupgradeEntry: \"migration-ts-column-defaults\"\n\t});\n}\n//#endregion\nexport { renderRenameTableCall as a, pairCheckRenames as c, postgresRenderDefault as d, renameTableByHandStatements as i, pairIndexRenames as l, postgresColumnRenameCall as n, createWorkingSchema as o, postgresTableRenameCall as r, postgresSchemaTables as s, PostgresMigration as t, postgresContractToSchema as u };\n\n//# sourceMappingURL=postgres-migration-Deb4XrMA.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,sBAAsB,KAAK,QAAQ,MAAM;CACjD,IAAI,IAAI,SAAS,YAAY,OAAO,IAAI;CACxC,OAAO,qBAAqB,IAAI,OAAO;EACtC,MAAM,OAAO;EACb,GAAG;CACJ,CAAC;AACF;;;;;;;AAOA,SAAS,yBAAyB,UAAU,qBAAqB;CAChE,MAAM,QAAQ,iBAAiB,mBAAmB;CAClD,OAAO,qCAAqC,UAAU,QAAQ,GAAG;EAChE,qBAAqB;EACrB,gBAAgB,MAAM;EACtB,aAAa,MAAM;EACnB,eAAe;EACf,gBAAgB;CACjB,CAAC;AACF;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,iBAAiB,SAAS,QAAQ;CAC1C,MAAM,2BAA2B,IAAI,IAAI;CACzC,MAAM,QAAQ,CAAC;CACf,IAAI,CAAC,QAAQ,OAAO,wBAAwB,SAAS,UAAU,GAAG,OAAO;EACxE;EACA;CACD;CACA,MAAM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B,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,kBAAkB,iBAAiB,CAAC;CACnD;CACA,cAAc,SAAS;EACtB,OAAO,IAAI,0BAA0B,QAAQ,QAAQ,QAAQ,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,KAAK,kBAAkB,eAAe,CAAC;CACjI;CACA,gBAAgB,SAAS;EACxB,MAAM,OAAO,IAAI,4BAA4B,QAAQ,QAAQ,QAAQ,OAAO,QAAQ,MAAM,QAAQ,EAAE;EACpG,MAAM,UAAU,KAAK,kBAAkB,iBAAiB;EACxD,KAAKA,SAAS,KAAK,IAAI;EACvB,OAAO,KAAK,KAAK,OAAO;CACzB;AACD;;;;AAIA,SAAS,+BAA+B,SAAS;CAChD,MAAM,SAAS,QAAQ;CACvB,MAAM,eAAe,OAAO,WAAW;CACvC,IAAI,CAAC,gBAAgB,CAAC,OAAO,OAAO,SAAS,YAAY,GAAG;CAC5D,MAAM,qCAAqC;EAC1C,WAAW;EACX,QAAQ;EACR,SAAS,UAAU,KAAK,UAAU,eAAe,SAAS,QAAQ,OAAO,IAAI,EAAE,YAAY,KAAK,UAAU,QAAQ,KAAK;EACvH,SAAS;EACT,cAAc;CACf,CAAC;AACF"}
1
+ {"version":3,"file":"postgres-migration-BtlvhcXs-UjWm8cAb.mjs","names":["#current","#endView","#startView","#renames"],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-migration-BtlvhcXs.mjs"],"sourcesContent":["import { t as errorPostgresMigrationStackMissing } from \"./errors-DYyzTYzE.mjs\";\nimport { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { _ as PostgresRlsPolicy } from \"./postgres-schema-DIaAgaL6.mjs\";\nimport { n as postgresResolveDefault } from \"./default-normalizer-Bf_Fhv4v.mjs\";\nimport { r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { t as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-b746rtzf.mjs\";\nimport { r as contractToPostgresDatabaseSchemaNode, t as buildPostgresPlanDiff } from \"./diff-database-schema-CByLrBg6.mjs\";\nimport { c as issueNode, n as resolveNamespaceIdForDdlSchema } from \"./control-policy-DbDoLxrp.mjs\";\nimport { A as RenameConstraintCall, B as renameTableStatement, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, F as SetNotNullCall, H as installExtension, M as RenamePostgresRlsPolicyCall, N as RenameTableCall, P as SetDefaultCall, S as DropIndexCall, T as DropPostgresRlsPolicyCall, _ as DisableRowLevelSecurityCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, h as CreateTableCall, i as AddNativeEnumValueCall, j as RenameIndexCall, k as RenameColumnCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, p as CreatePostgresRlsPolicyCall, 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-BfGiIbUO.mjs\";\nimport { n as renderDefaultLiteral } from \"./planner-ddl-builders-Y0_96xpe.mjs\";\nimport { n as defaultPrimaryKeyName, r as defaultUniqueName, t as defaultForeignKeyName } from \"./default-constraint-names-CtcRXhV8.mjs\";\nimport { t as PostgresContractView } from \"./postgres-contract-view-BpmiHSDZ.mjs\";\nimport { t as dataTransform } from \"./data-transform-Bo32KRbq.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { resolveColumnRenameAgainst, resolveTableRenameAgainst, sqlTypeLookupsOf, unmatchedColumnRename, unmatchedTableRename } from \"@internal/family-sql/control\";\nimport { namingOf, namingOfLiveName, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlCheckConstraintIR, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from \"@internal/sql-schema-ir/types\";\nimport { isArrayEqual } from \"@internal/utils/array-equal\";\nimport { errorMigrationOperationOptionRemoved } from \"@internal/errors/migration\";\nimport { Migration } from \"@internal/family-sql/migration\";\nimport { MigrationContractViews } from \"@internal/migration-tools/migration\";\n//#region src/core/migrations/postgres-contract-to-schema.ts\nfunction postgresRenderDefault(def, column, type) {\n\tif (def.kind === \"function\") return def.expression;\n\treturn renderDefaultLiteral(def.value, {\n\t\tmany: column.many,\n\t\t...type\n\t});\n}\n/**\n* The Postgres schema tree a contract describes, as the planner's \"from\" side:\n* the target descriptor's `migrations.contractToSchema` hook and the trees\n* `renameTable` compares to find its companion renames both go through here,\n* so they are built with the same type lookups, default renderer and default resolver.\n*/\nfunction postgresContractToSchema(contract, frameworkComponents) {\n\tconst types = sqlTypeLookupsOf(frameworkComponents);\n\treturn contractToPostgresDatabaseSchemaNode(blindCast(contract), {\n\t\tannotationNamespace: \"pg\",\n\t\tdataTypeLookup: types.dataTypeLookup,\n\t\tcodecLookup: types.codecLookup,\n\t\trenderDefault: postgresRenderDefault,\n\t\tresolveDefault: postgresResolveDefault\n\t});\n}\n//#endregion\n//#region src/core/migrations/index-and-check-renames.ts\n/**\n* Rename post-pass for indexes, per `(schema, table)`, widening-only,\n* deterministic by sorted names — the same structure as the policy pass\n* below (which stays untouched: policies pair by hash only).\n*\n* Hash pairing (prefix-only renames): extras whose live names parse as\n* wire names, grouped by `(schema, table, hash)`; missing nodes iterated\n* in sorted-name order consume the sorted-name-first candidate.\n*\n* Content pairing (exact→wire convergence), after hash pairing has\n* consumed its matches: the remaining wire-named-missing nodes\n* (`prefix` defined) against the remaining extras of any name shape,\n* paired iff content-equal (columns ordered-strict both-defined-or-\n* both-undefined, `unique`/`type` strict, `options` loose, bodies\n* byte-equal).\n*\n* Leftovers proceed as create/drop exactly as before; without the\n* widening allowance the pass is skipped and pairing degrades to the\n* additive half, like the policy pass.\n*/\nfunction pairIndexRenames(options, issues) {\n\tconst consumed = /* @__PURE__ */ new Set();\n\tconst calls = [];\n\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst missing = [];\n\tconst extra = [];\n\tfor (const issue of issues) {\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || !SqlIndexIR.is(node)) continue;\n\t\tconst ddlSchema = issue.path[1];\n\t\tconst tableName = issue.path[2];\n\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t}\n\tif (missing.length === 0 || extra.length === 0) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\tfinding.ddlSchema,\n\t\tfinding.tableName,\n\t\thash\n\t]);\n\tconst rename = (missingFinding, candidate) => {\n\t\tconsumed.add(missingFinding.issue);\n\t\tconsumed.add(candidate.issue);\n\t\tcalls.push(new RenameIndexCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, candidate.node.name, missingFinding.node.name));\n\t};\n\tconst sortedMissing = [...missing].sort(byName);\n\tconst extrasByHash = /* @__PURE__ */ new Map();\n\tfor (const finding of extra) {\n\t\tconst parsed = parseWireName(finding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst key = pairingKey(finding, parsed.hash);\n\t\tconst group = extrasByHash.get(key) ?? [];\n\t\tgroup.push(finding);\n\t\textrasByHash.set(key, group);\n\t}\n\tfor (const group of extrasByHash.values()) group.sort(byName);\n\tfor (const missingFinding of sortedMissing) {\n\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\tif (candidate === void 0) continue;\n\t\trename(missingFinding, candidate);\n\t}\n\tconst sortedExtras = [...extra].sort(byName);\n\tfor (const missingFinding of sortedMissing) {\n\t\tif (consumed.has(missingFinding.issue)) continue;\n\t\tif (missingFinding.node.prefix === void 0) continue;\n\t\tconst candidate = sortedExtras.find((extraFinding) => !consumed.has(extraFinding.issue) && extraFinding.ddlSchema === missingFinding.ddlSchema && extraFinding.tableName === missingFinding.tableName && missingFinding.node.contentEquals(extraFinding.node, {\n\t\t\tcolumnPresence: \"matching\",\n\t\t\tbodies: \"verbatim\"\n\t\t}));\n\t\tif (candidate === void 0) continue;\n\t\trename(missingFinding, candidate);\n\t}\n\treturn {\n\t\tcalls,\n\t\tconsumed\n\t};\n}\n/**\n* Check-constraint rename post-pass: a `not-found` and a `not-expected`\n* check on the same table whose wire-name content hashes match but whose\n* prefixes differ is a prefix-only rename, and collapses into one\n* `ALTER TABLE … RENAME CONSTRAINT`.\n*\n* This is the index pass's hash-pairing phase and nothing else. There is\n* deliberately no content-pairing phase: a live check body is whatever\n* Postgres reprinted, so it never byte-matches the authored text, and\n* pairing an exact-named live check by content would bless whatever\n* predicate is actually live. Adoption of an old exact-named check stays\n* drop + add.\n*\n* Runs only when the policy allows `widening` (rename's class). Without it\n* the pass no-ops and the pair degrades to an add and a drop, and the drop,\n* which is `widening` too, is refused as a conflict.\n*/\nfunction pairCheckRenames(options, issues) {\n\tconst consumed = /* @__PURE__ */ new Set();\n\tconst calls = [];\n\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst missing = [];\n\tconst extra = [];\n\tfor (const issue of issues) {\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || !SqlCheckConstraintIR.is(node)) continue;\n\t\tconst ddlSchema = issue.path[1];\n\t\tconst tableName = issue.path[2];\n\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\tissue,\n\t\t\tnode,\n\t\t\tddlSchema,\n\t\t\ttableName\n\t\t});\n\t}\n\tif (missing.length === 0 || extra.length === 0) return {\n\t\tcalls,\n\t\tconsumed\n\t};\n\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\tfinding.ddlSchema,\n\t\tfinding.tableName,\n\t\thash\n\t]);\n\tconst sortedMissing = [...missing].sort(byName);\n\tconst extrasByHash = /* @__PURE__ */ new Map();\n\tfor (const finding of extra) {\n\t\tconst parsed = parseWireName(finding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst key = pairingKey(finding, parsed.hash);\n\t\tconst group = extrasByHash.get(key) ?? [];\n\t\tgroup.push(finding);\n\t\textrasByHash.set(key, group);\n\t}\n\tfor (const group of extrasByHash.values()) group.sort(byName);\n\tfor (const missingFinding of sortedMissing) {\n\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\tif (parsed === void 0) continue;\n\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\tif (candidate === void 0) continue;\n\t\tconsumed.add(missingFinding.issue);\n\t\tconsumed.add(candidate.issue);\n\t\tcalls.push(new RenameConstraintCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, \"checkConstraint\", candidate.node.name, missingFinding.node.name));\n\t}\n\treturn {\n\t\tcalls,\n\t\tconsumed\n\t};\n}\n//#endregion\n//#region src/core/migrations/schema-tables.ts\n/**\n* The tables of a Postgres schema, addressed by `contract`'s namespace ids, each mapped to its DDL\n* schema.\n*/\nfunction postgresSchemaTables(schema, contract) {\n\tconst tableIn = (namespaceId, table) => schema.namespaces[resolveDdlSchemaForNamespaceStorage(contract.storage, namespaceId)]?.tables[table];\n\tconst hasTable = (namespaceId, table) => tableIn(namespaceId, table) !== void 0;\n\treturn {\n\t\thasTable,\n\t\thasColumn: (namespaceId, table, column) => Object.hasOwn(tableIn(namespaceId, table)?.columns ?? {}, column),\n\t\ttablesNamed: (namespaceId, table) => hasTable(namespaceId, table) ? [table] : [],\n\t\tcolumnsNamed: (namespaceId, table, column) => Object.hasOwn(tableIn(namespaceId, table)?.columns ?? {}, column) ? [column] : [],\n\t\tnamespacesWithTable: (table) => Object.keys(contract.storage.namespaces).filter((namespaceId) => hasTable(namespaceId, table))\n\t};\n}\n//#endregion\n//#region src/core/migrations/table-rename-constraint-renames.ts\n/**\n* The constraint renames that follow a table rename. Each primary key, unique constraint and\n* foreign key of the renamed table is paired with the destination constraint of the same kind on\n* the same columns, and for a foreign key the same referenced columns. Foreign keys pair first\n* with destination keys to the same referenced table, and the rest then pair with keys to another\n* table, because a later rename in the same plan may change that table and a foreign key's derived\n* name never depends on it. A paired constraint is renamed to the destination's explicit name, or else\n* to the name the planner derives from the new table name, when that differs from its name in the\n* database. Each destination constraint pairs with at most one constraint, in order. An unpaired\n* constraint is being dropped or changed and keeps its name. Indexes and checks are not handled\n* here: their wire names pair by content hash in the index and check rename passes.\n*/\nfunction constraintRenamesForTableRename(input) {\n\treturn pairedConstraintRenames(input, {\n\t\tprimaryKey: true,\n\t\tonColumns: () => true\n\t});\n}\n/**\n* The renames of the constraints in `scope` that pair with a destination constraint of the same\n* kind on the same columns, to the destination's explicit name or else the derived one.\n*/\nfunction pairedConstraintRenames(input, scope) {\n\tconst { schemaName, previous, next } = input;\n\tconst table = next.name;\n\tconst rename = (kind, actualName, target) => {\n\t\tassertDefined(actualName, `the table \"${previous.name}\" has a ${kind} that has no name; the working schema names every primary key, unique and foreign key a rename can change`);\n\t\treturn target === void 0 || target === actualName ? [] : [new RenameConstraintCall(schemaName, table, kind, actualName, target)];\n\t};\n\tconst nextPrimaryKey = next.primaryKey;\n\tconst primaryKey = previous.primaryKey === void 0 || !scope.primaryKey ? [] : rename(\"primaryKey\", previous.primaryKey.name, nextPrimaryKey !== void 0 && isArrayEqual(previous.primaryKey.columns, nextPrimaryKey.columns) ? nextPrimaryKey.name ?? defaultPrimaryKeyName(table) : void 0);\n\tconst pairedUniques = /* @__PURE__ */ new Set();\n\tconst uniques = previous.uniques.filter((unique) => scope.onColumns(unique.columns)).flatMap((unique) => {\n\t\tconst paired = next.uniques.find((candidate) => !pairedUniques.has(candidate) && isArrayEqual(candidate.columns, unique.columns));\n\t\tif (paired !== void 0) pairedUniques.add(paired);\n\t\treturn rename(\"unique\", unique.name, paired === void 0 ? void 0 : paired.name ?? defaultUniqueName(table, paired.columns));\n\t});\n\tconst previousForeignKeys = previous.foreignKeys.filter((fk) => scope.onColumns(fk.columns));\n\tconst pairing = pairForeignKeys(previousForeignKeys, next.foreignKeys);\n\tconst foreignKeys = previousForeignKeys.flatMap((fk) => {\n\t\tconst paired = pairing.get(fk);\n\t\treturn rename(\"foreignKey\", fk.name, paired === void 0 ? void 0 : paired.name ?? defaultForeignKeyName(table, fk.columns));\n\t});\n\treturn [\n\t\t...primaryKey,\n\t\t...uniques,\n\t\t...foreignKeys\n\t];\n}\n/**\n* Pairs old foreign keys with destination keys on the same columns and referenced columns. Every\n* key to the same referenced table pairs first, so an old key with no such match cannot take the\n* destination key another old key keeps; the remaining keys then pair in order.\n*/\nfunction pairForeignKeys(previous, next) {\n\tconst pairs = /* @__PURE__ */ new Map();\n\tconst taken = /* @__PURE__ */ new Set();\n\tconst pass = (accepts) => {\n\t\tfor (const fk of previous) {\n\t\t\tif (pairs.has(fk)) continue;\n\t\t\tconst paired = next.find((candidate) => !taken.has(candidate) && isArrayEqual(candidate.columns, fk.columns) && isArrayEqual(candidate.referencedColumns, fk.referencedColumns) && accepts(fk, candidate));\n\t\t\tif (paired === void 0) continue;\n\t\t\tpairs.set(fk, paired);\n\t\t\ttaken.add(paired);\n\t\t}\n\t};\n\tpass((fk, candidate) => candidate.referencedTable === fk.referencedTable && candidate.resolvedReferencedNamespace === fk.resolvedReferencedNamespace);\n\tpass(() => true);\n\treturn pairs;\n}\n//#endregion\n//#region src/core/migrations/column-rename-constraint-renames.ts\n/**\n* The constraint renames that follow a column rename. Each unique constraint and foreign key on\n* the renamed column is paired with the destination constraint of the same kind on the same\n* columns, and renamed to the destination's explicit name, or else to the name the planner derives\n* from the table and the new column names, when that differs from its name in the database. The\n* primary key's derived name does not depend on its columns, so it is left alone. `previous` is\n* the table after the column rename, its constraint names as they are in the database.\n*/\nfunction constraintRenamesForColumnRename(input) {\n\treturn pairedConstraintRenames(input, {\n\t\tprimaryKey: false,\n\t\tonColumns: (columns) => columns.includes(input.column)\n\t});\n}\n//#endregion\n//#region src/core/migrations/working-schema.ts\nfunction ddlSchemaOf(callSchemaName) {\n\treturn callSchemaName === UNBOUND_NAMESPACE_ID ? DEFAULT_NAMESPACE_ID : callSchemaName;\n}\nfunction rewriteRefs(refs, rewrite) {\n\treturn refs?.map(rewrite);\n}\n/**\n* Rewrites the step of `kind` and `id` in a ref that runs through the given table, and the table\n* step itself when `kind` is the table kind.\n*/\nfunction stepRewrite(schemaName, tableName, kind, fromId, toId) {\n\treturn (ref) => {\n\t\tconst namespaceStep = ref[1];\n\t\tconst tableStep = ref[2];\n\t\tif (namespaceStep?.nodeKind !== PostgresSchemaNodeKind.namespace || namespaceStep.id !== schemaName || tableStep?.nodeKind !== PostgresSchemaNodeKind.table || tableStep.id !== tableName) return ref;\n\t\treturn ref.map((step, index) => index >= 2 && step.nodeKind === kind && step.id === fromId ? {\n\t\t\tnodeKind: kind,\n\t\t\tid: toId\n\t\t} : step);\n\t};\n}\nfunction withColumnName(column, name) {\n\treturn new SqlColumnIR({\n\t\tname,\n\t\tnativeType: column.nativeType,\n\t\tnullable: column.nullable,\n\t\t...ifDefined(\"default\", column.default),\n\t\t...ifDefined(\"annotations\", column.annotations),\n\t\t...ifDefined(\"many\", column.many),\n\t\t...ifDefined(\"resolvedNativeType\", column.resolvedNativeType),\n\t\t...ifDefined(\"resolvedDefault\", column.resolvedDefault),\n\t\t...ifDefined(\"authoredDefault\", column.authoredDefault),\n\t\t...ifDefined(\"codecRef\", column.codecRef),\n\t\t...ifDefined(\"codecBaseNativeType\", column.codecBaseNativeType),\n\t\t...ifDefined(\"dataType\", column.dataType),\n\t\t...ifDefined(\"toCanonicalForm\", column.toCanonicalForm)\n\t});\n}\nfunction withPrimaryKey(primaryKey, name, rewrite, columnName) {\n\treturn new PrimaryKey({\n\t\tcolumns: primaryKey.columns.map(columnName),\n\t\t...ifDefined(\"name\", name),\n\t\t...ifDefined(\"dependsOn\", rewriteRefs(primaryKey.dependsOn, rewrite))\n\t});\n}\nfunction withUnique(unique, name, rewrite, columnName) {\n\treturn new SqlUniqueIR({\n\t\tcolumns: unique.columns.map(columnName),\n\t\t...ifDefined(\"name\", name),\n\t\t...ifDefined(\"annotations\", unique.annotations),\n\t\t...ifDefined(\"dependsOn\", rewriteRefs(unique.dependsOn, rewrite))\n\t});\n}\nfunction withForeignKey(fk, overrides, rewrite, columnName) {\n\treturn new SqlForeignKeyIR({\n\t\tcolumns: fk.columns.map(columnName),\n\t\treferencedTable: overrides.referencedTable,\n\t\treferencedColumns: overrides.referencedColumns ?? fk.referencedColumns,\n\t\t...ifDefined(\"referencedSchema\", fk.referencedSchema),\n\t\t...ifDefined(\"name\", overrides.name),\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t...ifDefined(\"resolvedReferencedNamespace\", fk.resolvedReferencedNamespace),\n\t\t...ifDefined(\"dependsOn\", rewriteRefs(fk.dependsOn, rewrite))\n\t});\n}\n/**\n* An index whose definition carries SQL text, an expression or a predicate, keeps its columns as\n* they are: a column named inside the text cannot be renamed here, so the diff plans the index.\n*/\nfunction withIndex(index, naming, rewrite, columnName) {\n\tconst columnsFollow = index.expression === void 0 && index.where === void 0;\n\tconst base = {\n\t\tnaming,\n\t\twhere: index.where,\n\t\tunique: index.unique,\n\t\tpartial: index.partial,\n\t\ttype: index.type,\n\t\toptions: index.options,\n\t\tannotations: index.annotations,\n\t\tdependsOn: rewriteRefs(index.dependsOn, rewrite)\n\t};\n\treturn new SqlIndexIR(index.expression !== void 0 ? {\n\t\t...base,\n\t\texpression: index.expression\n\t} : {\n\t\t...base,\n\t\tcolumns: (index.columns ?? []).map(columnsFollow ? columnName : (c) => c)\n\t});\n}\nfunction withCheck(check, naming, rewrite) {\n\treturn new SqlCheckConstraintIR({\n\t\tnaming,\n\t\texpression: check.expression,\n\t\tdependsOn: rewriteRefs(check.dependsOn, rewrite)\n\t});\n}\nfunction withPolicy(policy, overrides, rewrite) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: overrides.naming,\n\t\ttableName: overrides.tableName,\n\t\tnamespaceId: policy.namespaceId,\n\t\toperation: policy.operation,\n\t\troles: policy.roles,\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: rewriteRefs(policy.dependsOn, rewrite)\n\t});\n}\nfunction unchangedEdit(table) {\n\treturn {\n\t\tname: table.name,\n\t\tprimaryKeyName: (primaryKey) => primaryKey.name,\n\t\tuniqueName: (unique) => unique.name,\n\t\tforeignKey: (fk) => ({\n\t\t\tname: fk.name,\n\t\t\treferencedTable: fk.referencedTable\n\t\t}),\n\t\tcolumnName: (column) => column,\n\t\tindexNaming: (index) => namingOf(index.name, index.prefix),\n\t\tcheckNaming: (check) => namingOf(check.name, check.prefix),\n\t\tpolicy: (policy) => ({\n\t\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\t\ttableName: policy.tableName\n\t\t})\n\t};\n}\nfunction rebuildTable(table, edit, rewrite) {\n\tconst { columnName } = edit;\n\treturn new PostgresTableSchemaNode({\n\t\tname: edit.name,\n\t\tcolumns: Object.fromEntries(Object.values(table.columns).map((column) => {\n\t\t\tconst name = columnName(column.name);\n\t\t\treturn [name, name === column.name ? column : withColumnName(column, name)];\n\t\t})),\n\t\t...ifDefined(\"primaryKey\", table.primaryKey === void 0 ? void 0 : withPrimaryKey(table.primaryKey, edit.primaryKeyName(table.primaryKey), rewrite, columnName)),\n\t\tuniques: table.uniques.map((unique) => withUnique(unique, edit.uniqueName(unique), rewrite, columnName)),\n\t\tforeignKeys: table.foreignKeys.map((fk) => withForeignKey(fk, edit.foreignKey(fk), rewrite, columnName)),\n\t\tindexes: table.indexes.map((index) => withIndex(index, edit.indexNaming(index), rewrite, columnName)),\n\t\t...ifDefined(\"checks\", table.checks?.map((check) => withCheck(check, edit.checkNaming(check), rewrite))),\n\t\t...ifDefined(\"annotations\", table.annotations),\n\t\tpolicies: table.policies.map((policy) => withPolicy(policy, edit.policy(policy), rewrite)),\n\t\trlsEnabled: table.rlsEnabled\n\t});\n}\n/**\n* Rebuilds every table of the schema: `editFor` returns the edit for a table, or `undefined` to\n* only rewrite its dependencies.\n*/\nfunction mapTables(schema, rewrite, editFor) {\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces: Object.fromEntries(Object.entries(schema.namespaces).map(([key, namespace]) => [key, new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: namespace.schemaName,\n\t\t\tnativeEnums: namespace.nativeEnums,\n\t\t\ttables: Object.fromEntries(Object.values(namespace.tables).map((table) => {\n\t\t\t\tconst rebuilt = rebuildTable(table, editFor(namespace.schemaName, table) ?? unchangedEdit(table), rewrite);\n\t\t\t\treturn [rebuilt.name, rebuilt];\n\t\t\t}))\n\t\t})])),\n\t\troles: schema.roles,\n\t\texistingSchemas: schema.existingSchemas,\n\t\tpgVersion: schema.pgVersion\n\t});\n}\n/**\n* The schema with one table under its new name. Foreign keys anywhere that reference the table\n* follow it, its policies and every dependency that names it move with it, and row-level security\n* is carried. Constraint, index, check and policy names do not change: a primary key, unique\n* constraint or foreign key whose name was derived from the old table name gets that name spelled\n* out, since it no longer derives from the table it is on.\n*/\nfunction renameTableInPostgresSchema(schema, rename) {\n\tconst { schemaName, from, to } = rename;\n\tconst rewrite = stepRewrite(schemaName, from, PostgresSchemaNodeKind.table, from, to);\n\tconst referencesRenamed = (ownSchema, fk) => (fk.resolvedReferencedNamespace ?? ownSchema) === schemaName && fk.referencedTable === from;\n\treturn mapTables(schema, rewrite, (tableSchema, table) => {\n\t\tconst unchanged = unchangedEdit(table);\n\t\tconst followReference = (fk) => ({\n\t\t\tname: fk.name,\n\t\t\treferencedTable: referencesRenamed(tableSchema, fk) ? to : fk.referencedTable\n\t\t});\n\t\tif (tableSchema !== schemaName || table.name !== from) return {\n\t\t\t...unchanged,\n\t\t\tforeignKey: followReference\n\t\t};\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tname: to,\n\t\t\tprimaryKeyName: (primaryKey) => primaryKey.name ?? defaultPrimaryKeyName(from),\n\t\t\tuniqueName: (unique) => unique.name ?? defaultUniqueName(from, unique.columns),\n\t\t\tforeignKey: (fk) => ({\n\t\t\t\t...followReference(fk),\n\t\t\t\tname: fk.name ?? defaultForeignKeyName(from, fk.columns)\n\t\t\t}),\n\t\t\tpolicy: (policy) => ({\n\t\t\t\t...unchanged.policy(policy),\n\t\t\t\ttableName: to\n\t\t\t})\n\t\t};\n\t});\n}\n/**\n* The schema with one column under its new name. The table's primary key, unique constraints,\n* foreign keys and plain column indexes name it under the new name, foreign keys anywhere that\n* reference it follow it, and every dependency that names it moves with it. An index with an\n* expression or a predicate, and a check, keep their SQL text. Constraint and index names do not\n* change: a unique constraint or foreign key on the column whose name was derived from the old\n* column name gets that name spelled out.\n*/\nfunction renameColumnInPostgresSchema(schema, rename) {\n\tconst { schemaName, table: tableName, from, to } = rename;\n\tconst rewrite = stepRewrite(schemaName, tableName, RelationalSchemaNodeKind.column, `column:${from}`, `column:${to}`);\n\tconst renamed = (column) => column === from ? to : column;\n\tconst referencesTable = (ownSchema, fk) => (fk.resolvedReferencedNamespace ?? ownSchema) === schemaName && fk.referencedTable === tableName;\n\treturn mapTables(schema, rewrite, (tableSchema, table) => {\n\t\tconst unchanged = unchangedEdit(table);\n\t\tconst followReference = (fk) => ({\n\t\t\tname: fk.name,\n\t\t\treferencedTable: fk.referencedTable,\n\t\t\treferencedColumns: referencesTable(tableSchema, fk) ? fk.referencedColumns.map(renamed) : fk.referencedColumns\n\t\t});\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return {\n\t\t\t...unchanged,\n\t\t\tforeignKey: followReference\n\t\t};\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tcolumnName: renamed,\n\t\t\tuniqueName: (unique) => unique.name ?? (unique.columns.includes(from) ? defaultUniqueName(tableName, unique.columns) : void 0),\n\t\t\tforeignKey: (fk) => ({\n\t\t\t\t...followReference(fk),\n\t\t\t\tname: fk.name ?? (fk.columns.includes(from) ? defaultForeignKeyName(tableName, fk.columns) : void 0)\n\t\t\t})\n\t\t};\n\t});\n}\nfunction renamedNaming(previous, name) {\n\treturn previous.prefix === void 0 ? namingOf(name, void 0) : namingOfLiveName(name);\n}\nfunction renameConstraint(schema, call) {\n\tconst schemaName = ddlSchemaOf(call.schemaName);\n\tconst { tableName, oldConstraintName, newConstraintName } = call;\n\tconst renamed = (name, derived) => (name ?? derived) === oldConstraintName ? newConstraintName : name;\n\treturn mapTables(schema, stepRewrite(schemaName, tableName, RelationalSchemaNodeKind.check, `check:${oldConstraintName}`, `check:${newConstraintName}`), (tableSchema, table) => {\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return void 0;\n\t\tconst unchanged = unchangedEdit(table);\n\t\tswitch (call.kind) {\n\t\t\tcase \"primaryKey\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tprimaryKeyName: (primaryKey) => renamed(primaryKey.name, defaultPrimaryKeyName(tableName))\n\t\t\t};\n\t\t\tcase \"unique\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tuniqueName: (unique) => renamed(unique.name, defaultUniqueName(tableName, unique.columns))\n\t\t\t};\n\t\t\tcase \"foreignKey\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tforeignKey: (fk) => ({\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\tname: renamed(fk.name, defaultForeignKeyName(tableName, fk.columns))\n\t\t\t\t})\n\t\t\t};\n\t\t\tcase \"checkConstraint\": return {\n\t\t\t\t...unchanged,\n\t\t\t\tcheckNaming: (check) => check.name === oldConstraintName ? renamedNaming(check, newConstraintName) : unchanged.checkNaming(check)\n\t\t\t};\n\t\t}\n\t});\n}\nfunction renameIndex(schema, call) {\n\tconst schemaName = ddlSchemaOf(call.schemaName);\n\tconst { tableName, oldIndexName, newIndexName } = call;\n\treturn mapTables(schema, stepRewrite(schemaName, tableName, RelationalSchemaNodeKind.index, `index:${oldIndexName}`, `index:${newIndexName}`), (tableSchema, table) => {\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return void 0;\n\t\tconst unchanged = unchangedEdit(table);\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tindexNaming: (index) => index.name === oldIndexName ? renamedNaming(index, newIndexName) : unchanged.indexNaming(index)\n\t\t};\n\t});\n}\nfunction renamePolicy(schema, call) {\n\tconst schemaName = ddlSchemaOf(call.schemaName);\n\tconst { tableName, oldPolicyName, newPolicyName } = call;\n\treturn mapTables(schema, stepRewrite(schemaName, tableName, PostgresSchemaNodeKind.policy, oldPolicyName, newPolicyName), (tableSchema, table) => {\n\t\tif (tableSchema !== schemaName || table.name !== tableName) return void 0;\n\t\tconst unchanged = unchangedEdit(table);\n\t\treturn {\n\t\t\t...unchanged,\n\t\t\tpolicy: (policy) => policy.name === oldPolicyName ? {\n\t\t\t\tnaming: renamedNaming(policy, newPolicyName),\n\t\t\t\ttableName: policy.tableName\n\t\t\t} : unchanged.policy(policy)\n\t\t};\n\t});\n}\nfunction applied(schema, call) {\n\tif (call instanceof RenameTableCall) {\n\t\tconst renamed = renameTableInPostgresSchema(schema, {\n\t\t\tschemaName: ddlSchemaOf(call.schemaName),\n\t\t\tfrom: call.oldTableName,\n\t\t\tto: call.tableName\n\t\t});\n\t\treturn call.companions.reduce(applied, renamed);\n\t}\n\tif (call instanceof RenameColumnCall) {\n\t\tconst renamed = renameColumnInPostgresSchema(schema, {\n\t\t\tschemaName: ddlSchemaOf(call.schemaName),\n\t\t\ttable: call.tableName,\n\t\t\tfrom: call.oldColumnName,\n\t\t\tto: call.columnName\n\t\t});\n\t\treturn call.companions.reduce(applied, renamed);\n\t}\n\tif (call instanceof RenameConstraintCall) return renameConstraint(schema, call);\n\tif (call instanceof RenameIndexCall) return renameIndex(schema, call);\n\treturn renamePolicy(schema, call);\n}\n/** The working schema of a plan or a migration, starting from `initial`. */\nfunction createWorkingSchema(initial) {\n\treturn new WorkingSchemaImpl(initial);\n}\nvar WorkingSchemaImpl = class {\n\t#current;\n\tconstructor(initial) {\n\t\tthis.#current = initial;\n\t}\n\tget current() {\n\t\treturn this.#current;\n\t}\n\tapply(call) {\n\t\tthis.#current = applied(this.#current, call);\n\t}\n};\n//#endregion\n//#region src/core/migrations/table-rename-calls.ts\nconst RENAME_POLICY = { allowedOperationClasses: [\"widening\"] };\nfunction emissionSchemaForNamespace(contract, namespaceId) {\n\treturn namespaceId === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : resolveDdlSchemaForNamespaceStorage(contract.storage, namespaceId);\n}\n/**\n* The `renameTable` call a user writes in `migration.ts` for `rename`. `schema` names the namespace\n* the facade resolves the table in, and is left out for the unbound namespace or when not given.\n*/\nfunction renderRenameTableCall(rename) {\n\treturn new RenameTableCall(rename.namespaceId ?? UNBOUND_NAMESPACE_ID, rename.from, rename.to, []).renderTypeScript();\n}\n/** The SQL a user runs against the database to rename the table by hand. */\nfunction renameTableByHandStatements(contract, rename) {\n\treturn [renameTableStatement(emissionSchemaForNamespace(contract, rename.namespaceId), rename.from, rename.to)];\n}\nfunction tableNode(schema, ddlSchema, tableName) {\n\tconst table = schema.namespaces[ddlSchema]?.tables[tableName];\n\tassertDefined(table, `a resolved rename names table \"${tableName}\" in schema \"${ddlSchema}\"`);\n\treturn table;\n}\n/**\n* The call that renames a table, carrying as companions the renames of the objects on the table\n* whose names derive from the table name: each primary key, unique constraint and foreign key the\n* destination keeps, named as the destination names it, and each wire-named index and check whose\n* prefix changes. `previous` is the schema before the rename; the renamed copy is diffed against\n* the destination built from `contract`.\n*/\nfunction postgresTableRenameCall(input) {\n\tconst { contract, rename } = input;\n\tconst schemaName = emissionSchemaForNamespace(contract, rename.namespaceId);\n\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, rename.namespaceId);\n\tconst renamed = renameTableInPostgresSchema(input.previous, {\n\t\tschemaName: ddlSchema,\n\t\tfrom: rename.from,\n\t\tto: rename.to\n\t});\n\tconst { expected, issues } = buildPostgresPlanDiff({\n\t\tcontract,\n\t\tactualSchema: renamed,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst onRenamedTable = (call) => call.schemaName === schemaName && call.tableName === rename.to;\n\tconst pairing = {\n\t\tcontract,\n\t\tpolicy: RENAME_POLICY\n\t};\n\treturn new RenameTableCall(schemaName, rename.from, rename.to, [\n\t\t...constraintRenamesForTableRename({\n\t\t\tschemaName,\n\t\t\tprevious: tableNode(renamed, ddlSchema, rename.to),\n\t\t\tnext: tableNode(expected, ddlSchema, rename.to)\n\t\t}),\n\t\t...pairIndexRenames(pairing, issues).calls.filter(onRenamedTable),\n\t\t...pairCheckRenames(pairing, issues).calls.filter(onRenamedTable)\n\t]);\n}\n/**\n* The call that renames a column, carrying as companions the renames of the objects on its table\n* whose names derive from the column name: each unique constraint and foreign key on the column\n* the destination keeps, named as the destination names it, and each index on the column renamed\n* to the destination's wire name. `previous` is the schema before the rename; the renamed copy is\n* diffed against the destination built from `contract`. A check on the column keeps its name: its\n* expression names the column, so the diff replaces it.\n*/\nfunction postgresColumnRenameCall(input) {\n\tconst { contract, rename } = input;\n\tconst schemaName = emissionSchemaForNamespace(contract, rename.namespaceId);\n\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, rename.namespaceId);\n\tconst renamed = renameColumnInPostgresSchema(input.previous, {\n\t\tschemaName: ddlSchema,\n\t\ttable: rename.table,\n\t\tfrom: rename.from,\n\t\tto: rename.to\n\t});\n\tconst { expected, issues } = buildPostgresPlanDiff({\n\t\tcontract,\n\t\tactualSchema: renamed,\n\t\tframeworkComponents: input.frameworkComponents\n\t});\n\tconst table = tableNode(renamed, ddlSchema, rename.table);\n\tconst destination = expected.namespaces[ddlSchema]?.tables[rename.table];\n\tconst indexesOnColumn = new Set(table.indexes.filter((index) => index.columns?.includes(rename.to)).map((index) => index.name));\n\tconst indexRenames = pairIndexRenames({\n\t\tcontract,\n\t\tpolicy: RENAME_POLICY\n\t}, issues).calls.filter((call) => call.schemaName === schemaName && call.tableName === rename.table && indexesOnColumn.has(call.oldIndexName));\n\treturn new RenameColumnCall(schemaName, rename.table, rename.from, rename.to, [...destination === void 0 ? [] : constraintRenamesForColumnRename({\n\t\tschemaName,\n\t\tcolumn: rename.to,\n\t\tprevious: table,\n\t\tnext: destination\n\t}), ...indexRenames]);\n}\n//#endregion\n//#region src/core/migrations/postgres-migration.ts\n/**\n* Target-owned base class for Postgres migrations.\n*\n* Fixes the `SqlMigration` generic to `PostgresPlanTargetDetails` and the\n* abstract `targetId` to the Postgres target-id string literal, so both\n* user-authored migrations and renderer-generated scaffolds (the output of\n* `renderCallsToTypeScript`) can extend `PostgresMigration` directly without\n* redeclaring target-local identity.\n*\n* Mirrors `MongoMigration` in `@internal/family-mongo`: the renderer\n* emits `extends Migration` against a facade re-export of this class\n* from `@internal/postgres/migration`, keeping the authoring surface\n* target-scoped rather than family-scoped.\n*\n* The constructor materializes a single Postgres `SqlControlAdapter` from\n* `stack.adapter.create(stack)` and stores it; the protected `dataTransform`\n* instance method forwards to the free `dataTransform` factory with that\n* stored adapter, so user migrations can write `this.dataTransform(...)`\n* without threading the adapter through every call.\n*\n* Every method requires an explicit `schema`. Postgres migrations name their\n* schema deliberately — there is no default and no `search_path`-relative\n* option. A migration that left the schema unspecified would resolve against\n* whatever `search_path` the connection happened to carry, and that ambiguity\n* is an antipattern in a migration. (The unbound/unspecified namespace concept\n* remains for SQLite, which has no schemas, and for Mongo's connection `db`.)\n*/\nvar PostgresMigration = class extends Migration {\n\ttargetId = \"postgres\";\n\t/**\n\t* Materialized Postgres control adapter, created once per migration\n\t* instance from the injected stack. `undefined` only when the migration\n\t* was instantiated without a stack (test fixtures); `controlAdapterFor`\n\t* throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING in that case to surface the misuse.\n\t*/\n\tcontrolAdapter;\n\t/** The rename calls this read of `operations` has made so far, in order. */\n\t#renames = [];\n\t#endView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\t#startView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\tconstructor(stack) {\n\t\tsuper(stack);\n\t\tthis.controlAdapter = stack?.adapter ? blindCast(stack.adapter.create(stack)) : void 0;\n\t}\n\tframeworkComponents() {\n\t\tconst stack = this.stack;\n\t\tif (stack === void 0) return [];\n\t\treturn [\n\t\t\tstack.target,\n\t\t\t...stack.adapter === void 0 ? [] : [stack.adapter],\n\t\t\t...stack.extensions\n\t\t];\n\t}\n\t/**\n\t* Returns the materialized control adapter, or throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING naming\n\t* `operation` when the migration was constructed without a `ControlStack`.\n\t* Single home for the null-check that every DDL/DML method shares.\n\t*/\n\tcontrolAdapterFor(operation) {\n\t\tif (!this.controlAdapter) throw errorPostgresMigrationStackMissing(operation);\n\t\treturn this.controlAdapter;\n\t}\n\t/**\n\t* The typed, schema-qualified Postgres view over this migration's end-state\n\t* contract — `this.endContract.namespace.<schema>.table.<name>`, etc. Throws\n\t* if no `endContractJson` was provided.\n\t*/\n\tget endContract() {\n\t\treturn this.#endView.endContract;\n\t}\n\t/**\n\t* The typed Postgres view over this migration's start-state contract, or\n\t* `null` for a baseline migration (no `startContractJson`).\n\t*/\n\tget startContract() {\n\t\treturn this.#startView.startContract;\n\t}\n\t/**\n\t* Instance-method wrapper around the free `dataTransform` factory that\n\t* supplies the stored control adapter. Authors call this from inside\n\t* `get operations()`; the adapter argument is hidden from the call site.\n\t*/\n\tdataTransform(contract, name, options) {\n\t\treturn dataTransform(contract, name, options, this.controlAdapterFor(\"dataTransform\"));\n\t}\n\t/**\n\t* Emit a `CREATE TABLE` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateTable(options) {\n\t\treturn new CreateTableCall(options.schema, options.table, options.columns, options.constraints).toOp(this.controlAdapterFor(\"createTable\"));\n\t}\n\t/**\n\t* Emit a `CREATE SCHEMA` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateSchema(options) {\n\t\treturn new CreateSchemaCall(options.schema).toOp(this.controlAdapterFor(\"createSchema\"));\n\t}\n\t/**\n\t* Emit a `CREATE TYPE ... AS ENUM (...)` migration operation for a managed\n\t* native enum. Builds a typed DDL node and lowers it through the stored\n\t* control adapter (members render in declaration order). Throws if no adapter\n\t* is present.\n\t*/\n\tcreateNativeEnumType(options) {\n\t\treturn new CreateNativeEnumTypeCall(options.schema, options.typeName, options.members).toOp(this.controlAdapterFor(\"createNativeEnumType\"));\n\t}\n\t/**\n\t* Emit a `DROP TYPE` migration operation for a managed native enum, lowered\n\t* through the stored control adapter. Throws if no adapter is present.\n\t*/\n\tdropNativeEnumType(options) {\n\t\treturn new DropNativeEnumTypeCall(options.schema, options.typeName).toOp(this.controlAdapterFor(\"dropNativeEnumType\"));\n\t}\n\t/**\n\t* Emit an `ALTER TYPE ... ADD VALUE` migration operation appending one\n\t* member to a managed native enum, lowered through the stored control\n\t* adapter. Throws if no adapter is present. Every appended value is its\n\t* own operation — call this once per value to append more than one.\n\t*/\n\taddNativeEnumValue(options) {\n\t\treturn new AddNativeEnumValueCall(options.schema, options.typeName, options.value).toOp(this.controlAdapterFor(\"addNativeEnumValue\"));\n\t}\n\taddColumn(options) {\n\t\treturn new AddColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"addColumn\"));\n\t}\n\taddPrimaryKey(options) {\n\t\treturn new AddPrimaryKeyCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addPrimaryKey\"));\n\t}\n\taddUnique(options) {\n\t\treturn new AddUniqueCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addUnique\"));\n\t}\n\taddForeignKey(options) {\n\t\treturn new AddForeignKeyCall(options.schema, options.table, options.foreignKey).toOp(this.controlAdapterFor(\"addForeignKey\"));\n\t}\n\taddCheckConstraint(options) {\n\t\treturn new AddCheckConstraintCall(options.schema, options.table, options.constraint, options.expression).toOp(this.controlAdapterFor(\"addCheckConstraint\"));\n\t}\n\trenameCheckConstraint(options) {\n\t\treturn this.renameConstraint({\n\t\t\t...options,\n\t\t\tkind: \"checkConstraint\"\n\t\t});\n\t}\n\trenameConstraint(options) {\n\t\tconst call = new RenameConstraintCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.kind, options.from, options.to);\n\t\tconst adapter = this.controlAdapterFor(\"renameConstraint\");\n\t\tthis.#renames.push(call);\n\t\treturn call.toOp(adapter);\n\t}\n\tdropCheckConstraint(options) {\n\t\treturn new DropCheckConstraintCall(options.schema, options.table, options.constraint).toOp(this.controlAdapterFor(\"dropCheckConstraint\"));\n\t}\n\tdropConstraint(options) {\n\t\treturn new DropConstraintCall(options.schema, options.table, options.constraint, options.kind ?? \"unique\").toOp(this.controlAdapterFor(\"dropConstraint\"));\n\t}\n\t/**\n\t* Emit the operations that rename a table: the table rename, then a rename of each primary key,\n\t* unique constraint, foreign key, index and check whose name was derived from the old table name.\n\t* The old name is resolved against the schema as this migration's earlier rename calls\n\t* (`renameTable`, `renameIndex`, `renameConstraint`, `renameRlsPolicy`) leave it, and the new\n\t* name against the end contract, so the companions start from names an earlier rename gave.\n\t* Spread the result into `operations`:\n\t* `...this.renameTable({ table: 'userProfile', to: 'UserProfile' })`. `schema` names the table's\n\t* namespace when more than one declares the table. Throws `MIGRATION.TABLE_RENAME_UNMATCHED` when\n\t* the table does not exist at that point of the migration or the end contract lacks the new name.\n\t*/\n\trenameTable(options) {\n\t\tconst adapter = this.controlAdapterFor(\"renameTable\");\n\t\tconst rename = {\n\t\t\tnamespaceId: options.schema,\n\t\t\tfrom: options.table,\n\t\t\tto: options.to\n\t\t};\n\t\tconst startContract = this.startContract;\n\t\tif (startContract === null) throw unmatchedTableRename(rename, \"the migration has no start contract\");\n\t\tconst current = this.schemaAfterRenames(startContract);\n\t\tconst endContract = this.endContract;\n\t\tconst resolved = resolveTableRenameAgainst(postgresSchemaTables(current, startContract), endContract, rename);\n\t\tif (!resolved.ok) throw resolved.failure;\n\t\tconst call = postgresTableRenameCall({\n\t\t\tprevious: current,\n\t\t\tcontract: endContract,\n\t\t\trename: resolved.value,\n\t\t\tframeworkComponents: this.frameworkComponents()\n\t\t});\n\t\tthis.#renames.push(call);\n\t\treturn call.toOps(adapter).map(async (op) => op);\n\t}\n\t/**\n\t* Emit the operations that rename a column: the column rename, then a rename of each unique\n\t* constraint, foreign key and index on the column whose name was derived from the old column\n\t* name, to the name the end contract gives it. The column is resolved against the schema as this\n\t* migration's earlier rename calls leave it, so a column of a table an earlier `renameTable`\n\t* renamed is named on the table's new name. Spread the result into `operations`:\n\t* `...this.renameColumn({ table: 'User', column: 'name', to: 'fullName' })`. `schema` names the\n\t* table's namespace when more than one declares the table. Throws\n\t* `MIGRATION.COLUMN_RENAME_UNMATCHED` when the table or column does not exist at that point of\n\t* the migration, the table already has the new column, or the end contract lacks it.\n\t*/\n\trenameColumn(options) {\n\t\tconst adapter = this.controlAdapterFor(\"renameColumn\");\n\t\tconst rename = {\n\t\t\tnamespaceId: options.schema,\n\t\t\ttable: options.table,\n\t\t\tfrom: options.column,\n\t\t\tto: options.to\n\t\t};\n\t\tconst startContract = this.startContract;\n\t\tif (startContract === null) throw unmatchedColumnRename(rename, \"the migration has no start contract\");\n\t\tconst current = this.schemaAfterRenames(startContract);\n\t\tconst endContract = this.endContract;\n\t\tconst resolved = resolveColumnRenameAgainst(postgresSchemaTables(current, startContract), endContract, rename);\n\t\tif (!resolved.ok) throw resolved.failure;\n\t\tconst call = postgresColumnRenameCall({\n\t\t\tprevious: current,\n\t\t\tcontract: endContract,\n\t\t\trename: resolved.value,\n\t\t\tframeworkComponents: this.frameworkComponents()\n\t\t});\n\t\tthis.#renames.push(call);\n\t\treturn call.toOps(adapter).map(async (op) => op);\n\t}\n\t/**\n\t* The start contract's schema with this read's rename calls applied in order. It is built only\n\t* when a `renameTable` needs it, so a migration that renames no table never reads its start\n\t* contract.\n\t*/\n\tschemaAfterRenames(startContract) {\n\t\tconst working = createWorkingSchema(postgresContractToSchema(startContract, this.frameworkComponents()));\n\t\tfor (const call of this.#renames) working.apply(call);\n\t\treturn working.current;\n\t}\n\tbeginOperationsRead() {\n\t\tthis.#renames = [];\n\t}\n\tdropTable(options) {\n\t\treturn new DropTableCall(options.schema, options.table).toOp(this.controlAdapterFor(\"dropTable\"));\n\t}\n\tdropColumn(options) {\n\t\treturn new DropColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropColumn\"));\n\t}\n\talterColumnType(options) {\n\t\treturn new AlterColumnTypeCall(options.schema, options.table, options.column, options.options, options.operationClass).toOp(this.controlAdapterFor(\"alterColumnType\"));\n\t}\n\tsetNotNull(options) {\n\t\treturn new SetNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"setNotNull\"));\n\t}\n\tdropNotNull(options) {\n\t\treturn new DropNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropNotNull\"));\n\t}\n\tsetDefault(options) {\n\t\trefuseEarlierSetDefaultOptions(options);\n\t\treturn new SetDefaultCall(options.schema, options.table, options.column, options.operationClass).toOp(this.controlAdapterFor(\"setDefault\"));\n\t}\n\tdropDefault(options) {\n\t\treturn new DropDefaultCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropDefault\"));\n\t}\n\tcreateIndex(options) {\n\t\treturn new CreateIndexCall(options.schema, options.table, options.index, options.columns !== void 0 ? { columns: options.columns } : { expression: options.expression }, options.extras).toOp(this.controlAdapterFor(\"createIndex\"));\n\t}\n\trenameIndex(options) {\n\t\tconst call = new RenameIndexCall(options.schema, options.table, options.from, options.to);\n\t\tconst adapter = this.controlAdapterFor(\"renameIndex\");\n\t\tthis.#renames.push(call);\n\t\treturn call.toOp(adapter);\n\t}\n\tdropIndex(options) {\n\t\treturn new DropIndexCall(options.schema, options.table, options.index).toOp(this.controlAdapterFor(\"dropIndex\"));\n\t}\n\tinstallExtension(options) {\n\t\treturn installExtension(options, this.controlAdapterFor(\"installExtension\"));\n\t}\n\tenableRowLevelSecurity(options) {\n\t\treturn new EnableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"enableRowLevelSecurity\"));\n\t}\n\tdisableRowLevelSecurity(options) {\n\t\treturn new DisableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"disableRowLevelSecurity\"));\n\t}\n\tcreateRlsPolicy(options) {\n\t\treturn new CreatePostgresRlsPolicyCall(options.schema, options.table, new PostgresRlsPolicy({\n\t\t\t...options.policy,\n\t\t\tusing: options.policy.using,\n\t\t\twithCheck: options.policy.withCheck\n\t\t})).toOp(this.controlAdapterFor(\"createRlsPolicy\"));\n\t}\n\tdropRlsPolicy(options) {\n\t\treturn new DropPostgresRlsPolicyCall(options.schema, options.table, options.policy).toOp(this.controlAdapterFor(\"dropRlsPolicy\"));\n\t}\n\trenameRlsPolicy(options) {\n\t\tconst call = new RenamePostgresRlsPolicyCall(options.schema, options.table, options.from, options.to);\n\t\tconst adapter = this.controlAdapterFor(\"renameRlsPolicy\");\n\t\tthis.#renames.push(call);\n\t\treturn call.toOp(adapter);\n\t}\n};\n/**\n* `setDefault` options an earlier version wrote carry the column's name in `column` and its default as SQL text in `defaultSql`.\n*/\nfunction refuseEarlierSetDefaultOptions(options) {\n\tconst column = options.column;\n\tconst columnIsName = typeof column === \"string\";\n\tif (!columnIsName && !Object.hasOwn(options, \"defaultSql\")) return;\n\tthrow errorMigrationOperationOptionRemoved({\n\t\toperation: \"setDefault\",\n\t\toption: \"defaultSql\",\n\t\tsubject: `column ${JSON.stringify(columnIsName ? column : options.column.name)} of table ${JSON.stringify(options.table)}`,\n\t\trewrite: \"Pass the column as `col(name, type, { default, codecRef })`, with its default written as `lit(value)` or `fn(expression)`, in place of its name and `defaultSql`.\",\n\t\tupgradeEntry: \"migration-ts-column-defaults\"\n\t});\n}\n//#endregion\nexport { renderRenameTableCall as a, pairCheckRenames as c, postgresRenderDefault as d, renameTableByHandStatements as i, pairIndexRenames as l, postgresColumnRenameCall as n, createWorkingSchema as o, postgresTableRenameCall as r, postgresSchemaTables as s, PostgresMigration as t, postgresContractToSchema as u };\n\n//# sourceMappingURL=postgres-migration-BtlvhcXs.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,sBAAs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AAI,EAAE,YAAY,KAAK,UAAU,QAAQ,KAAK;EACvH,SAAS;EACT,cAAc;CACf,CAAC;AACF"}
@@ -4,7 +4,7 @@ import { i as postgresRenderCheckExpressions } from "./check-expressions-CtTzM58
4
4
  import { dt as postgresQualifyColumnType } from "./codecs-y1gOMMt--DKWhYGN5.mjs";
5
5
  import { n as FullTextFieldsInput, r as FullTextSearchLanguage } from "./text-search-languages-CO6775ih-DMYr9qsC.mjs";
6
6
  import { r as CodecTypes } from "./codec-types-CYsrudBM-DcYPKpS1.mjs";
7
- import { a as policyUsingOnlySpec, c as roleSpec, i as policyBothPredicatesSpec, n as RoleExtensionBlock, o as policyWithCheckOnlySpec, r as nativeEnumSpec, s as postgresLowerEntityHandles, t as RlsPolicyExtensionBlock } from "./authoring-CLNoGwgA-DPDmJeBt.mjs";
7
+ import { a as policyUsingOnlySpec, c as roleSpec, i as policyBothPredicatesSpec, n as RoleExtensionBlock, o as policyWithCheckOnlySpec, r as nativeEnumSpec, s as postgresLowerEntityHandles, t as RlsPolicyExtensionBlock } from "./authoring-DWd5pnnV-g81c_ETF.mjs";
8
8
  //#region ../../../3-targets/3-targets/postgres/dist/prisma7-binding.d.mts
9
9
  //#region src/core/migrations/default-constraint-names.d.ts
10
10
  /** `{table}_pkey` cut as Postgres cuts the name of a primary key it names itself: `CREATE TABLE` writes an unnamed primary key. */
@@ -745,7 +745,7 @@ declare const prisma7PostgresBinding: {
745
745
  readonly language?: FullTextSearchLanguage;
746
746
  readonly name?: string;
747
747
  readonly map?: string;
748
- readonly where?: string;
748
+ readonly where?: import("@prisma/orm-framework/psl-parser").ParsedTypedValue;
749
749
  }, ctx: import("@prisma/orm-framework/components/authoring").AuthoringModelAttributeContext) => {
750
750
  index: {
751
751
  columns: string[];
@@ -946,4 +946,4 @@ declare const prisma7PostgresBinding: {
946
946
  };
947
947
  //#endregion
948
948
  export { prisma7PostgresBinding as t };
949
- //# sourceMappingURL=prisma7-binding-C1fIMMTb.d.mts.map
949
+ //# sourceMappingURL=prisma7-binding-BQ5VOUjh.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prisma7-binding-C1fIMMTb.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/prisma7-binding.d.mts"],"mappings":";;;;;;;;;;iBASiB,sBAAsB;;iBAEtB,sBAAsB,mBAAmB;;;iBAGzC,0BAA0B;;;;;;;;iBAQ1B,2BAA2B,gBAAgB;;;;;;;;;;;;cAY9C;WACH;aACE;aACA;aACA,yDAAyD,iBAAiB,uBAAuB;eAC/F;SACN;eACM;SACN;eACM;SACN;eACM;SACN;eACM;SACN;eACM;SACN;eACM;QACP;QACA;;;aAGK;eACE;iBACE;mBACE;mBACA;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;mBACA;qBACE;;;iBAGJ;mBACE;qBACE;qBACA;qBACA;uBACE;uBACA;;qBAEF;uBACE;;;;;eAKR;iBACE;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;mBAOZ;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;mBAOZ;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;mBAOZ;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;mBAOZ;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;yBAEF;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;yBAEF;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;yBAEF;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;;iBAQd;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;qBACE;qBACA;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;;;mBAGJ;qBACE;qBACA;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;;;;;eAKR,WAAW,SAAS,kEAAkE;eACtF;iBACE;mBACE;mBACA;mBACA,+DAA+D;YACtE;YACA;YACA;YACA;;mBAEO;qBACE,UAAU,OAAO,oBAAoB,wDAAwD,2BAA2B;;;iBAG5H;mBACE;mBACA;mBACA,+DAA+D;YACtE;YACA;YACA;;mBAEO;qBACE,UAAU,OAAO,+BAA+B;;;iBAGpD;mBACE;mBACA;mBACA,+DAA+D;YACtE;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;;mBAEO;YACP,UAAU,OAAO,yBAAyB,wDAAwD,2BAA2B;YAC7H,eAAe,QAAQ;cACrB;;;;iBAIG;mBACE;mBACA;mBACA,+DAA+D;YACtE;YACA;YACA;YACA;;mBAEO;YACP,UAAU,sCAAsC,wBAAwB,yBAAyB,wDAAwD,2BAA2B;YACpL,iBAAiB,QAAQ;cACvB;cACA;;;;;eAKC;iBACE;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;UACA;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;;;eAGR;iBACE;mBACE;mBACA;mBACA,qCAAqC;mBACrC,QAAQ,SAAS,sBAAsB,wDAAwD;YACtG;YACA,QAAQ;;;iBAGH;mBACE;mBACA;mBACA,qCAAqC;mBACrC;mBACA,QAAQ;qBACN,QAAQ;qBACR,WAAW;qBACX;qBACA;qBACA;aACR,wDAAwD;YACzD;cACE;cACA;cACA;gBACE;gBACA;;cAEF;cACA;cACA;cACA;;;;;eAKC,wBAAwB;eACxB,0BAA0B;eAC1B,+BAA+B;eAC/B,2BAA2B;;aAE7B;eACE;iBACE;mBACE;mBACA;mBACA;;;;aAIN;aACA;aACA;aACA;aACA;aACA;aACA,mEAAmE;aACnE,eAAe;;aAEf,eAAe;;WAEjB,wBAAwB;WACxB;WACA;aACE;eACE;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;;aAGJ;eACE;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;;;WAIN;aACE;aACA;;WAEF;aACE;aACA;aACA;aACA;aACA;aACA;;;WAGF;WACA;aACE,mBAAmB;aACnB,mBAAmB;;WAErB,mCAAmC;WACnC,6BAA6B;WAC7B,uBAAuB,UAAU;aAC/B;aACA,aAAa,SAAS;;aAEtB;aACA;aACA;;aAEA;aACA,UAAU;aACV,OAAO"}
1
+ {"version":3,"file":"prisma7-binding-BQ5VOUjh.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/prisma7-binding.d.mts"],"mappings":";;;;;;;;;;iBASiB,sBAAsB;;iBAEtB,sBAAsB,mBAAmB;;;iBAGzC,0BAA0B;;;;;;;;iBAQ1B,2BAA2B,gBAAgB;;;;;;;;;;;;cAY9C;WACH;aACE;aACA;aACA,yDAAyD,iBAAiB,uBAAuB;eAC/F;SACN;eACM;SACN;eACM;SACN;eACM;SACN;eACM;SACN;eACM;SACN;eACM;QACP;QACA;;;aAGK;eACE;iBACE;mBACE;mBACA;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;mBACA;qBACE;;;iBAGJ;mBACE;qBACE;qBACA;qBACA;uBACE;uBACA;;qBAEF;uBACE;;;;;eAKR;iBACE;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;mBAOZ;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;mBAOZ;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;mBAOZ;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;mBAOZ;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;yBAEF;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;yBAEF;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA,QAAQ;uBACN;uBACA;;uBAEA;;uBAEA;yBACE;2BACE;2BACA;;yBAEF;2BACE;2BACA;;;;;mBAKR;qBACE;qBACA;uBACE;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;uBAEA;uBACA;uBACA;uBACA;;qBAEF;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;yBACE;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;yBAIN;2BACE;2BACA;2BACA;6BACE;+BACE;+BACA;;;;;;;;iBAQd;mBACE;mBACA;qBACE;;;iBAGJ;mBACE;qBACE;qBACA;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;;;mBAGJ;qBACE;qBACA;uBACE;uBACA;yBACE;2BACE;2BACA;;;uBAGJ;;;;;eAKR,WAAW,SAAS,kEAAkE;eACtF;iBACE;mBACE;mBACA;mBACA,+DAA+D;YACtE;YACA;YACA;YACA;;mBAEO;qBACE,UAAU,OAAO,oBAAoB,wDAAwD,2BAA2B;;;iBAG5H;mBACE;mBACA;mBACA,+DAA+D;YACtE;YACA;YACA;;mBAEO;qBACE,UAAU,OAAO,+BAA+B;;;iBAGpD;mBACE;mBACA;mBACA,+DAA+D;YACtE;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;YACA;;mBAEO;YACP,UAAU,OAAO,yBAAyB,wDAAwD,2BAA2B;YAC7H,eAAe,QAAQ;cACrB;;;;iBAIG;mBACE;mBACA;mBACA,+DAA+D;YACtE;YACA;YACA;YACA;;mBAEO;YACP,UAAU,sCAAsC,wBAAwB,yBAAyB,wDAAwD,2BAA2B;YACpL,iBAAiB,QAAQ;cACvB;cACA;;;;;eAKC;iBACE;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;qBACW;qBACA;;UAEX;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;UACb;UACA;YACE,0CAA0C;cACxC;8CACgC;;;iBAG7B;UACP;UACA;UACA;UACA;UACA;YACE;;UAEF,aAAa;;;eAGR;iBACE;mBACE;mBACA;mBACA,qCAAqC;mBACrC,QAAQ,SAAS,sBAAsB,wDAAwD;YACtG;YACA,QAAQ;;;iBAGH;mBACE;mBACA;mBACA,qCAAqC;mBACrC;mBACA,QAAQ;qBACN,QAAQ;qBACR,WAAW;qBACX;qBACA;qBACA,uCAAuC;aAC/C,wDAAwD;YACzD;cACE;cACA;cACA;gBACE;gBACA;;cAEF;cACA;cACA;cACA;;;;;eAKC,wBAAwB;eACxB,0BAA0B;eAC1B,+BAA+B;eAC/B,2BAA2B;;aAE7B;eACE;iBACE;mBACE;mBACA;mBACA;;;;aAIN;aACA;aACA;aACA;aACA;aACA;aACA,mEAAmE;aACnE,eAAe;;aAEf,eAAe;;WAEjB,wBAAwB;WACxB;WACA;aACE;eACE;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;;aAGJ;eACE;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;eAEF;iBACE;iBACA;;;;WAIN;aACE;aACA;;WAEF;aACE;aACA;aACA;aACA;aACA;aACA;;;WAGF;WACA;aACE,mBAAmB;aACnB,mBAAmB;;WAErB,mCAAmC;WACnC,6BAA6B;WAC7B,uBAAuB,UAAU;aAC/B;aACA,aAAa,SAAS;;aAEtB;aACA;aACA;;aAEA;aACA,UAAU;aACV,OAAO"}
@@ -1,10 +1,10 @@
1
1
  import { A as pgTimestamptz, E as pgTime, M as pgTimetz, O as pgTimestamp, a as pgBytea, b as pgJsonb, c as pgDate, y as pgJson } from "./data-types-DRkmmE9S-C5Q9oH4Q.mjs";
2
2
  import { h as postgresCreateNamespace } from "./postgres-schema-DIaAgaL6-Dmqzjbu5.mjs";
3
- import { m as postgresNowGeneratorIdFor } from "./authoring-CL05jlfX-CKUKjRVV.mjs";
4
- import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-ClvaJRgh-Dlo6A0nL.mjs";
3
+ import { m as postgresNowGeneratorIdFor } from "./authoring-BsVnEibY-DEWnQRiF.mjs";
4
+ import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-DkzkByC8-WIm-Vvrd.mjs";
5
5
  import { t as parsePostgresDefault } from "./default-normalizer-Bf_Fhv4v-CugGfLAe.mjs";
6
6
  import { n as defaultPrimaryKeyName, t as defaultForeignKeyName } from "./default-constraint-names-CtcRXhV8-nz3ff6b8.mjs";
7
- import { d as createPostgresDefaultMapping, f as createPostgresTypeMap, h as noColumnDefaults, t as EXISTING_COLUMN_DATE_TIME_TYPES, u as buildPslDocumentAst } from "./infer-psl-contract-lnoCopbJ-DRVPVZyI.mjs";
7
+ import { d as createPostgresDefaultMapping, f as createPostgresTypeMap, h as noColumnDefaults, t as EXISTING_COLUMN_DATE_TIME_TYPES, u as buildPslDocumentAst } from "./infer-psl-contract-D0iF_YRT-DwW3Imk5.mjs";
8
8
  import { dataTypeParams, renderSqlTypeName, sqlBaseName } from "@prisma/orm-family-sql/contract/data-type";
9
9
  import { SqlSchemaIR, SqlTableIR } from "@prisma/orm-family-sql/schema-ir/types";
10
10
  import { toModelName } from "@prisma/orm-family-sql/family/psl-infer";
@@ -335,4 +335,4 @@ const prisma7PostgresBinding = {
335
335
  //#endregion
336
336
  export { prisma7PostgresBinding as t };
337
337
 
338
- //# sourceMappingURL=prisma7-binding-DE7hezAQ.mjs.map
338
+ //# sourceMappingURL=prisma7-binding-Dq-vT_9_.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"prisma7-binding-DE7hezAQ.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/prisma7-binding.mjs"],"sourcesContent":["import { A as pgTimestamptz, E as pgTime, M as pgTimetz, O as pgTimestamp, a as pgBytea, b as pgJsonb, c as pgDate, y as pgJson } from \"./data-types-DRkmmE9S.mjs\";\nimport { c as postgresNowGeneratorIdFor } from \"./authoring-CL05jlfX.mjs\";\nimport { i as postgresCreateNamespace } from \"./postgres-schema-DIaAgaL6.mjs\";\nimport { t as postgresTargetDescriptorMeta } from \"./descriptor-meta-ClvaJRgh.mjs\";\nimport { t as parsePostgresDefault } from \"./default-normalizer-Bf_Fhv4v.mjs\";\nimport { n as defaultPrimaryKeyName, t as defaultForeignKeyName } from \"./default-constraint-names-CtcRXhV8.mjs\";\nimport { _ as EXISTING_COLUMN_DATE_TIME_TYPES, g as createPostgresTypeMap, l as noColumnDefaults, r as createPostgresDefaultMapping, t as buildPslDocumentAst } from \"./infer-psl-contract-lnoCopbJ.mjs\";\nimport { dataTypeParams, renderSqlTypeName, sqlBaseName } from \"@internal/sql-contract/data-type\";\nimport { SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { toModelName } from \"@internal/family-sql/psl-infer\";\nimport { flatPslModels } from \"@internal/framework-components/psl-ast\";\n//#region src/core/prisma7-temporal-defaults.ts\nconst RFC_3339 = /^(\\d{4})-(\\d{2})-(\\d{2})[Tt ](\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d+))?(?:[Zz]|([+-])(\\d{2}):(\\d{2}))$/;\nconst MICROS_PER_SECOND = 1e6;\nfunction pad(value, width = 2) {\n\treturn String(value).padStart(width, \"0\");\n}\n/**\n* The microseconds Postgres keeps for a fraction-of-a-second digit string. Every digit counts:\n* `.1234565` is an exact tie, and C's `rint` takes the even neighbour 123456, while `.1234565001`\n* is above the tie and rounds up to 123457.\n*/\nfunction fractionMicros(fraction) {\n\tconst micros = Number(`${fraction}000000`.slice(0, 6));\n\tconst beyondTie = fraction.slice(6).replace(/0+$/, \"\");\n\tif (beyondTie === \"\") return micros;\n\tif (beyondTie === \"5\") return micros % 2 === 0 ? micros : micros + 1;\n\treturn beyondTie > \"5\" ? micros + 1 : micros;\n}\nfunction fractionText(micros) {\n\treturn micros === 0 ? \"\" : `.${pad(micros, 6).replace(/0+$/, \"\")}`;\n}\nfunction offsetText(minutes) {\n\tconst magnitude = Math.abs(minutes);\n\tconst rest = magnitude % 60;\n\treturn `${minutes < 0 ? \"-\" : \"+\"}${pad(Math.floor(magnitude / 60))}${rest === 0 ? \"\" : `:${pad(rest)}`}`;\n}\n/**\n* The text of the column default Postgres stores for a Prisma 7 `DateTime`\n* default, which Prisma 7 writes as `'2024-01-02 03:04:05.123 +02:00'`:\n* `date` keeps the written date, `time` and `timestamp` the written wall-clock\n* time without the offset, and `timetz` the time with the written offset.\n* `timestamptz` is carried in its UTC form, the text a session in UTC prints\n* (`2024-01-02 01:04:05+00`, and `0001-12-31 23:30:00+00 BC` before year 1);\n* a session in another time zone prints the same instant differently.\n* Fractional seconds are rounded to microseconds; the column's own precision\n* does not change a stored default.\n*/\nfunction storedTemporalText(text, dataType) {\n\tconst match = RFC_3339.exec(text);\n\tif (match === null) return void 0;\n\tconst [, year = \"\", month = \"\", day = \"\", hour, minute, second, fraction = \"\", sign, offsetHours, offsetMinutes] = match;\n\tif (dataType === pgDate.id) return `${year}-${month}-${day}`;\n\tconst micros = fractionMicros(fraction);\n\tconst clockSeconds = Number(hour) * 3600 + Number(minute) * 60 + Number(second) + Math.floor(micros / MICROS_PER_SECOND);\n\tconst fractional = fractionText(micros % MICROS_PER_SECOND);\n\tconst offsetMinutesTotal = sign === void 0 ? 0 : (sign === \"-\" ? -1 : 1) * (Number(offsetHours) * 60 + Number(offsetMinutes));\n\tif (dataType === pgTime.id || dataType === pgTimetz.id) {\n\t\tconst clock = `${pad(Math.floor(clockSeconds / 3600))}:${pad(Math.floor(clockSeconds / 60) % 60)}:${pad(clockSeconds % 60)}${fractional}`;\n\t\treturn dataType === pgTime.id ? clock : `${clock}${offsetText(offsetMinutesTotal)}`;\n\t}\n\tconst midnight = /* @__PURE__ */ new Date(0);\n\tmidnight.setUTCFullYear(Number(year), Number(month) - 1, Number(day));\n\tconst utcShift = dataType === pgTimestamptz.id ? offsetMinutesTotal * 60 : 0;\n\tconst stamp = new Date(midnight.getTime() + (clockSeconds - utcShift) * 1e3);\n\tconst astronomicalYear = stamp.getUTCFullYear();\n\tconst wallClock = `${pad(astronomicalYear > 0 ? astronomicalYear : 1 - astronomicalYear, 4)}-${pad(stamp.getUTCMonth() + 1)}-${pad(stamp.getUTCDate())} ${pad(stamp.getUTCHours())}:${pad(stamp.getUTCMinutes())}:${pad(stamp.getUTCSeconds())}${fractional}`;\n\tconst era = astronomicalYear > 0 ? \"\" : \" BC\";\n\treturn dataType === pgTimestamptz.id ? `${wallClock}+00${era}` : `${wallClock}${era}`;\n}\n//#endregion\n//#region src/core/prisma7-type-map.ts\n/**\n* What Prisma 7.10.0 creates in Postgres for each Prisma 7 scalar and `@db.*`\n* native type, expressed as the Prisma 8 authoring type constructor that\n* produces the same column. Derived from the SQL recorded in\n* `test/integration/test/fixtures/prisma7-source/reference/migration.sql`.\n* `args` are the constructor's positional arguments. A `@db.*` attribute's own\n* arguments replace them; without any, the column gets `args`, so `@db.Char`\n* is `Char(1)`, the `character(1)` Postgres stores for Prisma 7's `CHAR`.\n*/\nconst prisma7PostgresTypeMap = {\n\tscalars: {\n\t\tString: {\n\t\t\tconstructorName: \"String\",\n\t\t\targs: []\n\t\t},\n\t\tBoolean: {\n\t\t\tconstructorName: \"Boolean\",\n\t\t\targs: []\n\t\t},\n\t\tInt: {\n\t\t\tconstructorName: \"Int\",\n\t\t\targs: []\n\t\t},\n\t\tBigInt: {\n\t\t\tconstructorName: \"BigInt\",\n\t\t\targs: []\n\t\t},\n\t\tFloat: {\n\t\t\tconstructorName: \"Float\",\n\t\t\targs: []\n\t\t},\n\t\tDecimal: {\n\t\t\tconstructorName: \"Numeric\",\n\t\t\targs: [\"65\", \"30\"]\n\t\t},\n\t\tDateTime: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.timestamp,\n\t\t\targs: [\"3\"]\n\t\t},\n\t\tJson: {\n\t\t\tconstructorName: \"Jsonb\",\n\t\t\targs: []\n\t\t},\n\t\tBytes: {\n\t\t\tconstructorName: \"Bytes\",\n\t\t\targs: []\n\t\t}\n\t},\n\tnativeTypes: {\n\t\tText: {\n\t\t\tconstructorName: \"String\",\n\t\t\targs: []\n\t\t},\n\t\tVarChar: {\n\t\t\tconstructorName: \"VarChar\",\n\t\t\targs: []\n\t\t},\n\t\tChar: {\n\t\t\tconstructorName: \"Char\",\n\t\t\targs: [\"1\"]\n\t\t},\n\t\tUuid: {\n\t\t\tconstructorName: \"Uuid\",\n\t\t\targs: []\n\t\t},\n\t\tInet: {\n\t\t\tconstructorName: \"Inet\",\n\t\t\targs: []\n\t\t},\n\t\tBoolean: {\n\t\t\tconstructorName: \"Boolean\",\n\t\t\targs: []\n\t\t},\n\t\tInteger: {\n\t\t\tconstructorName: \"Int\",\n\t\t\targs: []\n\t\t},\n\t\tSmallInt: {\n\t\t\tconstructorName: \"SmallInt\",\n\t\t\targs: []\n\t\t},\n\t\tBigInt: {\n\t\t\tconstructorName: \"BigInt\",\n\t\t\targs: []\n\t\t},\n\t\tReal: {\n\t\t\tconstructorName: \"Real\",\n\t\t\targs: []\n\t\t},\n\t\tDoublePrecision: {\n\t\t\tconstructorName: \"Float\",\n\t\t\targs: []\n\t\t},\n\t\tDecimal: {\n\t\t\tconstructorName: \"Numeric\",\n\t\t\targs: []\n\t\t},\n\t\tTimestamp: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.timestamp,\n\t\t\targs: []\n\t\t},\n\t\tTimestamptz: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.timestamptz,\n\t\t\targs: []\n\t\t},\n\t\tDate: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.date,\n\t\t\targs: []\n\t\t},\n\t\tTime: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.time,\n\t\t\targs: []\n\t\t},\n\t\tTimetz: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.timetz,\n\t\t\targs: []\n\t\t},\n\t\tJson: {\n\t\t\tconstructorName: \"Json\",\n\t\t\targs: []\n\t\t},\n\t\tJsonB: {\n\t\t\tconstructorName: \"Jsonb\",\n\t\t\targs: []\n\t\t},\n\t\tByteA: {\n\t\t\tconstructorName: \"Bytes\",\n\t\t\targs: []\n\t\t}\n\t}\n};\n//#endregion\n//#region src/core/psl-infer/junction-relation-field-names.ts\nconst EMPTY_FOREIGN_KEY_EXTRAS = {\n\textraRelationsByTable: /* @__PURE__ */ new Map(),\n\tcrossSpaceFieldNamesByTable: /* @__PURE__ */ new Map(),\n\tdanglingForeignKeysByTable: /* @__PURE__ */ new Map()\n};\nfunction idTable(name) {\n\treturn new SqlTableIR({\n\t\tname,\n\t\tcolumns: { id: {\n\t\t\tname: \"id\",\n\t\t\tnativeType: \"int4\",\n\t\t\tnullable: false\n\t\t} },\n\t\tforeignKeys: [],\n\t\tuniques: [],\n\t\tindexes: [],\n\t\tprimaryKey: { columns: [\"id\"] }\n\t});\n}\n/**\n* The relation field names `contract infer` prints for an implicit\n* many-to-many junction table whose columns `A` and `B` reference `tableA`\n* and `tableB`, found by running infer's PSL construction on that table.\n*/\nfunction junctionRelationFieldNames(tableA, tableB) {\n\tlet junctionName = \"_junction\";\n\twhile ([tableA, tableB].some((table) => toModelName(table).name === toModelName(junctionName).name)) junctionName = `${junctionName}x`;\n\tconst column = (name) => ({\n\t\tname,\n\t\tnativeType: \"int4\",\n\t\tnullable: false\n\t});\n\tconst foreignKey = (columnName, referencedTable) => ({\n\t\tcolumns: [columnName],\n\t\treferencedTable,\n\t\treferencedColumns: [\"id\"]\n\t});\n\tconst junction = new SqlTableIR({\n\t\tname: junctionName,\n\t\tcolumns: {\n\t\t\tA: column(\"A\"),\n\t\t\tB: column(\"B\")\n\t\t},\n\t\tforeignKeys: [foreignKey(\"A\", tableA), foreignKey(\"B\", tableB)],\n\t\tuniques: [],\n\t\tindexes: [],\n\t\tprimaryKey: { columns: [\"A\", \"B\"] }\n\t});\n\tconst document = buildPslDocumentAst(new SqlSchemaIR({ tables: {\n\t\t[tableA]: idTable(tableA),\n\t\t[tableB]: idTable(tableB),\n\t\t[junctionName]: junction\n\t} }), {\n\t\ttypeMap: createPostgresTypeMap(),\n\t\tdefaultMapping: createPostgresDefaultMapping(),\n\t\tparseRawDefault: parsePostgresDefault,\n\t\tcolumnDefaults: noColumnDefaults\n\t}, EMPTY_FOREIGN_KEY_EXTRAS);\n\tconst junctionModelName = toModelName(junctionName).name;\n\tconst fields = flatPslModels(document).find((model) => model.name === junctionModelName)?.fields;\n\tconst scalarFieldCount = Object.keys(junction.columns).length;\n\tconst [a = \"\", b = \"\"] = (fields ?? []).slice(scalarFieldCount).map((field) => field.name);\n\treturn [a, b];\n}\n//#endregion\n//#region src/core/prisma7-binding.ts\nconst TEMPORAL_TYPES = new Map([\n\tpgTimestamp,\n\tpgTimestamptz,\n\tpgDate,\n\tpgTime,\n\tpgTimetz\n].map((type) => [type.id, type]));\nconst BYTEA_LIST_TYPE = sqlBaseName(pgBytea, {}).toUpperCase();\nfunction sqlStringLiteral(value) {\n\treturn value === void 0 ? void 0 : `'${value.replace(/'/g, \"''\")}'`;\n}\nfunction base64ToHex(base64) {\n\tif (!/^[A-Za-z0-9+/]*={0,2}$/.test(base64) || base64.length % 4 !== 0) return void 0;\n\treturn `\\\\x${Buffer.from(base64, \"base64\").toString(\"hex\")}`;\n}\nfunction arrayLiteral(literals, typeName) {\n\treturn `ARRAY[${literals.join(\", \")}]::${typeName}[]`;\n}\n/**\n* What the Postgres target supplies to the Prisma 7 interpreter. A `Bytes` or\n* `DateTime` default is carried as the SQL literal of the default Postgres\n* stores (`'\\x68656c6c6f'`, `'2024-01-02 03:04:05'`), and a list default as an\n* `ARRAY[...]` of those literals cast to the column type, rather than as the\n* column codec's JSON form (base64, ISO 8601 text). Verify reads both forms as\n* the same value; the reader keeps the SQL literal because storing the value\n* instead changes the contract hash of every such schema (TML-3455).\n*/\nconst prisma7PostgresBinding = {\n\ttarget: postgresTargetDescriptorMeta,\n\tcreateNamespace: postgresCreateNamespace,\n\tproviders: [\"postgresql\", \"postgres\"],\n\ttypeMap: prisma7PostgresTypeMap,\n\tnativeEnum: {\n\t\tentityKind: \"native_enum\",\n\t\ttypeConstructor: [\"pg\", \"enum\"]\n\t},\n\tindexTypes: {\n\t\tBTree: \"btree\",\n\t\tHash: \"hash\",\n\t\tGin: \"gin\",\n\t\tGist: \"gist\",\n\t\tSpGist: \"spgist\",\n\t\tBrin: \"brin\"\n\t},\n\t/** `NAMEDATALEN - 1`. */\n\tidentifierMaxBytes: 63,\n\tdefaultConstraintNames: {\n\t\tprimaryKey: defaultPrimaryKeyName,\n\t\tforeignKey: defaultForeignKeyName\n\t},\n\tjunctionRelationFieldNames,\n\tupdatedAtGeneratorId: postgresNowGeneratorIdFor,\n\tliteralDefaultForm: ({ dataType, typeParams }) => {\n\t\tif (dataType === pgJson.id || dataType === pgJsonb.id) return { kind: \"json\" };\n\t\tif (dataType === pgBytea.id) return {\n\t\t\tkind: \"sqlExpression\",\n\t\t\tliteral: (text) => sqlStringLiteral(base64ToHex(text)),\n\t\t\tlist: (literals) => arrayLiteral(literals, BYTEA_LIST_TYPE)\n\t\t};\n\t\tconst type = TEMPORAL_TYPES.get(dataType);\n\t\tif (type === void 0) return void 0;\n\t\tconst typeName = renderSqlTypeName(type, dataTypeParams(type, typeParams)).toUpperCase();\n\t\treturn {\n\t\t\tkind: \"sqlExpression\",\n\t\t\tliteral: (text) => sqlStringLiteral(storedTemporalText(text, type.id)),\n\t\t\tlist: (literals) => arrayLiteral(literals, typeName)\n\t\t};\n\t}\n};\n//#endregion\nexport { prisma7PostgresBinding };\n\n//# sourceMappingURL=prisma7-binding.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,WAAW;AACjB,MAAM,oBAAoB;AAC1B,SAAS,IAAI,OAAO,QAAQ,GAAG;CAC9B,OAAO,OAAO,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG;AACzC;;;;;;AAMA,SAAS,eAAe,UAAU;CACjC,MAAM,SAAS,OAAO,GAAG,SAAS,QAAQ,MAAM,GAAG,CAAC,CAAC;CACrD,MAAM,YAAY,SAAS,MAAM,CAAC,CAAC,CAAC,QAAQ,OAAO,EAAE;CACrD,IAAI,cAAc,IAAI,OAAO;CAC7B,IAAI,cAAc,KAAK,OAAO,SAAS,MAAM,IAAI,SAAS,SAAS;CACnE,OAAO,YAAY,MAAM,SAAS,IAAI;AACvC;AACA,SAAS,aAAa,QAAQ;CAC7B,OAAO,WAAW,IAAI,KAAK,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,OAAO,EAAE;AAChE;AACA,SAAS,WAAW,SAAS;CAC5B,MAAM,YAAY,KAAK,IAAI,OAAO;CAClC,MAAM,O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sources":["../../../../3-targets/3-targets/postgres/dist/prisma7-binding.mjs"],"sourcesContent":["import { A as pgTimestamptz, E as pgTime, M as pgTimetz, O as pgTimestamp, a as pgBytea, b as pgJsonb, c as pgDate, y as pgJson } from \"./data-types-DRkmmE9S.mjs\";\nimport { c as postgresNowGeneratorIdFor } from \"./authoring-BsVnEibY.mjs\";\nimport { i as postgresCreateNamespace } from \"./postgres-schema-DIaAgaL6.mjs\";\nimport { t as postgresTargetDescriptorMeta } from \"./descriptor-meta-DkzkByC8.mjs\";\nimport { t as parsePostgresDefault } from \"./default-normalizer-Bf_Fhv4v.mjs\";\nimport { n as defaultPrimaryKeyName, t as defaultForeignKeyName } from \"./default-constraint-names-CtcRXhV8.mjs\";\nimport { _ as EXISTING_COLUMN_DATE_TIME_TYPES, g as createPostgresTypeMap, l as noColumnDefaults, r as createPostgresDefaultMapping, t as buildPslDocumentAst } from \"./infer-psl-contract-D0iF_YRT.mjs\";\nimport { dataTypeParams, renderSqlTypeName, sqlBaseName } from \"@internal/sql-contract/data-type\";\nimport { SqlSchemaIR, SqlTableIR } from \"@internal/sql-schema-ir/types\";\nimport { toModelName } from \"@internal/family-sql/psl-infer\";\nimport { flatPslModels } from \"@internal/framework-components/psl-ast\";\n//#region src/core/prisma7-temporal-defaults.ts\nconst RFC_3339 = /^(\\d{4})-(\\d{2})-(\\d{2})[Tt ](\\d{2}):(\\d{2}):(\\d{2})(?:\\.(\\d+))?(?:[Zz]|([+-])(\\d{2}):(\\d{2}))$/;\nconst MICROS_PER_SECOND = 1e6;\nfunction pad(value, width = 2) {\n\treturn String(value).padStart(width, \"0\");\n}\n/**\n* The microseconds Postgres keeps for a fraction-of-a-second digit string. Every digit counts:\n* `.1234565` is an exact tie, and C's `rint` takes the even neighbour 123456, while `.1234565001`\n* is above the tie and rounds up to 123457.\n*/\nfunction fractionMicros(fraction) {\n\tconst micros = Number(`${fraction}000000`.slice(0, 6));\n\tconst beyondTie = fraction.slice(6).replace(/0+$/, \"\");\n\tif (beyondTie === \"\") return micros;\n\tif (beyondTie === \"5\") return micros % 2 === 0 ? micros : micros + 1;\n\treturn beyondTie > \"5\" ? micros + 1 : micros;\n}\nfunction fractionText(micros) {\n\treturn micros === 0 ? \"\" : `.${pad(micros, 6).replace(/0+$/, \"\")}`;\n}\nfunction offsetText(minutes) {\n\tconst magnitude = Math.abs(minutes);\n\tconst rest = magnitude % 60;\n\treturn `${minutes < 0 ? \"-\" : \"+\"}${pad(Math.floor(magnitude / 60))}${rest === 0 ? \"\" : `:${pad(rest)}`}`;\n}\n/**\n* The text of the column default Postgres stores for a Prisma 7 `DateTime`\n* default, which Prisma 7 writes as `'2024-01-02 03:04:05.123 +02:00'`:\n* `date` keeps the written date, `time` and `timestamp` the written wall-clock\n* time without the offset, and `timetz` the time with the written offset.\n* `timestamptz` is carried in its UTC form, the text a session in UTC prints\n* (`2024-01-02 01:04:05+00`, and `0001-12-31 23:30:00+00 BC` before year 1);\n* a session in another time zone prints the same instant differently.\n* Fractional seconds are rounded to microseconds; the column's own precision\n* does not change a stored default.\n*/\nfunction storedTemporalText(text, dataType) {\n\tconst match = RFC_3339.exec(text);\n\tif (match === null) return void 0;\n\tconst [, year = \"\", month = \"\", day = \"\", hour, minute, second, fraction = \"\", sign, offsetHours, offsetMinutes] = match;\n\tif (dataType === pgDate.id) return `${year}-${month}-${day}`;\n\tconst micros = fractionMicros(fraction);\n\tconst clockSeconds = Number(hour) * 3600 + Number(minute) * 60 + Number(second) + Math.floor(micros / MICROS_PER_SECOND);\n\tconst fractional = fractionText(micros % MICROS_PER_SECOND);\n\tconst offsetMinutesTotal = sign === void 0 ? 0 : (sign === \"-\" ? -1 : 1) * (Number(offsetHours) * 60 + Number(offsetMinutes));\n\tif (dataType === pgTime.id || dataType === pgTimetz.id) {\n\t\tconst clock = `${pad(Math.floor(clockSeconds / 3600))}:${pad(Math.floor(clockSeconds / 60) % 60)}:${pad(clockSeconds % 60)}${fractional}`;\n\t\treturn dataType === pgTime.id ? clock : `${clock}${offsetText(offsetMinutesTotal)}`;\n\t}\n\tconst midnight = /* @__PURE__ */ new Date(0);\n\tmidnight.setUTCFullYear(Number(year), Number(month) - 1, Number(day));\n\tconst utcShift = dataType === pgTimestamptz.id ? offsetMinutesTotal * 60 : 0;\n\tconst stamp = new Date(midnight.getTime() + (clockSeconds - utcShift) * 1e3);\n\tconst astronomicalYear = stamp.getUTCFullYear();\n\tconst wallClock = `${pad(astronomicalYear > 0 ? astronomicalYear : 1 - astronomicalYear, 4)}-${pad(stamp.getUTCMonth() + 1)}-${pad(stamp.getUTCDate())} ${pad(stamp.getUTCHours())}:${pad(stamp.getUTCMinutes())}:${pad(stamp.getUTCSeconds())}${fractional}`;\n\tconst era = astronomicalYear > 0 ? \"\" : \" BC\";\n\treturn dataType === pgTimestamptz.id ? `${wallClock}+00${era}` : `${wallClock}${era}`;\n}\n//#endregion\n//#region src/core/prisma7-type-map.ts\n/**\n* What Prisma 7.10.0 creates in Postgres for each Prisma 7 scalar and `@db.*`\n* native type, expressed as the Prisma 8 authoring type constructor that\n* produces the same column. Derived from the SQL recorded in\n* `test/integration/test/fixtures/prisma7-source/reference/migration.sql`.\n* `args` are the constructor's positional arguments. A `@db.*` attribute's own\n* arguments replace them; without any, the column gets `args`, so `@db.Char`\n* is `Char(1)`, the `character(1)` Postgres stores for Prisma 7's `CHAR`.\n*/\nconst prisma7PostgresTypeMap = {\n\tscalars: {\n\t\tString: {\n\t\t\tconstructorName: \"String\",\n\t\t\targs: []\n\t\t},\n\t\tBoolean: {\n\t\t\tconstructorName: \"Boolean\",\n\t\t\targs: []\n\t\t},\n\t\tInt: {\n\t\t\tconstructorName: \"Int\",\n\t\t\targs: []\n\t\t},\n\t\tBigInt: {\n\t\t\tconstructorName: \"BigInt\",\n\t\t\targs: []\n\t\t},\n\t\tFloat: {\n\t\t\tconstructorName: \"Float\",\n\t\t\targs: []\n\t\t},\n\t\tDecimal: {\n\t\t\tconstructorName: \"Numeric\",\n\t\t\targs: [\"65\", \"30\"]\n\t\t},\n\t\tDateTime: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.timestamp,\n\t\t\targs: [\"3\"]\n\t\t},\n\t\tJson: {\n\t\t\tconstructorName: \"Jsonb\",\n\t\t\targs: []\n\t\t},\n\t\tBytes: {\n\t\t\tconstructorName: \"Bytes\",\n\t\t\targs: []\n\t\t}\n\t},\n\tnativeTypes: {\n\t\tText: {\n\t\t\tconstructorName: \"String\",\n\t\t\targs: []\n\t\t},\n\t\tVarChar: {\n\t\t\tconstructorName: \"VarChar\",\n\t\t\targs: []\n\t\t},\n\t\tChar: {\n\t\t\tconstructorName: \"Char\",\n\t\t\targs: [\"1\"]\n\t\t},\n\t\tUuid: {\n\t\t\tconstructorName: \"Uuid\",\n\t\t\targs: []\n\t\t},\n\t\tInet: {\n\t\t\tconstructorName: \"Inet\",\n\t\t\targs: []\n\t\t},\n\t\tBoolean: {\n\t\t\tconstructorName: \"Boolean\",\n\t\t\targs: []\n\t\t},\n\t\tInteger: {\n\t\t\tconstructorName: \"Int\",\n\t\t\targs: []\n\t\t},\n\t\tSmallInt: {\n\t\t\tconstructorName: \"SmallInt\",\n\t\t\targs: []\n\t\t},\n\t\tBigInt: {\n\t\t\tconstructorName: \"BigInt\",\n\t\t\targs: []\n\t\t},\n\t\tReal: {\n\t\t\tconstructorName: \"Real\",\n\t\t\targs: []\n\t\t},\n\t\tDoublePrecision: {\n\t\t\tconstructorName: \"Float\",\n\t\t\targs: []\n\t\t},\n\t\tDecimal: {\n\t\t\tconstructorName: \"Numeric\",\n\t\t\targs: []\n\t\t},\n\t\tTimestamp: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.timestamp,\n\t\t\targs: []\n\t\t},\n\t\tTimestamptz: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.timestamptz,\n\t\t\targs: []\n\t\t},\n\t\tDate: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.date,\n\t\t\targs: []\n\t\t},\n\t\tTime: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.time,\n\t\t\targs: []\n\t\t},\n\t\tTimetz: {\n\t\t\tconstructorName: EXISTING_COLUMN_DATE_TIME_TYPES.timetz,\n\t\t\targs: []\n\t\t},\n\t\tJson: {\n\t\t\tconstructorName: \"Json\",\n\t\t\targs: []\n\t\t},\n\t\tJsonB: {\n\t\t\tconstructorName: \"Jsonb\",\n\t\t\targs: []\n\t\t},\n\t\tByteA: {\n\t\t\tconstructorName: \"Bytes\",\n\t\t\targs: []\n\t\t}\n\t}\n};\n//#endregion\n//#region src/core/psl-infer/junction-relation-field-names.ts\nconst EMPTY_FOREIGN_KEY_EXTRAS = {\n\textraRelationsByTable: /* @__PURE__ */ new Map(),\n\tcrossSpaceFieldNamesByTable: /* @__PURE__ */ new Map(),\n\tdanglingForeignKeysByTable: /* @__PURE__ */ new Map()\n};\nfunction idTable(name) {\n\treturn new SqlTableIR({\n\t\tname,\n\t\tcolumns: { id: {\n\t\t\tname: \"id\",\n\t\t\tnativeType: \"int4\",\n\t\t\tnullable: false\n\t\t} },\n\t\tforeignKeys: [],\n\t\tuniques: [],\n\t\tindexes: [],\n\t\tprimaryKey: { columns: [\"id\"] }\n\t});\n}\n/**\n* The relation field names `contract infer` prints for an implicit\n* many-to-many junction table whose columns `A` and `B` reference `tableA`\n* and `tableB`, found by running infer's PSL construction on that table.\n*/\nfunction junctionRelationFieldNames(tableA, tableB) {\n\tlet junctionName = \"_junction\";\n\twhile ([tableA, tableB].some((table) => toModelName(table).name === toModelName(junctionName).name)) junctionName = `${junctionName}x`;\n\tconst column = (name) => ({\n\t\tname,\n\t\tnativeType: \"int4\",\n\t\tnullable: false\n\t});\n\tconst foreignKey = (columnName, referencedTable) => ({\n\t\tcolumns: [columnName],\n\t\treferencedTable,\n\t\treferencedColumns: [\"id\"]\n\t});\n\tconst junction = new SqlTableIR({\n\t\tname: junctionName,\n\t\tcolumns: {\n\t\t\tA: column(\"A\"),\n\t\t\tB: column(\"B\")\n\t\t},\n\t\tforeignKeys: [foreignKey(\"A\", tableA), foreignKey(\"B\", tableB)],\n\t\tuniques: [],\n\t\tindexes: [],\n\t\tprimaryKey: { columns: [\"A\", \"B\"] }\n\t});\n\tconst document = buildPslDocumentAst(new SqlSchemaIR({ tables: {\n\t\t[tableA]: idTable(tableA),\n\t\t[tableB]: idTable(tableB),\n\t\t[junctionName]: junction\n\t} }), {\n\t\ttypeMap: createPostgresTypeMap(),\n\t\tdefaultMapping: createPostgresDefaultMapping(),\n\t\tparseRawDefault: parsePostgresDefault,\n\t\tcolumnDefaults: noColumnDefaults\n\t}, EMPTY_FOREIGN_KEY_EXTRAS);\n\tconst junctionModelName = toModelName(junctionName).name;\n\tconst fields = flatPslModels(document).find((model) => model.name === junctionModelName)?.fields;\n\tconst scalarFieldCount = Object.keys(junction.columns).length;\n\tconst [a = \"\", b = \"\"] = (fields ?? []).slice(scalarFieldCount).map((field) => field.name);\n\treturn [a, b];\n}\n//#endregion\n//#region src/core/prisma7-binding.ts\nconst TEMPORAL_TYPES = new Map([\n\tpgTimestamp,\n\tpgTimestamptz,\n\tpgDate,\n\tpgTime,\n\tpgTimetz\n].map((type) => [type.id, type]));\nconst BYTEA_LIST_TYPE = sqlBaseName(pgBytea, {}).toUpperCase();\nfunction sqlStringLiteral(value) {\n\treturn value === void 0 ? void 0 : `'${value.replace(/'/g, \"''\")}'`;\n}\nfunction base64ToHex(base64) {\n\tif (!/^[A-Za-z0-9+/]*={0,2}$/.test(base64) || base64.length % 4 !== 0) return void 0;\n\treturn `\\\\x${Buffer.from(base64, \"base64\").toString(\"hex\")}`;\n}\nfunction arrayLiteral(literals, typeName) {\n\treturn `ARRAY[${literals.join(\", \")}]::${typeName}[]`;\n}\n/**\n* What the Postgres target supplies to the Prisma 7 interpreter. A `Bytes` or\n* `DateTime` default is carried as the SQL literal of the default Postgres\n* stores (`'\\x68656c6c6f'`, `'2024-01-02 03:04:05'`), and a list default as an\n* `ARRAY[...]` of those literals cast to the column type, rather than as the\n* column codec's JSON form (base64, ISO 8601 text). Verify reads both forms as\n* the same value; the reader keeps the SQL literal because storing the value\n* instead changes the contract hash of every such schema (TML-3455).\n*/\nconst prisma7PostgresBinding = {\n\ttarget: postgresTargetDescriptorMeta,\n\tcreateNamespace: postgresCreateNamespace,\n\tproviders: [\"postgresql\", \"postgres\"],\n\ttypeMap: prisma7PostgresTypeMap,\n\tnativeEnum: {\n\t\tentityKind: \"native_enum\",\n\t\ttypeConstructor: [\"pg\", \"enum\"]\n\t},\n\tindexTypes: {\n\t\tBTree: \"btree\",\n\t\tHash: \"hash\",\n\t\tGin: \"gin\",\n\t\tGist: \"gist\",\n\t\tSpGist: \"spgist\",\n\t\tBrin: \"brin\"\n\t},\n\t/** `NAMEDATALEN - 1`. */\n\tidentifierMaxBytes: 63,\n\tdefaultConstraintNames: {\n\t\tprimaryKey: defaultPrimaryKeyName,\n\t\tforeignKey: defaultForeignKeyName\n\t},\n\tjunctionRelationFieldNames,\n\tupdatedAtGeneratorId: postgresNowGeneratorIdFor,\n\tliteralDefaultForm: ({ dataType, typeParams }) => {\n\t\tif (dataType === pgJson.id || dataType === pgJsonb.id) return { kind: \"json\" };\n\t\tif (dataType === pgBytea.id) return {\n\t\t\tkind: \"sqlExpression\",\n\t\t\tliteral: (text) => sqlStringLiteral(base64ToHex(text)),\n\t\t\tlist: (literals) => arrayLiteral(literals, BYTEA_LIST_TYPE)\n\t\t};\n\t\tconst type = TEMPORAL_TYPES.get(dataType);\n\t\tif (type === void 0) return void 0;\n\t\tconst typeName = renderSqlTypeName(type, dataTypeParams(type, typeParams)).toUpperCase();\n\t\treturn {\n\t\t\tkind: \"sqlExpression\",\n\t\t\tliteral: (text) => sqlStringLiteral(storedTemporalText(text, type.id)),\n\t\t\tlist: (literals) => arrayLiteral(literals, typeName)\n\t\t};\n\t}\n};\n//#endregion\nexport { prisma7PostgresBinding };\n\n//# sourceMappingURL=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;CACP;;CAEA,oBAAoB;CACpB,wBAAwB;EACvB,YAAY;EACZ,YAAY;CACb;CACA;CACA,sBAAsB;CACtB,qBAAqB,EAAE,UAAU,iBAAiB;EACjD,IAAI,aAAa,OAAO,MAAM,aAAa,QAAQ,IAAI,OAAO,EAAE,MAAM,OAAO;EAC7E,IAAI,aAAa,QAAQ,IAAI,OAAO;GACnC,MAAM;GACN,UAAU,SAAS,iBAAiB,YAAY,IAAI,CAAC;GACrD,OAAO,aAAa,aAAa,UAAU,eAAe;EAC3D;EACA,MAAM,OAAO,eAAe,IAAI,QAAQ;EACxC,IAAI,SAAS,KAAK,GAAG,OAAO,KAAK;EACjC,MAAM,WAAW,kBAAkB,MAAM,eAAe,MAAM,UAAU,CAAC,CAAC,CAAC,YAAY;EACvF,OAAO;GACN,MAAM;GACN,UAAU,SAAS,iBAAiB,mBAAmB,MAAM,KAAK,EAAE,CAAC;GACrE,OAAO,aAAa,aAAa,UAAU,QAAQ;EACpD;CACD;AACD"}
package/dist/target.d.mts CHANGED
@@ -44,7 +44,7 @@ import { t as PostgresMigration } from "./postgres-migration-D2Xs7BfD-Df3OpTyw.m
44
44
  import { a as fn, c as placeholder, d as unique, i as createExtension, l as primaryKey, n as checkExpression, o as foreignKey, r as col, s as lit, t as MigrationCLI, u as rawSql } from "./migration-D5f4UTR3.mjs";
45
45
  import "./op-factory-call-CwFkWbuo.mjs";
46
46
  import { a as TsqueryArgument, i as QueryOperationTypes, n as FullTextMatchesOptions, r as FullTextRankOptions, t as FullTextHeadlineOptions } from "./operation-types-llBeWQxy.mjs";
47
- import "./pack-C3Y2SBNH.mjs";
47
+ import "./pack-BOVET-UW.mjs";
48
48
  import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-BwZrjNPg-Ch67sFwK.mjs";
49
49
  import { n as createPostgresMigrationPlanner, t as contractToPostgresDatabaseSchemaNode } from "./planner-BkGEylgU.mjs";
50
50
  import { a as renderDefaultLiteral, i as postgresDateTimeDdlText, n as buildColumnTypeSql, r as isPostgresDateTimeDataType, t as DefaultColumn } from "./planner-ddl-builders-BBQC5ET6.mjs";
@@ -52,7 +52,7 @@ import { n as resolveIdentityValue, t as buildBuiltinIdentityValue } from "./pla
52
52
  import "./planner-produced-postgres-migration-eDPWYNBo.mjs";
53
53
  import { i as hasUniqueConstraint, n as hasForeignKey, r as hasIndex, t as buildSchemaLookupMap } from "./planner-schema-lookup-C4DHAddq.mjs";
54
54
  import { n as qualifyTableName, t as buildExpectedFormatType } from "./planner-sql-checks-CXDdt_9m.mjs";
55
- import { t as prisma7PostgresBinding } from "./prisma7-binding-C1fIMMTb.mjs";
55
+ import { t as prisma7PostgresBinding } from "./prisma7-binding-BQ5VOUjh.mjs";
56
56
  import { t as renderOps } from "./render-ops-DPwhZt2W.mjs";
57
57
  import { t as renderCallsToTypeScript } from "./render-typescript-6sCFvMBh.mjs";
58
58
  import { n as PostgresListDecoder, r as PostgresRuntimeTargetInstance, t as PostgresContractSerializer } from "./runtime-DAJXp26i.mjs";