@prisma/orm-target-postgres 8.0.0-rc.16-dev.3 → 8.0.0-rc.16-dev.5

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 (112) hide show
  1. package/dist/{adapter-RtS8vD8U-BvmL3EaF.mjs → adapter-RtS8vD8U-m4U_WTpQ.mjs} +5 -5
  2. package/dist/{adapter-RtS8vD8U-BvmL3EaF.mjs.map → adapter-RtS8vD8U-m4U_WTpQ.mjs.map} +1 -1
  3. package/dist/adapter.mjs +5 -5
  4. package/dist/adapter__adapter.mjs +2 -2
  5. package/dist/adapter__control.mjs +6 -6
  6. package/dist/adapter__runtime.mjs +4 -4
  7. package/dist/adapter__sql-renderer.mjs +1 -1
  8. package/dist/{authoring-CfPWv_-P-BHAGgGYI.mjs → authoring-vHbPLrW4-BsHR7gUE.mjs} +5 -5
  9. package/dist/{authoring-CfPWv_-P-BHAGgGYI.mjs.map → authoring-vHbPLrW4-BsHR7gUE.mjs.map} +1 -1
  10. package/dist/{check-expressions-BRuSxJ5d-CC5OFfR1.mjs → check-expressions-Dlt334zg-CV5Vkh3G.mjs} +3 -3
  11. package/dist/{check-expressions-BRuSxJ5d-CC5OFfR1.mjs.map → check-expressions-Dlt334zg-CV5Vkh3G.mjs.map} +1 -1
  12. package/dist/{codec-registry-CyhMngN6-BlKEiEni.mjs → codec-registry-nSGjxm-H-BeUu5zV2.mjs} +4 -4
  13. package/dist/{codec-registry-CyhMngN6-BlKEiEni.mjs.map → codec-registry-nSGjxm-H-BeUu5zV2.mjs.map} +1 -1
  14. package/dist/{codecs-hSJgX8qY-fZSDQFIE.mjs → codecs-DelwJv6h-CFbyTJIJ.mjs} +3 -3
  15. package/dist/{codecs-hSJgX8qY-fZSDQFIE.mjs.map → codecs-DelwJv6h-CFbyTJIJ.mjs.map} +1 -1
  16. package/dist/{contract-free-DlLLhKi4.d.mts → contract-free-DY8vDIxh.d.mts} +19 -2
  17. package/dist/contract-free-DY8vDIxh.d.mts.map +1 -0
  18. package/dist/{contract-free-DAGgx1J-.mjs → contract-free-DaK6wmmo.mjs} +3 -3
  19. package/dist/contract-free-DaK6wmmo.mjs.map +1 -0
  20. package/dist/{control-BVAy0J9w.mjs → control-YKrabf1Q.mjs} +11 -11
  21. package/dist/{control-BVAy0J9w.mjs.map → control-YKrabf1Q.mjs.map} +1 -1
  22. package/dist/{control-adapter-Co30P4lH-B8vk7fsI.mjs → control-adapter-Co30P4lH-B5euUoQ4.mjs} +6 -6
  23. package/dist/{control-adapter-Co30P4lH-B8vk7fsI.mjs.map → control-adapter-Co30P4lH-B5euUoQ4.mjs.map} +1 -1
  24. package/dist/{control-policy-C16wMazs-O_wlPuFC.mjs → control-policy-bwcdB78Y-DgRaWAzu.mjs} +16 -22
  25. package/dist/control-policy-bwcdB78Y-DgRaWAzu.mjs.map +1 -0
  26. package/dist/{data-type-entries-C2zpNOAQ-BJh8QNDa.mjs → data-type-entries-DgKLUrqt-TKDikzti.mjs} +3 -3
  27. package/dist/{data-type-entries-C2zpNOAQ-BJh8QNDa.mjs.map → data-type-entries-DgKLUrqt-TKDikzti.mjs.map} +1 -1
  28. package/dist/{data-types-BRBW3ouc-ZtyZE7nE.mjs → data-types-k3Ebk3kj-DWk3nh_k.mjs} +3 -3
  29. package/dist/{data-types-BRBW3ouc-ZtyZE7nE.mjs.map → data-types-k3Ebk3kj-DWk3nh_k.mjs.map} +1 -1
  30. package/dist/{ddl-BzsT_-qY-Cdzm0YIK.mjs → ddl-C_vTj7b5-vyGLBKLo.mjs} +50 -5
  31. package/dist/ddl-C_vTj7b5-vyGLBKLo.mjs.map +1 -0
  32. package/dist/default-constraint-names-CtcRXhV8-nz3ff6b8.mjs +18 -0
  33. package/dist/default-constraint-names-CtcRXhV8-nz3ff6b8.mjs.map +1 -0
  34. package/dist/{descriptor-meta-ARufwwWW-DUiQQsOX.mjs → descriptor-meta-ARufwwWW-DMQsPNAl.mjs} +3 -3
  35. package/dist/{descriptor-meta-ARufwwWW-DUiQQsOX.mjs.map → descriptor-meta-ARufwwWW-DMQsPNAl.mjs.map} +1 -1
  36. package/dist/{descriptor-meta-Dp8tWKKU-5RiFTCA_.mjs → descriptor-meta-BgOMP4hF-CfUJsgjc.mjs} +8 -8
  37. package/dist/{descriptor-meta-Dp8tWKKU-5RiFTCA_.mjs.map → descriptor-meta-BgOMP4hF-CfUJsgjc.mjs.map} +1 -1
  38. package/dist/{descriptor-meta-runtime-BycwK4wx-CuDo_Atu.mjs → descriptor-meta-runtime-CG2S236D-CUkzqeCr.mjs} +3 -3
  39. package/dist/{descriptor-meta-runtime-BycwK4wx-CuDo_Atu.mjs.map → descriptor-meta-runtime-CG2S236D-CUkzqeCr.mjs.map} +1 -1
  40. package/dist/{diff-database-schema-DRPIV4Ae-BSY-cBm0.mjs → diff-database-schema-zc7d2uxC-BVe8D7vG.mjs} +5 -5
  41. package/dist/{diff-database-schema-DRPIV4Ae-BSY-cBm0.mjs.map → diff-database-schema-zc7d2uxC-BVe8D7vG.mjs.map} +1 -1
  42. package/dist/{full-text-index-expression-2O1p7zJA--CcXJUdq.mjs → full-text-index-expression-BpUM2Td6-2Q7y7DnO.mjs} +4 -4
  43. package/dist/{full-text-index-expression-2O1p7zJA--CcXJUdq.mjs.map → full-text-index-expression-BpUM2Td6-2Q7y7DnO.mjs.map} +1 -1
  44. package/dist/{infer-psl-contract-shHWsRbe-C65aVFOB.mjs → infer-psl-contract-B5yExD61-Cmye68li.mjs} +6 -6
  45. package/dist/{infer-psl-contract-shHWsRbe-C65aVFOB.mjs.map → infer-psl-contract-B5yExD61-Cmye68li.mjs.map} +1 -1
  46. package/dist/migration-PTHAY9Cv.mjs.map +1 -1
  47. package/dist/{op-factory-call-B-4nf1jC-DkRw5e1q.mjs → op-factory-call-DdXVWQlV-DzfLhTkh.mjs} +70 -18
  48. package/dist/op-factory-call-DdXVWQlV-DzfLhTkh.mjs.map +1 -0
  49. package/dist/{planner-B5wkfdZ_-bckhSgt5.mjs → planner-ZmK0aNuY-Cak-8zwa.mjs} +16 -12
  50. package/dist/planner-ZmK0aNuY-Cak-8zwa.mjs.map +1 -0
  51. package/dist/{planner-ddl-builders-ClaAKDuZ-DpDBj2cs.mjs → planner-ddl-builders-DRProi99-D0K5ZiD0.mjs} +44 -14
  52. package/dist/planner-ddl-builders-DRProi99-D0K5ZiD0.mjs.map +1 -0
  53. package/dist/{planner-identity-values-BZpK0CdX-BJo672Ml.mjs → planner-identity-values-C1eV916m-D0p3EfYc.mjs} +3 -3
  54. package/dist/{planner-identity-values-BZpK0CdX-BJo672Ml.mjs.map → planner-identity-values-C1eV916m-D0p3EfYc.mjs.map} +1 -1
  55. package/dist/{planner-produced-postgres-migration-B3dM0fTf-XkTUm5wR.mjs → planner-produced-postgres-migration-BAWQ6iqr-C06XurYw.mjs} +3 -3
  56. package/dist/{planner-produced-postgres-migration-B3dM0fTf-XkTUm5wR.mjs.map → planner-produced-postgres-migration-BAWQ6iqr-C06XurYw.mjs.map} +1 -1
  57. package/dist/{planner-sql-checks-Bhp0Iq_X-DwwIxJHj.mjs → planner-sql-checks-rqOH8naU-B6xOE5lC.mjs} +4 -4
  58. package/dist/{planner-sql-checks-Bhp0Iq_X-DwwIxJHj.mjs.map → planner-sql-checks-rqOH8naU-B6xOE5lC.mjs.map} +1 -1
  59. package/dist/{postgres-contract-view-rT0ZLNqw-DThfALEV.mjs → postgres-contract-view-B0KloSYp-Cbbl_pIv.mjs} +6 -6
  60. package/dist/{postgres-contract-view-rT0ZLNqw-DThfALEV.mjs.map → postgres-contract-view-B0KloSYp-Cbbl_pIv.mjs.map} +1 -1
  61. package/dist/{postgres-migration-CmD95Eh_-DGLByWZD.mjs → postgres-migration-UVh2xeV0-DW8V_8aj.mjs} +84 -58
  62. package/dist/postgres-migration-UVh2xeV0-DW8V_8aj.mjs.map +1 -0
  63. package/dist/postgres-object-name-FPikIvOw-BNs44hTu.mjs +23 -0
  64. package/dist/postgres-object-name-FPikIvOw-BNs44hTu.mjs.map +1 -0
  65. package/dist/{postgres-schema-DXd0mebY-CExd_GcQ.mjs → postgres-schema-AlEVkXXS-ZfXWYddl.mjs} +3 -3
  66. package/dist/{postgres-schema-DXd0mebY-CExd_GcQ.mjs.map → postgres-schema-AlEVkXXS-ZfXWYddl.mjs.map} +1 -1
  67. package/dist/{prisma7-binding-DNckHEx8.d.mts → prisma7-binding-FvF1AZxQ.d.mts} +11 -1
  68. package/dist/prisma7-binding-FvF1AZxQ.d.mts.map +1 -0
  69. package/dist/{prisma7-binding-CArLf1qk.mjs → prisma7-binding-GebhdAGS.mjs} +11 -6
  70. package/dist/prisma7-binding-GebhdAGS.mjs.map +1 -0
  71. package/dist/{resolve-ddl-schema-CadTChyu-C7F31wpN.mjs → resolve-ddl-schema-BthOWVjF-DuZ9iUh-.mjs} +3 -3
  72. package/dist/{resolve-ddl-schema-CadTChyu-C7F31wpN.mjs.map → resolve-ddl-schema-BthOWVjF-DuZ9iUh-.mjs.map} +1 -1
  73. package/dist/{sql-renderer-DT4IEOVi-G0Q8NmyB.mjs → sql-renderer-DT4IEOVi-CE0YIu9V.mjs} +3 -3
  74. package/dist/{sql-renderer-DT4IEOVi-G0Q8NmyB.mjs.map → sql-renderer-DT4IEOVi-CE0YIu9V.mjs.map} +1 -1
  75. package/dist/{sql-utils-BMXJi06b-CAQOplfq.mjs → sql-utils-CVsvXiX4-C7xD0Bgv.mjs} +5 -9
  76. package/dist/sql-utils-CVsvXiX4-C7xD0Bgv.mjs.map +1 -0
  77. package/dist/target.d.mts +3 -3
  78. package/dist/target.mjs +25 -25
  79. package/dist/target__codecs.mjs +2 -2
  80. package/dist/target__contract-free.d.mts +2 -2
  81. package/dist/target__contract-free.mjs +4 -4
  82. package/dist/target__control.mjs +3 -3
  83. package/dist/target__data-types.mjs +2 -2
  84. package/dist/target__diff-database-schema.mjs +1 -1
  85. package/dist/target__issue-planner.mjs +1 -1
  86. package/dist/target__migration.mjs +2 -2
  87. package/dist/target__op-factory-call.mjs +1 -1
  88. package/dist/target__pack.mjs +1 -1
  89. package/dist/target__planner-ddl-builders.mjs +1 -1
  90. package/dist/target__planner-identity-values.mjs +1 -1
  91. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  92. package/dist/target__planner-sql-checks.mjs +1 -1
  93. package/dist/target__planner.mjs +2 -2
  94. package/dist/target__prisma7-binding.d.mts +1 -1
  95. package/dist/target__prisma7-binding.mjs +1 -1
  96. package/dist/target__runtime.mjs +3 -3
  97. package/dist/target__runtime.mjs.map +1 -1
  98. package/dist/target__schema-ir-annotations.mjs +1 -1
  99. package/dist/target__sql-utils.mjs +2 -2
  100. package/dist/target__types.mjs +2 -2
  101. package/package.json +9 -9
  102. package/dist/contract-free-DAGgx1J-.mjs.map +0 -1
  103. package/dist/contract-free-DlLLhKi4.d.mts.map +0 -1
  104. package/dist/control-policy-C16wMazs-O_wlPuFC.mjs.map +0 -1
  105. package/dist/ddl-BzsT_-qY-Cdzm0YIK.mjs.map +0 -1
  106. package/dist/op-factory-call-B-4nf1jC-DkRw5e1q.mjs.map +0 -1
  107. package/dist/planner-B5wkfdZ_-bckhSgt5.mjs.map +0 -1
  108. package/dist/planner-ddl-builders-ClaAKDuZ-DpDBj2cs.mjs.map +0 -1
  109. package/dist/postgres-migration-CmD95Eh_-DGLByWZD.mjs.map +0 -1
  110. package/dist/prisma7-binding-CArLf1qk.mjs.map +0 -1
  111. package/dist/prisma7-binding-DNckHEx8.d.mts.map +0 -1
  112. package/dist/sql-utils-BMXJi06b-CAQOplfq.mjs.map +0 -1
@@ -1,7 +1,40 @@
1
- import { t as escapeLiteral } from "./sql-utils-BMXJi06b-CAQOplfq.mjs";
2
- import { A as pgTimestamptz, E as pgTime, M as pgTimetz, O as pgTimestamp, _ as pgInt8, b as pgJsonb, c as pgDate, g as pgInt4, h as pgInt2, v as pgInterval, y as pgJson } from "./data-types-BRBW3ouc-ZtyZE7nE.mjs";
1
+ import { t as escapeLiteral } from "./sql-utils-CVsvXiX4-C7xD0Bgv.mjs";
2
+ import { A as pgTimestamptz, E as pgTime, M as pgTimetz, O as pgTimestamp, _ as pgInt8, b as pgJsonb, c as pgDate, g as pgInt4, h as pgInt2, v as pgInterval, y as pgJson } from "./data-types-k3Ebk3kj-DWk3nh_k.mjs";
3
3
  import { dataTypeParams, renderSqlTypeName, sqlDataTypeOfCodec } from "@prisma/orm-family-sql/contract/data-type";
4
- //#region ../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-ClaAKDuZ.mjs
4
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-DRProi99.mjs
5
+ const SMALL = {
6
+ serialType: "SMALLSERIAL",
7
+ sequenceType: "smallint"
8
+ };
9
+ const REGULAR = {
10
+ serialType: "SERIAL",
11
+ sequenceType: "integer"
12
+ };
13
+ const BIG = {
14
+ serialType: "BIGSERIAL",
15
+ sequenceType: "bigint"
16
+ };
17
+ const WIDTH_BY_COLUMN_TYPE = /* @__PURE__ */ new Map([
18
+ ["int2", SMALL],
19
+ ["smallint", SMALL],
20
+ ["int4", REGULAR],
21
+ ["integer", REGULAR],
22
+ ["int8", BIG],
23
+ ["bigint", BIG]
24
+ ]);
25
+ /** The autoincrement width of a column of `columnType`; `undefined` for a column that is not a scalar smallint, integer or bigint. */
26
+ function autoincrementWidth(columnType) {
27
+ return WIDTH_BY_COLUMN_TYPE.get(columnType.toLowerCase());
28
+ }
29
+ const WIDTH_BY_DATA_TYPE = /* @__PURE__ */ new Map([
30
+ [pgInt2.id, SMALL],
31
+ [pgInt4.id, REGULAR],
32
+ [pgInt8.id, BIG]
33
+ ]);
34
+ /** The autoincrement width of a column whose data type is `dataTypeId`; `undefined` unless it is `pg/int2`, `pg/int4` or `pg/int8`. */
35
+ function autoincrementWidthOfDataType(dataTypeId) {
36
+ return WIDTH_BY_DATA_TYPE.get(dataTypeId);
37
+ }
5
38
  const DATE_TIME_TYPES = /* @__PURE__ */ new Set([
6
39
  pgDate.id,
7
40
  pgTime.id,
@@ -36,11 +69,6 @@ function postgresDateTimeDdlText(canonical, dataTypeId) {
36
69
  if (year > 9999) return `${year}${rest}`;
37
70
  return `${String(1 - year).padStart(4, "0")}${rest} BC`;
38
71
  }
39
- const SERIAL_TYPES = /* @__PURE__ */ new Map([
40
- [pgInt4.id, "SERIAL"],
41
- [pgInt8.id, "BIGSERIAL"],
42
- [pgInt2.id, "SMALLSERIAL"]
43
- ]);
44
72
  const JSON_DATA_TYPES = /* @__PURE__ */ new Set([pgJson.id, pgJsonb.id]);
45
73
  /**
46
74
  * Renders the SQL type for a column in DDL context: the name its codec's data type is written
@@ -53,14 +81,16 @@ const JSON_DATA_TYPES = /* @__PURE__ */ new Set([pgJson.id, pgJsonb.id]);
53
81
  function buildColumnTypeSql(column, types, storageTypes = {}, allowPseudoTypes = true) {
54
82
  const resolved = (column.typeRef === void 0 ? void 0 : storageTypes[column.typeRef]) ?? column;
55
83
  const dataType = sqlDataTypeOfCodec(resolved.codecId, types);
56
- if (allowPseudoTypes) {
57
- const columnDefault = column.default;
58
- const serial = SERIAL_TYPES.get(dataType.id);
59
- if (serial !== void 0 && columnDefault?.kind === "function" && columnDefault.expression === "autoincrement()") return serial;
84
+ if (allowPseudoTypes && isAutoincrement(column.default)) {
85
+ const width = autoincrementWidthOfDataType(dataType.id);
86
+ if (width !== void 0) return width.serialType;
60
87
  }
61
88
  const typeSql = renderSqlTypeName(dataType, dataTypeParams(dataType, resolved.typeParams));
62
89
  return column.many ? `${typeSql}[]` : typeSql;
63
90
  }
91
+ function isAutoincrement(columnDefault) {
92
+ return columnDefault?.kind === "function" && columnDefault.expression === "autoincrement()";
93
+ }
64
94
  function renderDefaultLiteral(value, column) {
65
95
  if (column?.many && Array.isArray(value)) return renderArrayLiteralDefault(value, column.baseTypeName, column.dataType);
66
96
  if (column !== void 0 && JSON_DATA_TYPES.has(column.dataType) && typeof value === "object" && value !== null && !(value instanceof Date)) return `'${escapeLiteral(JSON.stringify(value))}'::${column.baseTypeName}`;
@@ -88,6 +118,6 @@ function renderArrayLiteralDefault(elements, baseTypeName, dataType) {
88
118
  return `${rendered}::${baseTypeName.endsWith("[]") ? baseTypeName : `${baseTypeName}[]`}`;
89
119
  }
90
120
  //#endregion
91
- export { renderDefaultLiteral as i, isPostgresDateTimeDataType as n, postgresDateTimeDdlText as r, buildColumnTypeSql as t };
121
+ export { renderDefaultLiteral as a, postgresDateTimeDdlText as i, buildColumnTypeSql as n, isPostgresDateTimeDataType as r, autoincrementWidth as t };
92
122
 
93
- //# sourceMappingURL=planner-ddl-builders-ClaAKDuZ-DpDBj2cs.mjs.map
123
+ //# sourceMappingURL=planner-ddl-builders-DRProi99-D0K5ZiD0.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planner-ddl-builders-DRProi99-D0K5ZiD0.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-DRProi99.mjs"],"sourcesContent":["import { t as escapeLiteral } from \"./sql-utils-CVsvXiX4.mjs\";\nimport { A as pgTimestamptz, E as pgTime, M as pgTimetz, O as pgTimestamp, _ as pgInt8, b as pgJsonb, c as pgDate, g as pgInt4, h as pgInt2, v as pgInterval, y as pgJson } from \"./data-types-k3Ebk3kj.mjs\";\nimport { dataTypeParams, renderSqlTypeName, sqlDataTypeOfCodec } from \"@internal/sql-contract/data-type\";\n//#region src/core/migrations/autoincrement-widths.ts\nconst SMALL = {\n\tserialType: \"SMALLSERIAL\",\n\tsequenceType: \"smallint\"\n};\nconst REGULAR = {\n\tserialType: \"SERIAL\",\n\tsequenceType: \"integer\"\n};\nconst BIG = {\n\tserialType: \"BIGSERIAL\",\n\tsequenceType: \"bigint\"\n};\nconst WIDTH_BY_COLUMN_TYPE = /* @__PURE__ */ new Map([\n\t[\"int2\", SMALL],\n\t[\"smallint\", SMALL],\n\t[\"int4\", REGULAR],\n\t[\"integer\", REGULAR],\n\t[\"int8\", BIG],\n\t[\"bigint\", BIG]\n]);\n/** The autoincrement width of a column of `columnType`; `undefined` for a column that is not a scalar smallint, integer or bigint. */\nfunction autoincrementWidth(columnType) {\n\treturn WIDTH_BY_COLUMN_TYPE.get(columnType.toLowerCase());\n}\nconst WIDTH_BY_DATA_TYPE = /* @__PURE__ */ new Map([\n\t[pgInt2.id, SMALL],\n\t[pgInt4.id, REGULAR],\n\t[pgInt8.id, BIG]\n]);\n/** The autoincrement width of a column whose data type is `dataTypeId`; `undefined` unless it is `pg/int2`, `pg/int4` or `pg/int8`. */\nfunction autoincrementWidthOfDataType(dataTypeId) {\n\treturn WIDTH_BY_DATA_TYPE.get(dataTypeId);\n}\n//#endregion\n//#region src/core/date-time-ddl-text.ts\nconst DATE_TIME_TYPES = /* @__PURE__ */ new Set([\n\tpgDate.id,\n\tpgTime.id,\n\tpgTimetz.id,\n\tpgTimestamp.id,\n\tpgTimestamptz.id,\n\tpgInterval.id\n]);\nconst TYPES_WITH_A_YEAR = /* @__PURE__ */ new Set([\n\tpgDate.id,\n\tpgTimestamp.id,\n\tpgTimestamptz.id\n]);\n/** Whether a data type is one of this target's date and time types, whose defaults DDL writes as text. */\nfunction isPostgresDateTimeDataType(dataTypeId) {\n\treturn dataTypeId !== void 0 && DATE_TIME_TYPES.has(dataTypeId);\n}\n/**\n* The text DDL writes for a default of a date or time type, from its canonical form (ADR 254). A\n* year from 1 to 9999 stays as it is. PostgreSQL has no year 0 and reads no signed year, so a later\n* year loses its sign and leading zeros (`10000-01-01`) and a year at or before 0 is written as the\n* year before Christ (`0044-03-15 BC`). Every Postgres DDL path writes a date or time default\n* through this function.\n*/\nfunction postgresDateTimeDdlText(canonical, dataTypeId) {\n\tif (dataTypeId === void 0 || !TYPES_WITH_A_YEAR.has(dataTypeId)) return canonical;\n\tconst match = /^([+-]\\d{6}|\\d{4})(-.*)$/.exec(canonical);\n\tif (match === null) return canonical;\n\tconst [, yearDigits = \"\", rest = \"\"] = match;\n\tconst year = Number(yearDigits);\n\tif (year >= 1 && year <= 9999) return canonical;\n\tif (year > 9999) return `${year}${rest}`;\n\treturn `${String(1 - year).padStart(4, \"0\")}${rest} BC`;\n}\n//#endregion\n//#region src/core/migrations/planner-ddl-builders.ts\nconst JSON_DATA_TYPES = /* @__PURE__ */ new Set([pgJson.id, pgJsonb.id]);\n/**\n* Renders the SQL type for a column in DDL context: the name its codec's data type is written\n* with, and its parameters. A `typeRef` column is written as a column of the referenced type.\n*\n* @param allowPseudoTypes - When true (default), autoincrement integer columns\n* produce SERIAL/BIGSERIAL/SMALLSERIAL pseudo-types. Set to false for contexts\n* like ALTER COLUMN TYPE where pseudo-types are invalid.\n*/\nfunction buildColumnTypeSql(column, types, storageTypes = {}, allowPseudoTypes = true) {\n\tconst resolved = (column.typeRef === void 0 ? void 0 : storageTypes[column.typeRef]) ?? column;\n\tconst dataType = sqlDataTypeOfCodec(resolved.codecId, types);\n\tif (allowPseudoTypes && isAutoincrement(column.default)) {\n\t\tconst width = autoincrementWidthOfDataType(dataType.id);\n\t\tif (width !== void 0) return width.serialType;\n\t}\n\tconst typeSql = renderSqlTypeName(dataType, dataTypeParams(dataType, resolved.typeParams));\n\treturn column.many ? `${typeSql}[]` : typeSql;\n}\nfunction isAutoincrement(columnDefault) {\n\treturn columnDefault?.kind === \"function\" && columnDefault.expression === \"autoincrement()\";\n}\nfunction renderDefaultLiteral(value, column) {\n\tif (column?.many && Array.isArray(value)) return renderArrayLiteralDefault(value, column.baseTypeName, column.dataType);\n\tif (column !== void 0 && JSON_DATA_TYPES.has(column.dataType) && typeof value === \"object\" && value !== null && !(value instanceof Date)) return `'${escapeLiteral(JSON.stringify(value))}'::${column.baseTypeName}`;\n\treturn renderScalarLiteral(value, column?.dataType);\n}\n/** A date or time value is written through the one function every DDL path uses for it. */\nfunction renderScalarLiteral(value, dataType) {\n\tif (value instanceof Date) return `'${escapeLiteral(value.toISOString())}'`;\n\tif (typeof value === \"string\") return `'${escapeLiteral(postgresDateTimeDdlText(value, dataType))}'`;\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n\tif (value === null) return \"NULL\";\n\treturn `'${escapeLiteral(JSON.stringify(value))}'`;\n}\n/**\n* An `ARRAY[...]` of quoted elements has type `text[]`, which Postgres does not assign to a list of\n* numbers, decimals, timestamps or enums, so the constructor is cast to the list type. Each element\n* is the text Postgres reads for its type: an `int8` or `numeric` value as decimal text, a date or\n* time value in its type's canonical form. The cast is `baseTypeName` with `[]` appended unless it\n* already ends in `[]`; the name is not quoted here.\n*/\nfunction renderArrayLiteralDefault(elements, baseTypeName, dataType) {\n\tif (elements.length === 0) return \"'{}'\";\n\tconst rendered = `ARRAY[${elements.map((el) => renderScalarLiteral(el, dataType)).join(\", \")}]`;\n\tif (baseTypeName === \"\") return rendered;\n\treturn `${rendered}::${baseTypeName.endsWith(\"[]\") ? baseTypeName : `${baseTypeName}[]`}`;\n}\n//#endregion\nexport { autoincrementWidth as a, postgresDateTimeDdlText as i, renderDefaultLiteral as n, isPostgresDateTimeDataType as r, buildColumnTypeSql as t };\n\n//# sourceMappingURL=planner-ddl-builders-DRProi99.mjs.map"],"mappings":";;;;AAIA,MAAM,QAAQ;CACb,YAAY;CACZ,cAAc;AACf;AACA,MAAM,UAAU;CACf,YAAY;CACZ,cAAc;AACf;AACA,MAAM,MAAM;CACX,YAAY;CACZ,cAAc;AACf;AACA,MAAM,uCAAuC,IAAI,IAAI;CACpD,CAAC,QAAQ,KAAK;CACd,CAAC,YAAY,KAAK;CAClB,CAAC,QAAQ,OAAO;CAChB,CAAC,WAAW,OAAO;CACnB,CAAC,QAAQ,GAAG;CACZ,CAAC,UAAU,GAAG;AACf,CAAC;;AAED,SAAS,mBAAmB,YAAY;CACvC,OAAO,qBAAqB,IAAI,WAAW,YAAY,CAAC;AACzD;AACA,MAAM,qCAAqC,IAAI,IAAI;CAClD,CAAC,OAAO,IAAI,KAAK;CACjB,CAAC,OAAO,IAAI,OAAO;CACnB,CAAC,OAAO,IAAI,GAAG;AAChB,CAAC;;AAED,SAAS,6BAA6B,YAAY;CACjD,OAAO,mBAAmB,IAAI,UAAU;AACzC;AAGA,MA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OAAO,eAAe,SAAS,cAAc,cAAc,eAAe;AAC3E;AACA,SAAS,qBAAqB,OAAO,QAAQ;CAC5C,IAAI,QAAQ,QAAQ,MAAM,QAAQ,KAAK,GAAG,OAAO,0BAA0B,OAAO,OAAO,cAAc,OAAO,QAAQ;CACtH,IAAI,WAAW,KAAK,KAAK,gBAAgB,IAAI,OAAO,QAAQ,KAAK,OAAO,UAAU,YAAY,UAAU,QAAQ,EAAE,iBAAiB,OAAO,OAAO,IAAI,cAAc,KAAK,UAAU,KAAK,CAAC,EAAE,KAAK,OAAO;CACtM,OAAO,oBAAoB,OAAO,QAAQ,QAAQ;AACnD;;AAEA,SAAS,oBAAoB,OAAO,UAAU;CAC7C,IAAI,iBAAiB,MAAM,OAAO,IAAI,cAAc,MAAM,YAAY,CAAC,EAAE;CACzE,IAAI,OAAO,UAAU,UAAU,OAAO,IAAI,cAAc,wBAAwB,OAAO,QAAQ,CAAC,EAAE;CAClG,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW,OAAO,OAAO,KAAK;CAChF,IAAI,UAAU,MAAM,OAAO;CAC3B,OAAO,IAAI,cAAc,KAAK,UAAU,KAAK,CAAC,EAAE;AACjD;;;;;;;;AAQA,SAAS,0BAA0B,UAAU,cAAc,UAAU;CACpE,IAAI,SAAS,WAAW,GAAG,OAAO;CAClC,MAAM,WAAW,SAAS,SAAS,KAAK,OAAO,oBAAoB,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;CAC7F,IAAI,iBAAiB,IAAI,OAAO;CAChC,OAAO,GAAG,SAAS,IAAI,aAAa,SAAS,IAAI,IAAI,eAAe,GAAG,aAAa;AACrF"}
@@ -1,7 +1,7 @@
1
- import { A as pgTimestamptz, E as pgTime, F as pgUuid, I as pgVarbit, L as pgVarchar, M as pgTimetz, O as pgTimestamp, T as pgTextArray, _ as pgInt8, a as pgBytea, b as pgJsonb, c as pgDate, f as pgFloat4, g as pgInt4, h as pgInt2, i as pgBool, n as pgBit, o as pgChar, p as pgFloat8, v as pgInterval, w as pgText, x as pgNumeric, y as pgJson } from "./data-types-BRBW3ouc-ZtyZE7nE.mjs";
1
+ import { A as pgTimestamptz, E as pgTime, F as pgUuid, I as pgVarbit, L as pgVarchar, M as pgTimetz, O as pgTimestamp, T as pgTextArray, _ as pgInt8, a as pgBytea, b as pgJsonb, c as pgDate, f as pgFloat4, g as pgInt4, h as pgInt2, i as pgBool, n as pgBit, o as pgChar, p as pgFloat8, v as pgInterval, w as pgText, x as pgNumeric, y as pgJson } from "./data-types-k3Ebk3kj-DWk3nh_k.mjs";
2
2
  import { sqlDataTypeOfCodec } from "@prisma/orm-family-sql/contract/data-type";
3
3
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
4
- //#region ../../../3-targets/3-targets/postgres/dist/planner-identity-values-BZpK0CdX.mjs
4
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-identity-values-C1eV916m.mjs
5
5
  /**
6
6
  * Resolves the identity value (monoid neutral element) as a SQL literal for a column's type.
7
7
  * Checks codec hooks first (extensions can provide type-specific identity values),
@@ -69,4 +69,4 @@ function buildBitIdentityValue(typeParams) {
69
69
  //#endregion
70
70
  export { resolveIdentityValue as n, buildBuiltinIdentityValue as t };
71
71
 
72
- //# sourceMappingURL=planner-identity-values-BZpK0CdX-BJo672Ml.mjs.map
72
+ //# sourceMappingURL=planner-identity-values-C1eV916m-D0p3EfYc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-identity-values-BZpK0CdX-BJo672Ml.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-identity-values-BZpK0CdX.mjs"],"sourcesContent":["import { A as pgTimestamptz, E as pgTime, F as pgUuid, I as pgVarbit, L as pgVarchar, M as pgTimetz, O as pgTimestamp, T as pgTextArray, _ as pgInt8, a as pgBytea, b as pgJsonb, c as pgDate, f as pgFloat4, g as pgInt4, h as pgInt2, i as pgBool, n as pgBit, o as pgChar, p as pgFloat8, v as pgInterval, w as pgText, x as pgNumeric, y as pgJson } from \"./data-types-BRBW3ouc.mjs\";\nimport { sqlDataTypeOfCodec } from \"@internal/sql-contract/data-type\";\nimport { ifDefined } from \"@internal/utils/defined\";\n//#region src/core/migrations/planner-identity-values.ts\n/**\n* Resolves the identity value (monoid neutral element) as a SQL literal for a column's type.\n* Checks codec hooks first (extensions can provide type-specific identity values),\n* then falls back to the built-in map, keyed by the data type the column's codec represents.\n*/\nfunction resolveIdentityValue(column, codecHooks, types, storageTypes = {}) {\n\tconst referencedType = column.typeRef ? storageTypes[column.typeRef] : void 0;\n\tconst codecId = referencedType?.codecId ?? column.codecId;\n\tconst typeParams = referencedType?.typeParams ?? column.typeParams;\n\tif (column.many) return \"'{}'\";\n\tconst dataType = sqlDataTypeOfCodec(codecId, types).id;\n\tconst hookDefault = codecHooks.get(codecId)?.resolveIdentityValue?.({\n\t\tdataType,\n\t\tcodecId,\n\t\t...ifDefined(\"typeParams\", typeParams)\n\t});\n\tif (hookDefault !== void 0) return hookDefault;\n\treturn buildBuiltinIdentityValue(dataType, typeParams);\n}\nconst IDENTITY_VALUES = /* @__PURE__ */ new Map([\n\t[pgText.id, \"''\"],\n\t[pgChar.id, \"''\"],\n\t[pgVarchar.id, \"''\"],\n\t[pgInt2.id, \"0\"],\n\t[pgInt4.id, \"0\"],\n\t[pgInt8.id, \"0\"],\n\t[pgFloat4.id, \"0\"],\n\t[pgFloat8.id, \"0\"],\n\t[pgNumeric.id, \"0\"],\n\t[pgBool.id, \"false\"],\n\t[pgUuid.id, \"'00000000-0000-0000-0000-000000000000'\"],\n\t[pgJson.id, \"'{}'::json\"],\n\t[pgJsonb.id, \"'{}'::jsonb\"],\n\t[pgDate.id, \"'epoch'\"],\n\t[pgTimestamp.id, \"'epoch'\"],\n\t[pgTimestamptz.id, \"'epoch'\"],\n\t[pgTime.id, \"'00:00:00'\"],\n\t[pgTimetz.id, \"'00:00:00+00'\"],\n\t[pgInterval.id, \"'0'\"],\n\t[pgBytea.id, \"''::bytea\"],\n\t[pgVarbit.id, \"B''\"],\n\t[pgTextArray.id, \"'{}'\"]\n]);\n/**\n* Returns the built-in identity value (monoid neutral element) as a SQL literal for the given\n* data type — e.g. 0 for integers, '' for text, false for booleans.\n*\n* This is the planner's fallback when no codec hook provides a type-specific identity value.\n*\n* Returns null for other types (for example enums and extension-owned types without a\n* hook), which causes the planner to fall back to the empty-table precheck.\n*\n* @internal Exported for testing only.\n*/\nfunction buildBuiltinIdentityValue(dataType, typeParams) {\n\tif (dataType === pgBit.id) return buildBitIdentityValue(typeParams);\n\treturn IDENTITY_VALUES.get(dataType) ?? null;\n}\nfunction buildBitIdentityValue(typeParams) {\n\tconst length = typeParams?.[\"length\"];\n\tif (length === void 0) return \"B'0'\";\n\tif (typeof length !== \"number\" || !Number.isInteger(length) || length <= 0) return null;\n\treturn `B'${\"0\".repeat(length)}'`;\n}\n//#endregion\nexport { resolveIdentityValue as n, buildBuiltinIdentityValue as t };\n\n//# sourceMappingURL=planner-identity-values-BZpK0CdX.mjs.map"],"mappings":";;;;;;;;;AASA,SAAS,qBAAqB,QAAQ,YAAY,OAAO,eAAe,CAAC,GAAG;CAC3E,MAAM,iBAAiB,OAAO,UAAU,aAAa,OAAO,WAAW,KAAK;CAC5E,MAAM,UAAU,gBAAgB,WAAW,OAAO;CAClD,MAAM,aAAa,gBAAgB,cAAc,OAAO;CACxD,IAAI,OAAO,MAAM,OAAO;CACxB,MAAM,WAAW,mBAAmB,SAAS,KAAK,CAAC,CAAC;CACpD,MAAM,cAAc,WAAW,IAAI,OAAO,CAAC,EAAE,uBAAuB;EACnE;EACA;EACA,GAAG,UAAU,cAAc,UAAU;CACtC,CAAC;CACD,IAAI,gBAAgB,KAAK,GAAG,OAAO;CACnC,OAAO,0BAA0B,UAAU,UAAU;AACtD;AACA,MAAM,kCAAkC,IAAI,IAAI;CAC/C,CAAC,OAAO,IAAI,IAAI;CAChB,CAAC,OAAO,IAAI,IAAI;CAChB,CAAC,UAAU,IAAI,IAAI;CACnB,CAAC,OAAO,IAAI,GAAG;CACf,CAAC,OAAO,IAAI,GAAG;CACf,CAAC,OAAO,IAAI,GAAG;CACf,CAAC,SAAS,IAAI,GAAG;CACjB,CAAC,SAAS,IAAI,GAAG;CACjB,CAAC,UAAU,IAAI,GAAG;CAClB,CAAC,OAAO,IAAI,OAAO;CACnB,CAAC,OAAO,IAAI,wCAAwC;CACpD,CAAC,OAAO,IAAI,YAAY;CACxB,CAAC,QAAQ,IAAI,aAAa;CAC1B,CAAC,OAAO,IAAI,SAAS;CACrB,CAAC,YAAY,IAAI,SAAS;CAC1B,CAAC,cAAc,IAAI,SAAS;CAC5B,CAAC,OAAO,IAAI,YAAY;CACxB,CAAC,SAAS,IAAI,eAAe;CAC7B,CAAC,WAAW,IAAI,KAAK;CACrB,CAAC,QAAQ,IAAI,WAAW;CACxB,CAAC,SAAS,IAAI,KAAK;CACnB,CAAC,YAAY,IAAI,MAAM;AACxB,CAAC;;;;;;;;;;;;AAYD,SAAS,0BAA0B,UAAU,YAAY;CACxD,IAAI,aAAa,MAAM,IAAI,OAAO,sBAAsB,UAAU;CAClE,OAAO,gBAAgB,IAAI,QAAQ,KAAK;AACzC;AACA,SAAS,sBAAsB,YAAY;CAC1C,MAAM,SAAS,aAAa;CAC5B,IAAI,WAAW,KAAK,GAAG,OAAO;CAC9B,IAAI,OAAO,WAAW,YAAY,CAAC,OAAO,UAAU,MAAM,KAAK,UAAU,GAAG,OAAO;CACnF,OAAO,KAAK,IAAI,OAAO,MAAM,EAAE;AAChC"}
1
+ {"version":3,"file":"planner-identity-values-C1eV916m-D0p3EfYc.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-identity-values-C1eV916m.mjs"],"sourcesContent":["import { A as pgTimestamptz, E as pgTime, F as pgUuid, I as pgVarbit, L as pgVarchar, M as pgTimetz, O as pgTimestamp, T as pgTextArray, _ as pgInt8, a as pgBytea, b as pgJsonb, c as pgDate, f as pgFloat4, g as pgInt4, h as pgInt2, i as pgBool, n as pgBit, o as pgChar, p as pgFloat8, v as pgInterval, w as pgText, x as pgNumeric, y as pgJson } from \"./data-types-k3Ebk3kj.mjs\";\nimport { sqlDataTypeOfCodec } from \"@internal/sql-contract/data-type\";\nimport { ifDefined } from \"@internal/utils/defined\";\n//#region src/core/migrations/planner-identity-values.ts\n/**\n* Resolves the identity value (monoid neutral element) as a SQL literal for a column's type.\n* Checks codec hooks first (extensions can provide type-specific identity values),\n* then falls back to the built-in map, keyed by the data type the column's codec represents.\n*/\nfunction resolveIdentityValue(column, codecHooks, types, storageTypes = {}) {\n\tconst referencedType = column.typeRef ? storageTypes[column.typeRef] : void 0;\n\tconst codecId = referencedType?.codecId ?? column.codecId;\n\tconst typeParams = referencedType?.typeParams ?? column.typeParams;\n\tif (column.many) return \"'{}'\";\n\tconst dataType = sqlDataTypeOfCodec(codecId, types).id;\n\tconst hookDefault = codecHooks.get(codecId)?.resolveIdentityValue?.({\n\t\tdataType,\n\t\tcodecId,\n\t\t...ifDefined(\"typeParams\", typeParams)\n\t});\n\tif (hookDefault !== void 0) return hookDefault;\n\treturn buildBuiltinIdentityValue(dataType, typeParams);\n}\nconst IDENTITY_VALUES = /* @__PURE__ */ new Map([\n\t[pgText.id, \"''\"],\n\t[pgChar.id, \"''\"],\n\t[pgVarchar.id, \"''\"],\n\t[pgInt2.id, \"0\"],\n\t[pgInt4.id, \"0\"],\n\t[pgInt8.id, \"0\"],\n\t[pgFloat4.id, \"0\"],\n\t[pgFloat8.id, \"0\"],\n\t[pgNumeric.id, \"0\"],\n\t[pgBool.id, \"false\"],\n\t[pgUuid.id, \"'00000000-0000-0000-0000-000000000000'\"],\n\t[pgJson.id, \"'{}'::json\"],\n\t[pgJsonb.id, \"'{}'::jsonb\"],\n\t[pgDate.id, \"'epoch'\"],\n\t[pgTimestamp.id, \"'epoch'\"],\n\t[pgTimestamptz.id, \"'epoch'\"],\n\t[pgTime.id, \"'00:00:00'\"],\n\t[pgTimetz.id, \"'00:00:00+00'\"],\n\t[pgInterval.id, \"'0'\"],\n\t[pgBytea.id, \"''::bytea\"],\n\t[pgVarbit.id, \"B''\"],\n\t[pgTextArray.id, \"'{}'\"]\n]);\n/**\n* Returns the built-in identity value (monoid neutral element) as a SQL literal for the given\n* data type — e.g. 0 for integers, '' for text, false for booleans.\n*\n* This is the planner's fallback when no codec hook provides a type-specific identity value.\n*\n* Returns null for other types (for example enums and extension-owned types without a\n* hook), which causes the planner to fall back to the empty-table precheck.\n*\n* @internal Exported for testing only.\n*/\nfunction buildBuiltinIdentityValue(dataType, typeParams) {\n\tif (dataType === pgBit.id) return buildBitIdentityValue(typeParams);\n\treturn IDENTITY_VALUES.get(dataType) ?? null;\n}\nfunction buildBitIdentityValue(typeParams) {\n\tconst length = typeParams?.[\"length\"];\n\tif (length === void 0) return \"B'0'\";\n\tif (typeof length !== \"number\" || !Number.isInteger(length) || length <= 0) return null;\n\treturn `B'${\"0\".repeat(length)}'`;\n}\n//#endregion\nexport { resolveIdentityValue as n, buildBuiltinIdentityValue as t };\n\n//# sourceMappingURL=planner-identity-values-C1eV916m.mjs.map"],"mappings":";;;;;;;;;AASA,SAAS,qBAAqB,QAAQ,YAAY,OAAO,eAAe,CAAC,GAAG;CAC3E,MAAM,iBAAiB,OAAO,UAAU,aAAa,OAAO,WAAW,KAAK;CAC5E,MAAM,UAAU,gBAAgB,WAAW,OAAO;CAClD,MAAM,aAAa,gBAAgB,cAAc,OAAO;CACxD,IAAI,OAAO,MAAM,OAAO;CACxB,MAAM,WAAW,mBAAmB,SAAS,KAAK,CAAC,CAAC;CACpD,MAAM,cAAc,WAAW,IAAI,OAAO,CAAC,EAAE,uBAAuB;EACnE;EACA;EACA,GAAG,UAAU,cAAc,UAAU;CACtC,CAAC;CACD,IAAI,gBAAgB,KAAK,GAAG,OAAO;CACnC,OAAO,0BAA0B,UAAU,UAAU;AACtD;AACA,MAAM,kCAAkC,IAAI,IAAI;CAC/C,CAAC,OAAO,IAAI,IAAI;CAChB,CAAC,OAAO,IAAI,IAAI;CAChB,CAAC,UAAU,IAAI,IAAI;CACnB,CAAC,OAAO,IAAI,GAAG;CACf,CAAC,OAAO,IAAI,GAAG;CACf,CAAC,OAAO,IAAI,GAAG;CACf,CAAC,SAAS,IAAI,GAAG;CACjB,CAAC,SAAS,IAAI,GAAG;CACjB,CAAC,UAAU,IAAI,GAAG;CAClB,CAAC,OAAO,IAAI,OAAO;CACnB,CAAC,OAAO,IAAI,wCAAwC;CACpD,CAAC,OAAO,IAAI,YAAY;CACxB,CAAC,QAAQ,IAAI,aAAa;CAC1B,CAAC,OAAO,IAAI,SAAS;CACrB,CAAC,YAAY,IAAI,SAAS;CAC1B,CAAC,cAAc,IAAI,SAAS;CAC5B,CAAC,OAAO,IAAI,YAAY;CACxB,CAAC,SAAS,IAAI,eAAe;CAC7B,CAAC,WAAW,IAAI,KAAK;CACrB,CAAC,QAAQ,IAAI,WAAW;CACxB,CAAC,SAAS,IAAI,KAAK;CACnB,CAAC,YAAY,IAAI,MAAM;AACxB,CAAC;;;;;;;;;;;;AAYD,SAAS,0BAA0B,UAAU,YAAY;CACxD,IAAI,aAAa,MAAM,IAAI,OAAO,sBAAsB,UAAU;CAClE,OAAO,gBAAgB,IAAI,QAAQ,KAAK;AACzC;AACA,SAAS,sBAAsB,YAAY;CAC1C,MAAM,SAAS,aAAa;CAC5B,IAAI,WAAW,KAAK,GAAG,OAAO;CAC9B,IAAI,OAAO,WAAW,YAAY,CAAC,OAAO,UAAU,MAAM,KAAK,UAAU,GAAG,OAAO;CACnF,OAAO,KAAK,IAAI,OAAO,MAAM,EAAE;AAChC"}
@@ -1,7 +1,7 @@
1
- import { t as PostgresMigration } from "./postgres-migration-CmD95Eh_-DGLByWZD.mjs";
1
+ import { t as PostgresMigration } from "./postgres-migration-UVh2xeV0-DW8V_8aj.mjs";
2
2
  import { t as renderOps } from "./render-ops-D2vJApKB-B281fzmn.mjs";
3
3
  import { t as renderCallsToTypeScript } from "./render-typescript-Dqp1Spgn-B128r1qw.mjs";
4
- //#region ../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-B3dM0fTf.mjs
4
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-BAWQ6iqr.mjs
5
5
  var TypeScriptRenderablePostgresMigration = class extends PostgresMigration {
6
6
  #calls;
7
7
  #meta;
@@ -44,4 +44,4 @@ var TypeScriptRenderablePostgresMigration = class extends PostgresMigration {
44
44
  //#endregion
45
45
  export { TypeScriptRenderablePostgresMigration as t };
46
46
 
47
- //# sourceMappingURL=planner-produced-postgres-migration-B3dM0fTf-XkTUm5wR.mjs.map
47
+ //# sourceMappingURL=planner-produced-postgres-migration-BAWQ6iqr-C06XurYw.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-produced-postgres-migration-B3dM0fTf-XkTUm5wR.mjs","names":["#calls","#meta","#spaceId","#snapshotsImportPath","#lowerer","#operationsCache"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-B3dM0fTf.mjs"],"sourcesContent":["import { t as PostgresMigration } from \"./postgres-migration-CmD95Eh_.mjs\";\nimport { t as renderOps } from \"./render-ops-D2vJApKB.mjs\";\nimport { t as renderCallsToTypeScript } from \"./render-typescript-Dqp1Spgn.mjs\";\n//#region src/core/migrations/planner-produced-postgres-migration.ts\nvar TypeScriptRenderablePostgresMigration = class extends PostgresMigration {\n\t#calls;\n\t#meta;\n\t#spaceId;\n\t#snapshotsImportPath;\n\t#lowerer;\n\t#operationsCache;\n\tconstructor(calls, meta, spaceId, snapshotsImportPath, lowerer) {\n\t\tsuper();\n\t\tthis.#calls = calls;\n\t\tthis.#meta = meta;\n\t\tthis.#spaceId = spaceId;\n\t\tthis.#snapshotsImportPath = snapshotsImportPath;\n\t\tthis.#lowerer = lowerer;\n\t}\n\tget operations() {\n\t\tthis.#operationsCache ??= renderOps(this.#calls, this.#lowerer);\n\t\treturn this.#operationsCache;\n\t}\n\tdescribe() {\n\t\treturn this.#meta;\n\t}\n\t/**\n\t* Contract space this planner-produced plan applies to. Threaded\n\t* from the planner options so the runner keys the marker row by\n\t* the right space when executing the plan.\n\t*/\n\tget spaceId() {\n\t\treturn this.#spaceId;\n\t}\n\trenderTypeScript(resolveImportSpecifier) {\n\t\treturn renderCallsToTypeScript(this.#calls, {\n\t\t\tfrom: this.#meta.from,\n\t\t\tto: this.#meta.to,\n\t\t\tsnapshotsImportPath: this.#snapshotsImportPath,\n\t\t\tresolveImportSpecifier\n\t\t});\n\t}\n};\n//#endregion\nexport { TypeScriptRenderablePostgresMigration as t };\n\n//# sourceMappingURL=planner-produced-postgres-migration-B3dM0fTf.mjs.map"],"mappings":";;;;AAIA,IAAI,wCAAwC,cAAc,kBAAkB;CAC3E;CACA;CACA;CACA;CACA;CACA;CACA,YAAY,OAAO,MAAM,SAAS,qBAAqB,SAAS;EAC/D,MAAM;EACN,KAAKA,SAAS;EACd,KAAKC,QAAQ;EACb,KAAKC,WAAW;EAChB,KAAKC,uBAAuB;EAC5B,KAAKC,WAAW;CACjB;CACA,IAAI,aAAa;EAChB,KAAKC,qBAAqB,UAAU,KAAKL,QAAQ,KAAKI,QAAQ;EAC9D,OAAO,KAAKC;CACb;CACA,WAAW;EACV,OAAO,KAAKJ;CACb;;;;;;CAMA,IAAI,UAAU;EACb,OAAO,KAAKC;CACb;CACA,iBAAiB,wBAAwB;EACxC,OAAO,wBAAwB,KAAKF,QAAQ;GAC3C,MAAM,KAAKC,MAAM;GACjB,IAAI,KAAKA,MAAM;GACf,qBAAqB,KAAKE;GAC1B;EACD,CAAC;CACF;AACD"}
1
+ {"version":3,"file":"planner-produced-postgres-migration-BAWQ6iqr-C06XurYw.mjs","names":["#calls","#meta","#spaceId","#snapshotsImportPath","#lowerer","#operationsCache"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-BAWQ6iqr.mjs"],"sourcesContent":["import { t as PostgresMigration } from \"./postgres-migration-UVh2xeV0.mjs\";\nimport { t as renderOps } from \"./render-ops-D2vJApKB.mjs\";\nimport { t as renderCallsToTypeScript } from \"./render-typescript-Dqp1Spgn.mjs\";\n//#region src/core/migrations/planner-produced-postgres-migration.ts\nvar TypeScriptRenderablePostgresMigration = class extends PostgresMigration {\n\t#calls;\n\t#meta;\n\t#spaceId;\n\t#snapshotsImportPath;\n\t#lowerer;\n\t#operationsCache;\n\tconstructor(calls, meta, spaceId, snapshotsImportPath, lowerer) {\n\t\tsuper();\n\t\tthis.#calls = calls;\n\t\tthis.#meta = meta;\n\t\tthis.#spaceId = spaceId;\n\t\tthis.#snapshotsImportPath = snapshotsImportPath;\n\t\tthis.#lowerer = lowerer;\n\t}\n\tget operations() {\n\t\tthis.#operationsCache ??= renderOps(this.#calls, this.#lowerer);\n\t\treturn this.#operationsCache;\n\t}\n\tdescribe() {\n\t\treturn this.#meta;\n\t}\n\t/**\n\t* Contract space this planner-produced plan applies to. Threaded\n\t* from the planner options so the runner keys the marker row by\n\t* the right space when executing the plan.\n\t*/\n\tget spaceId() {\n\t\treturn this.#spaceId;\n\t}\n\trenderTypeScript(resolveImportSpecifier) {\n\t\treturn renderCallsToTypeScript(this.#calls, {\n\t\t\tfrom: this.#meta.from,\n\t\t\tto: this.#meta.to,\n\t\t\tsnapshotsImportPath: this.#snapshotsImportPath,\n\t\t\tresolveImportSpecifier\n\t\t});\n\t}\n};\n//#endregion\nexport { TypeScriptRenderablePostgresMigration as t };\n\n//# sourceMappingURL=planner-produced-postgres-migration-BAWQ6iqr.mjs.map"],"mappings":";;;;AAIA,IAAI,wCAAwC,cAAc,kBAAkB;CAC3E;CACA;CACA;CACA;CACA;CACA;CACA,YAAY,OAAO,MAAM,SAAS,qBAAqB,SAAS;EAC/D,MAAM;EACN,KAAKA,SAAS;EACd,KAAKC,QAAQ;EACb,KAAKC,WAAW;EAChB,KAAKC,uBAAuB;EAC5B,KAAKC,WAAW;CACjB;CACA,IAAI,aAAa;EAChB,KAAKC,qBAAqB,UAAU,KAAKL,QAAQ,KAAKI,QAAQ;EAC9D,OAAO,KAAKC;CACb;CACA,WAAW;EACV,OAAO,KAAKJ;CACb;;;;;;CAMA,IAAI,UAAU;EACb,OAAO,KAAKC;CACb;CACA,iBAAiB,wBAAwB;EACxC,OAAO,wBAAwB,KAAKF,QAAQ;GAC3C,MAAM,KAAKC,MAAM;GACjB,IAAI,KAAKA,MAAM;GACf,qBAAqB,KAAKE;GAC1B;EACD,CAAC;CACF;AACD"}
@@ -1,7 +1,7 @@
1
- import { i as quoteIdentifierWhereNeeded } from "./sql-utils-BMXJi06b-CAQOplfq.mjs";
2
- import { h as postgresCreateNamespace } from "./postgres-schema-DXd0mebY-CExd_GcQ.mjs";
1
+ import { i as quoteIdentifierWhereNeeded } from "./sql-utils-CVsvXiX4-C7xD0Bgv.mjs";
2
+ import { h as postgresCreateNamespace } from "./postgres-schema-AlEVkXXS-ZfXWYddl.mjs";
3
3
  import { dataTypeParams, renderSqlCatalogText, sqlDataTypeOfCodec, unquotedSqlBaseName } from "@prisma/orm-family-sql/contract/data-type";
4
- //#region ../../../3-targets/3-targets/postgres/dist/planner-sql-checks-Bhp0Iq_X.mjs
4
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-sql-checks-rqOH8naU.mjs
5
5
  function resolveColumnTypeMetadata(column, storageTypes) {
6
6
  if (!column.typeRef) return column;
7
7
  const referencedType = storageTypes[column.typeRef];
@@ -43,4 +43,4 @@ function buildExpectedFormatType(column, types, storageTypes = {}) {
43
43
  //#endregion
44
44
  export { qualifyTableName as n, buildExpectedFormatType as t };
45
45
 
46
- //# sourceMappingURL=planner-sql-checks-Bhp0Iq_X-DwwIxJHj.mjs.map
46
+ //# sourceMappingURL=planner-sql-checks-rqOH8naU-B6xOE5lC.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-sql-checks-Bhp0Iq_X-DwwIxJHj.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-sql-checks-Bhp0Iq_X.mjs"],"sourcesContent":["import { i as quoteIdentifierWhereNeeded } from \"./sql-utils-BMXJi06b.mjs\";\nimport { i as postgresCreateNamespace } from \"./postgres-schema-DXd0mebY.mjs\";\nimport { dataTypeParams, renderSqlCatalogText, sqlDataTypeOfCodec, unquotedSqlBaseName } from \"@internal/sql-contract/data-type\";\n//#region src/core/migrations/planner-type-resolution.ts\nfunction resolveColumnTypeMetadata(column, storageTypes) {\n\tif (!column.typeRef) return column;\n\tconst referencedType = storageTypes[column.typeRef];\n\tif (!referencedType) return column;\n\treturn {\n\t\tcodecId: referencedType.codecId,\n\t\ttypeParams: referencedType.typeParams\n\t};\n}\n//#endregion\n//#region src/core/migrations/planner-sql-checks.ts\n/**\n* String-keyed entry points the migration ops use to render\n* schema-qualified DDL and catalog checks. The `schema` argument is\n* interpreted as a namespace coordinate: the framework `__unbound__`\n* sentinel resolves to the late-bound `PostgresUnboundSchema` singleton\n* (which elides the qualifier so `search_path` decides at runtime); any\n* other id materialises a `PostgresSchema(id)` whose qualifier is the\n* named schema. Helpers route through these `Namespace` concretions so\n* the unbound branch lives in the polymorphic override, not the call\n* site.\n*/\nfunction qualifyTableName(schema, table) {\n\treturn postgresCreateNamespace({\n\t\tid: schema,\n\t\tentries: { table: {} }\n\t}).qualifyTable(table);\n}\n/**\n* The type `format_type` prints, for the column's ALTER COLUMN TYPE postcheck: the catalog text of\n* its data type with normalised parameters, or for an enum its name, quoted where Postgres quotes\n* it.\n*/\nfunction buildExpectedFormatType(column, types, storageTypes = {}) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tconst dataType = sqlDataTypeOfCodec(resolved.codecId, types);\n\tconst params = dataTypeParams(dataType, resolved.typeParams);\n\tif (dataType.sql.claimsKind !== void 0) return unquotedSqlBaseName(dataType, params).split(\".\").map(quoteIdentifierWhereNeeded).join(\".\");\n\treturn renderSqlCatalogText(dataType, params);\n}\n//#endregion\nexport { qualifyTableName as n, buildExpectedFormatType as t };\n\n//# sourceMappingURL=planner-sql-checks-Bhp0Iq_X.mjs.map"],"mappings":";;;;AAIA,SAAS,0BAA0B,QAAQ,cAAc;CACxD,IAAI,CAAC,OAAO,SAAS,OAAO;CAC5B,MAAM,iBAAiB,aAAa,OAAO;CAC3C,IAAI,CAAC,gBAAgB,OAAO;CAC5B,OAAO;EACN,SAAS,eAAe;EACxB,YAAY,eAAe;CAC5B;AACD;;;;;;;;;;;;AAcA,SAAS,iBAAiB,QAAQ,OAAO;CACxC,OAAO,wBAAwB;EAC9B,IAAI;EACJ,SAAS,EAAE,OAAO,CAAC,EAAE;CACtB,CAAC,CAAC,CAAC,aAAa,KAAK;AACtB;;;;;;AAMA,SAAS,wBAAwB,QAAQ,OAAO,eAAe,CAAC,GAAG;CAClE,MAAM,WAAW,0BAA0B,QAAQ,YAAY;CAC/D,MAAM,WAAW,mBAAmB,SAAS,SAAS,KAAK;CAC3D,MAAM,SAAS,eAAe,UAAU,SAAS,UAAU;CAC3D,IAAI,SAAS,IAAI,eAAe,KAAK,GAAG,OAAO,oBAAoB,UAAU,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,0BAA0B,CAAC,CAAC,KAAK,GAAG;CACxI,OAAO,qBAAqB,UAAU,MAAM;AAC7C"}
1
+ {"version":3,"file":"planner-sql-checks-rqOH8naU-B6xOE5lC.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-sql-checks-rqOH8naU.mjs"],"sourcesContent":["import { i as quoteIdentifierWhereNeeded } from \"./sql-utils-CVsvXiX4.mjs\";\nimport { i as postgresCreateNamespace } from \"./postgres-schema-AlEVkXXS.mjs\";\nimport { dataTypeParams, renderSqlCatalogText, sqlDataTypeOfCodec, unquotedSqlBaseName } from \"@internal/sql-contract/data-type\";\n//#region src/core/migrations/planner-type-resolution.ts\nfunction resolveColumnTypeMetadata(column, storageTypes) {\n\tif (!column.typeRef) return column;\n\tconst referencedType = storageTypes[column.typeRef];\n\tif (!referencedType) return column;\n\treturn {\n\t\tcodecId: referencedType.codecId,\n\t\ttypeParams: referencedType.typeParams\n\t};\n}\n//#endregion\n//#region src/core/migrations/planner-sql-checks.ts\n/**\n* String-keyed entry points the migration ops use to render\n* schema-qualified DDL and catalog checks. The `schema` argument is\n* interpreted as a namespace coordinate: the framework `__unbound__`\n* sentinel resolves to the late-bound `PostgresUnboundSchema` singleton\n* (which elides the qualifier so `search_path` decides at runtime); any\n* other id materialises a `PostgresSchema(id)` whose qualifier is the\n* named schema. Helpers route through these `Namespace` concretions so\n* the unbound branch lives in the polymorphic override, not the call\n* site.\n*/\nfunction qualifyTableName(schema, table) {\n\treturn postgresCreateNamespace({\n\t\tid: schema,\n\t\tentries: { table: {} }\n\t}).qualifyTable(table);\n}\n/**\n* The type `format_type` prints, for the column's ALTER COLUMN TYPE postcheck: the catalog text of\n* its data type with normalised parameters, or for an enum its name, quoted where Postgres quotes\n* it.\n*/\nfunction buildExpectedFormatType(column, types, storageTypes = {}) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tconst dataType = sqlDataTypeOfCodec(resolved.codecId, types);\n\tconst params = dataTypeParams(dataType, resolved.typeParams);\n\tif (dataType.sql.claimsKind !== void 0) return unquotedSqlBaseName(dataType, params).split(\".\").map(quoteIdentifierWhereNeeded).join(\".\");\n\treturn renderSqlCatalogText(dataType, params);\n}\n//#endregion\nexport { qualifyTableName as n, buildExpectedFormatType as t };\n\n//# sourceMappingURL=planner-sql-checks-rqOH8naU.mjs.map"],"mappings":";;;;AAIA,SAAS,0BAA0B,QAAQ,cAAc;CACxD,IAAI,CAAC,OAAO,SAAS,OAAO;CAC5B,MAAM,iBAAiB,aAAa,OAAO;CAC3C,IAAI,CAAC,gBAAgB,OAAO;CAC5B,OAAO;EACN,SAAS,eAAe;EACxB,YAAY,eAAe;CAC5B;AACD;;;;;;;;;;;;AAcA,SAAS,iBAAiB,QAAQ,OAAO;CACxC,OAAO,wBAAwB;EAC9B,IAAI;EACJ,SAAS,EAAE,OAAO,CAAC,EAAE;CACtB,CAAC,CAAC,CAAC,aAAa,KAAK;AACtB;;;;;;AAMA,SAAS,wBAAwB,QAAQ,OAAO,eAAe,CAAC,GAAG;CAClE,MAAM,WAAW,0BAA0B,QAAQ,YAAY;CAC/D,MAAM,WAAW,mBAAmB,SAAS,SAAS,KAAK;CAC3D,MAAM,SAAS,eAAe,UAAU,SAAS,UAAU;CAC3D,IAAI,SAAS,IAAI,eAAe,KAAK,GAAG,OAAO,oBAAoB,UAAU,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,0BAA0B,CAAC,CAAC,KAAK,GAAG;CACxI,OAAO,qBAAqB,UAAU,MAAM;AAC7C"}
@@ -1,8 +1,8 @@
1
1
  import { S as PG_TEXT_CODEC_ID, _ as PG_INT_CODEC_ID } from "./codec-ids-Cb0yO-IS--e0P2rfI.mjs";
2
- import { t as createPostgresBuiltinDataTypeLookup } from "./data-types-BRBW3ouc-ZtyZE7nE.mjs";
3
- import { r as createPostgresBuiltinCodecLookup } from "./codec-registry-CyhMngN6-BlKEiEni.mjs";
4
- import { _ as roleEntityKind, c as PostgresSchema, f as nativeEnumEntityKind, g as rlsEnablementEntityKind, p as policyEntityKind } from "./postgres-schema-DXd0mebY-CExd_GcQ.mjs";
5
- import { c as postgresAuthoringEntityTypes } from "./authoring-CfPWv_-P-BHAGgGYI.mjs";
2
+ import { t as createPostgresBuiltinDataTypeLookup } from "./data-types-k3Ebk3kj-DWk3nh_k.mjs";
3
+ import { r as createPostgresBuiltinCodecLookup } from "./codec-registry-nSGjxm-H-BeUu5zV2.mjs";
4
+ import { _ as roleEntityKind, c as PostgresSchema, f as nativeEnumEntityKind, g as rlsEnablementEntityKind, p as policyEntityKind } from "./postgres-schema-AlEVkXXS-ZfXWYddl.mjs";
5
+ import { c as postgresAuthoringEntityTypes } from "./authoring-vHbPLrW4-BsHR7gUE.mjs";
6
6
  import { requiredSchemaKeys } from "@prisma/orm-framework/components/codec";
7
7
  import { blindCast } from "@prisma/orm-framework/utils/casts";
8
8
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
@@ -12,7 +12,7 @@ import { buildSqlSchemaQualifiedView } from "@prisma/orm-family-sql/contract/con
12
12
  import { createPreserveEmptyPredicate } from "@prisma/orm-framework/contract/hashing-utils";
13
13
  import { SqlContractSerializerBase } from "@prisma/orm-family-sql/family/ir";
14
14
  import { sqlContractCanonicalizationHooks } from "@prisma/orm-family-sql/contract/canonicalization-hooks";
15
- //#region ../../../3-targets/3-targets/postgres/dist/postgres-contract-view-rT0ZLNqw.mjs
15
+ //#region ../../../3-targets/3-targets/postgres/dist/postgres-contract-view-B0KloSYp.mjs
16
16
  const POSTGRES_AUTHORING_CTX = {
17
17
  family: "sql",
18
18
  target: "postgres",
@@ -143,4 +143,4 @@ const PostgresContractView = {
143
143
  //#endregion
144
144
  export { PostgresContractView as n, PostgresContractSerializer as t };
145
145
 
146
- //# sourceMappingURL=postgres-contract-view-rT0ZLNqw-DThfALEV.mjs.map
146
+ //# sourceMappingURL=postgres-contract-view-B0KloSYp-Cbbl_pIv.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"postgres-contract-view-rT0ZLNqw-DThfALEV.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-contract-view-rT0ZLNqw.mjs"],"sourcesContent":["import { S as PG_TEXT_CODEC_ID, _ as PG_INT_CODEC_ID } from \"./codec-ids-Cb0yO-IS.mjs\";\nimport { t as createPostgresBuiltinDataTypeLookup } from \"./data-types-BRBW3ouc.mjs\";\nimport { r as createPostgresBuiltinCodecLookup } from \"./codec-registry-CyhMngN6.mjs\";\nimport { n as postgresAuthoringEntityTypes } from \"./authoring-CfPWv_-P.mjs\";\nimport { a as nativeEnumEntityKind, c as roleEntityKind, o as policyEntityKind, s as rlsEnablementEntityKind, t as PostgresSchema } from \"./postgres-schema-DXd0mebY.mjs\";\nimport { requiredSchemaKeys } from \"@internal/framework-components/codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { isAuthoringEntityTypeDescriptor } from \"@internal/framework-components/authoring\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { buildSqlSchemaQualifiedView } from \"@internal/sql-contract/contract-view\";\nimport { createPreserveEmptyPredicate } from \"@internal/contract/hashing-utils\";\nimport { SqlContractSerializerBase } from \"@internal/family-sql/ir\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\n//#region src/core/postgres-contract-serializer.ts\nconst POSTGRES_AUTHORING_CTX = {\n\tfamily: \"sql\",\n\ttarget: \"postgres\",\n\tcodecLookup: createPostgresBuiltinCodecLookup(),\n\tdataTypeLookup: createPostgresBuiltinDataTypeLookup(),\n\tenumInferenceCodecs: {\n\t\ttext: PG_TEXT_CODEC_ID,\n\t\tint: PG_INT_CODEC_ID\n\t}\n};\nfunction isAuthoringEntityTypeFactoryOutput(output) {\n\treturn typeof output === \"object\" && output !== null && \"factory\" in output && typeof output.factory === \"function\";\n}\n/**\n* Walks a pack's entity-type namespace tree and emits hydration factories\n* keyed by the descriptor's `discriminator`. Used for `storage.types`\n* (codec-triple hydration). Namespace entries hydration dispatches by\n* entries key, not discriminator — handled by `hydrateNamespaceEntities`.\n*/\nfunction collectStorageTypesHydrators(namespace) {\n\tconst registry = /* @__PURE__ */ new Map();\n\tconst walk = (node) => {\n\t\tfor (const value of Object.values(node)) {\n\t\t\tif (isAuthoringEntityTypeDescriptor(value)) {\n\t\t\t\tif (isAuthoringEntityTypeFactoryOutput(value.output)) {\n\t\t\t\t\tconst { factory } = value.output;\n\t\t\t\t\tregistry.set(value.discriminator, (raw) => factory(raw, POSTGRES_AUTHORING_CTX));\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (typeof value === \"object\" && value !== null) walk(value);\n\t\t}\n\t};\n\twalk(namespace);\n\treturn registry;\n}\n/**\n* The canonicalization walk drops a field whose value equals its type's\n* default, which for a required field of an entity kind means the emitted\n* contract fails that kind's own schema on the next read (a RESTRICTIVE\n* policy's `permissive: false` is the live case). The set of fields that must\n* survive is therefore the required keys of the registered entity kinds —\n* read off the schemas rather than listed by hand, so a kind that gains a\n* required field is covered the day it gains one.\n*/\nfunction requiredEntityFieldsSurviveDefaults(kinds) {\n\treturn createPreserveEmptyPredicate(kinds.flatMap((kind) => requiredKeysOf(kind.schema).map((key) => [\n\t\t\"storage\",\n\t\t\"namespaces\",\n\t\t\"*\",\n\t\t\"entries\",\n\t\tkind.kind,\n\t\t\"*\",\n\t\tkey\n\t])));\n}\nfunction requiredKeysOf(schema) {\n\tconst keys = requiredSchemaKeys(schema);\n\tif (keys === void 0) throw new InternalError(\"entity-kind schema does not expose arktype object props; the required-field preserve set cannot be derived\");\n\treturn keys;\n}\nvar PostgresContractSerializer = class extends SqlContractSerializerBase {\n\tshouldPreserveEmpty;\n\tconstructor(extraPackEntityKinds = []) {\n\t\tconst storageTypesHydrators = collectStorageTypesHydrators(postgresAuthoringEntityTypes);\n\t\tconst entityKinds = [\n\t\t\tpolicyEntityKind,\n\t\t\troleEntityKind,\n\t\t\trlsEnablementEntityKind,\n\t\t\tnativeEnumEntityKind,\n\t\t\t...extraPackEntityKinds\n\t\t];\n\t\tsuper(storageTypesHydrators, entityKinds);\n\t\tconst preserveRequired = requiredEntityFieldsSurviveDefaults(entityKinds);\n\t\tthis.shouldPreserveEmpty = (path) => preserveRequired(path) || sqlContractCanonicalizationHooks.shouldPreserveEmpty(path);\n\t}\n\thydrateSqlNamespaceEntry(nsId, raw) {\n\t\tconst { id, entries } = blindCast(super.hydrateSqlNamespaceEntry(nsId, raw));\n\t\tconst allSlotsEmpty = Object.values(entries).every((slot) => slot === void 0 || Object.keys(slot).length === 0);\n\t\tif (id === UNBOUND_NAMESPACE_ID && allSlotsEmpty) return PostgresSchema.unbound;\n\t\tconst valueSetSlot = entries[\"valueSet\"];\n\t\tconst hasValueSets = valueSetSlot !== void 0 && Object.keys(valueSetSlot).length > 0;\n\t\treturn new PostgresSchema({\n\t\t\tid,\n\t\t\tentries: {\n\t\t\t\t...entries,\n\t\t\t\ttable: entries[\"table\"] ?? {},\n\t\t\t\t...hasValueSets ? { valueSet: valueSetSlot } : {}\n\t\t\t}\n\t\t});\n\t}\n\tserializeContract(contract) {\n\t\tconst { storage, ...rest } = contract;\n\t\tconst namespacesJson = {};\n\t\tfor (const [nsId, ns] of Object.entries(storage.namespaces)) {\n\t\t\tconst isUnboundSlot = ns.id === UNBOUND_NAMESPACE_ID;\n\t\t\tnamespacesJson[nsId] = {\n\t\t\t\tid: ns.id,\n\t\t\t\tkind: isUnboundSlot ? \"postgres-unbound-schema\" : \"postgres-schema\",\n\t\t\t\tentries: this.serializeNamespaceEntries(ns.entries)\n\t\t\t};\n\t\t}\n\t\tconst storageOut = {\n\t\t\tstorageHash: String(storage.storageHash),\n\t\t\tnamespaces: namespacesJson\n\t\t};\n\t\tif (storage.types !== void 0) {\n\t\t\tconst typesOut = {};\n\t\t\tfor (const [name, entry] of Object.entries(storage.types)) typesOut[name] = this.serializeJsonObject(entry);\n\t\t\tstorageOut[\"types\"] = typesOut;\n\t\t}\n\t\treturn blindCast({\n\t\t\t...rest,\n\t\t\tstorage: storageOut\n\t\t});\n\t}\n};\n//#endregion\n//#region src/core/postgres-contract-view.ts\nconst PostgresContractView = {\n\t/** Wrap an already-deserialized Postgres contract in a schema-qualified view. */\n\tfrom(contract) {\n\t\treturn buildSqlSchemaQualifiedView(contract);\n\t},\n\t/** Deserialize a Postgres contract JSON envelope and wrap it in a view. */\n\tfromJson(json) {\n\t\treturn buildSqlSchemaQualifiedView(new PostgresContractSerializer().deserializeContract(json));\n\t}\n};\n//#endregion\nexport { PostgresContractSerializer as n, PostgresContractView as t };\n\n//# sourceMappingURL=postgres-contract-view-rT0ZLNqw.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,yBAAyB;CAC9B,QAAQ;CACR,QAAQ;CACR,aAAa,iCAAiC;CAC9C,gBAAgB,oCAAoC;CACpD,qBAAqB;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IAAI,CAAC;CAC9F;AACD"}
1
+ {"version":3,"file":"postgres-contract-view-B0KloSYp-Cbbl_pIv.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-contract-view-B0KloSYp.mjs"],"sourcesContent":["import { S as PG_TEXT_CODEC_ID, _ as PG_INT_CODEC_ID } from \"./codec-ids-Cb0yO-IS.mjs\";\nimport { t as createPostgresBuiltinDataTypeLookup } from \"./data-types-k3Ebk3kj.mjs\";\nimport { r as createPostgresBuiltinCodecLookup } from \"./codec-registry-nSGjxm-H.mjs\";\nimport { n as postgresAuthoringEntityTypes } from \"./authoring-vHbPLrW4.mjs\";\nimport { a as nativeEnumEntityKind, c as roleEntityKind, o as policyEntityKind, s as rlsEnablementEntityKind, t as PostgresSchema } from \"./postgres-schema-AlEVkXXS.mjs\";\nimport { requiredSchemaKeys } from \"@internal/framework-components/codec\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { isAuthoringEntityTypeDescriptor } from \"@internal/framework-components/authoring\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { buildSqlSchemaQualifiedView } from \"@internal/sql-contract/contract-view\";\nimport { createPreserveEmptyPredicate } from \"@internal/contract/hashing-utils\";\nimport { SqlContractSerializerBase } from \"@internal/family-sql/ir\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\n//#region src/core/postgres-contract-serializer.ts\nconst POSTGRES_AUTHORING_CTX = {\n\tfamily: \"sql\",\n\ttarget: \"postgres\",\n\tcodecLookup: createPostgresBuiltinCodecLookup(),\n\tdataTypeLookup: createPostgresBuiltinDataTypeLookup(),\n\tenumInferenceCodecs: {\n\t\ttext: PG_TEXT_CODEC_ID,\n\t\tint: PG_INT_CODEC_ID\n\t}\n};\nfunction isAuthoringEntityTypeFactoryOutput(output) {\n\treturn typeof output === \"object\" && output !== null && \"factory\" in output && typeof output.factory === \"function\";\n}\n/**\n* Walks a pack's entity-type namespace tree and emits hydration factories\n* keyed by the descriptor's `discriminator`. Used for `storage.types`\n* (codec-triple hydration). Namespace entries hydration dispatches by\n* entries key, not discriminator — handled by `hydrateNamespaceEntities`.\n*/\nfunction collectStorageTypesHydrators(namespace) {\n\tconst registry = /* @__PURE__ */ new Map();\n\tconst walk = (node) => {\n\t\tfor (const value of Object.values(node)) {\n\t\t\tif (isAuthoringEntityTypeDescriptor(value)) {\n\t\t\t\tif (isAuthoringEntityTypeFactoryOutput(value.output)) {\n\t\t\t\t\tconst { factory } = value.output;\n\t\t\t\t\tregistry.set(value.discriminator, (raw) => factory(raw, POSTGRES_AUTHORING_CTX));\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (typeof value === \"object\" && value !== null) walk(value);\n\t\t}\n\t};\n\twalk(namespace);\n\treturn registry;\n}\n/**\n* The canonicalization walk drops a field whose value equals its type's\n* default, which for a required field of an entity kind means the emitted\n* contract fails that kind's own schema on the next read (a RESTRICTIVE\n* policy's `permissive: false` is the live case). The set of fields that must\n* survive is therefore the required keys of the registered entity kinds —\n* read off the schemas rather than listed by hand, so a kind that gains a\n* required field is covered the day it gains one.\n*/\nfunction requiredEntityFieldsSurviveDefaults(kinds) {\n\treturn createPreserveEmptyPredicate(kinds.flatMap((kind) => requiredKeysOf(kind.schema).map((key) => [\n\t\t\"storage\",\n\t\t\"namespaces\",\n\t\t\"*\",\n\t\t\"entries\",\n\t\tkind.kind,\n\t\t\"*\",\n\t\tkey\n\t])));\n}\nfunction requiredKeysOf(schema) {\n\tconst keys = requiredSchemaKeys(schema);\n\tif (keys === void 0) throw new InternalError(\"entity-kind schema does not expose arktype object props; the required-field preserve set cannot be derived\");\n\treturn keys;\n}\nvar PostgresContractSerializer = class extends SqlContractSerializerBase {\n\tshouldPreserveEmpty;\n\tconstructor(extraPackEntityKinds = []) {\n\t\tconst storageTypesHydrators = collectStorageTypesHydrators(postgresAuthoringEntityTypes);\n\t\tconst entityKinds = [\n\t\t\tpolicyEntityKind,\n\t\t\troleEntityKind,\n\t\t\trlsEnablementEntityKind,\n\t\t\tnativeEnumEntityKind,\n\t\t\t...extraPackEntityKinds\n\t\t];\n\t\tsuper(storageTypesHydrators, entityKinds);\n\t\tconst preserveRequired = requiredEntityFieldsSurviveDefaults(entityKinds);\n\t\tthis.shouldPreserveEmpty = (path) => preserveRequired(path) || sqlContractCanonicalizationHooks.shouldPreserveEmpty(path);\n\t}\n\thydrateSqlNamespaceEntry(nsId, raw) {\n\t\tconst { id, entries } = blindCast(super.hydrateSqlNamespaceEntry(nsId, raw));\n\t\tconst allSlotsEmpty = Object.values(entries).every((slot) => slot === void 0 || Object.keys(slot).length === 0);\n\t\tif (id === UNBOUND_NAMESPACE_ID && allSlotsEmpty) return PostgresSchema.unbound;\n\t\tconst valueSetSlot = entries[\"valueSet\"];\n\t\tconst hasValueSets = valueSetSlot !== void 0 && Object.keys(valueSetSlot).length > 0;\n\t\treturn new PostgresSchema({\n\t\t\tid,\n\t\t\tentries: {\n\t\t\t\t...entries,\n\t\t\t\ttable: entries[\"table\"] ?? {},\n\t\t\t\t...hasValueSets ? { valueSet: valueSetSlot } : {}\n\t\t\t}\n\t\t});\n\t}\n\tserializeContract(contract) {\n\t\tconst { storage, ...rest } = contract;\n\t\tconst namespacesJson = {};\n\t\tfor (const [nsId, ns] of Object.entries(storage.namespaces)) {\n\t\t\tconst isUnboundSlot = ns.id === UNBOUND_NAMESPACE_ID;\n\t\t\tnamespacesJson[nsId] = {\n\t\t\t\tid: ns.id,\n\t\t\t\tkind: isUnboundSlot ? \"postgres-unbound-schema\" : \"postgres-schema\",\n\t\t\t\tentries: this.serializeNamespaceEntries(ns.entries)\n\t\t\t};\n\t\t}\n\t\tconst storageOut = {\n\t\t\tstorageHash: String(storage.storageHash),\n\t\t\tnamespaces: namespacesJson\n\t\t};\n\t\tif (storage.types !== void 0) {\n\t\t\tconst typesOut = {};\n\t\t\tfor (const [name, entry] of Object.entries(storage.types)) typesOut[name] = this.serializeJsonObject(entry);\n\t\t\tstorageOut[\"types\"] = typesOut;\n\t\t}\n\t\treturn blindCast({\n\t\t\t...rest,\n\t\t\tstorage: storageOut\n\t\t});\n\t}\n};\n//#endregion\n//#region src/core/postgres-contract-view.ts\nconst PostgresContractView = {\n\t/** Wrap an already-deserialized Postgres contract in a schema-qualified view. */\n\tfrom(contract) {\n\t\treturn buildSqlSchemaQualifiedView(contract);\n\t},\n\t/** Deserialize a Postgres contract JSON envelope and wrap it in a view. */\n\tfromJson(json) {\n\t\treturn buildSqlSchemaQualifiedView(new PostgresContractSerializer().deserializeContract(json));\n\t}\n};\n//#endregion\nexport { PostgresContractSerializer as n, PostgresContractView as t };\n\n//# sourceMappingURL=postgres-contract-view-B0KloSYp.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,yBAAyB;CAC9B,QAAQ;CACR,QAAQ;CACR,aAAa,iCAAiC;CAC9C,gBAAgB,oCAAoC;CACpD,qBAAqB;EACpB,MAAM;EACN,KAAK;CACN;AACD;AACA,SAAS,mCAAmC,QAAQ;CACnD,OAAO,OAAO,WAAW,YAAY,WAAW,QAAQ,aAAa,UAAU,OAAO,OAAO,YAAY;AAC1G;;;;;;;AAOA,SAAS,6BAA6B,WAAW;CAChD,MAAM,2BAA2B,IAAI,IAAI;CACzC,MAAM,QAAQ,SAAS;EACtB,KAAK,MAAM,SAAS,OAAO,OAAO,IAAI,GAAG;GACxC,IAAI,gCAAgC,KAAK,GAAG;IAC3C,IAAI,mCAAmC,MAAM,MAAM,GAAG;KACrD,MAAM,EAAE,YAAY,MAAM;KAC1B,SAAS,IAAI,MAAM,gBAAgB,QAAQ,QAAQ,KAAK,sBAAsB,CAAC;IAChF;IACA;GACD;GACA,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,KAAK,KAAK;EAC5D;CACD;CACA,KAAK,SAAS;CACd,OAAO;AACR;;;;;;;;;;AAUA,SAAS,oCAAoC,OAAO;CACnD,OAAO,6BAA6B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G;GAC5D,MAAM,gBAAgB,GAAG,OAAO;GAChC,eAAe,QAAQ;IACtB,IAAI,GAAG;IACP,MAAM,gBAAgB,4BAA4B;IAClD,SAAS,KAAK,0BAA0B,GAAG,OAAO;GACnD;EACD;EACA,MAAM,aAAa;GAClB,aAAa,OAAO,QAAQ,WAAW;GACvC,YAAY;EACb;EACA,IAAI,QAAQ,UAAU,KAAK,GAAG;GAC7B,MAAM,WAAW,CAAC;GAClB,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,QAAQ,KAAK,GAAG,SAAS,QAAQ,KAAK,oBAAoB,KAAK;GAC1G,WAAW,WAAW;EACvB;EACA,OAAO,UAAU;GAChB,GAAG;GACH,SAAS;EACV,CAAC;CACF;AACD;AAGA,MAAM,uBAAuB;;CAE5B,KAAK,UAAU;EACd,OAAO,4BAA4B,QAAQ;CAC5C;;CAEA,SAAS,MAAM;EACd,OAAO,4BAA4B,IAAI,2BAA2B,CAAC,CAAC,oBAAoB,IAAI,CAAC;CAC9F;AACD"}
@@ -1,12 +1,14 @@
1
1
  import { t as errorPostgresMigrationStackMissing } from "./errors-DYyzTYzE-39CV_aMo.mjs";
2
- import { i as PostgresRlsPolicy, n as PostgresRlsEnablement } from "./postgres-schema-DXd0mebY-CExd_GcQ.mjs";
2
+ import { i as PostgresRlsPolicy, n as PostgresRlsEnablement } from "./postgres-schema-AlEVkXXS-ZfXWYddl.mjs";
3
+ import { t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs";
3
4
  import { n as postgresResolveDefault } from "./default-normalizer-CrMBHF0W-BaUR4Ec8.mjs";
4
- import { t as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-CadTChyu-C7F31wpN.mjs";
5
- import { i as renderDefaultLiteral } from "./planner-ddl-builders-ClaAKDuZ-DpDBj2cs.mjs";
6
- import { A as RenameIndexCall, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, M as RenameTableCall, N as SetDefaultCall, P as SetNotNullCall, R as installExtension, 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 RenamePostgresRlsPolicyCall, k as RenameConstraintCall, 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-B-4nf1jC-DkRw5e1q.mjs";
7
- import { a as defaultUniqueName, f as resolveNamespaceIdForDdlSchema, i as defaultPrimaryKeyName, o as issueNode, r as defaultForeignKeyName } from "./control-policy-C16wMazs-O_wlPuFC.mjs";
8
- import { n as contractToPostgresDatabaseSchemaNode, t as buildPostgresPlanDiff } from "./diff-database-schema-DRPIV4Ae-BSY-cBm0.mjs";
9
- import { n as PostgresContractView } from "./postgres-contract-view-rT0ZLNqw-DThfALEV.mjs";
5
+ import { t as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-BthOWVjF-DuZ9iUh-.mjs";
6
+ import { a as renderDefaultLiteral } from "./planner-ddl-builders-DRProi99-D0K5ZiD0.mjs";
7
+ import { A as RenameIndexCall, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, M as RenameTableCall, N as SetDefaultCall, P as SetNotNullCall, R as installExtension, 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 RenamePostgresRlsPolicyCall, k as RenameConstraintCall, 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-DdXVWQlV-DzfLhTkh.mjs";
8
+ import { n as defaultPrimaryKeyName, r as defaultUniqueName, t as defaultForeignKeyName } from "./default-constraint-names-CtcRXhV8-nz3ff6b8.mjs";
9
+ import { l as resolveNamespaceIdForDdlSchema, r as issueNode } from "./control-policy-bwcdB78Y-DgRaWAzu.mjs";
10
+ import { n as contractToPostgresDatabaseSchemaNode, t as buildPostgresPlanDiff } from "./diff-database-schema-zc7d2uxC-BVe8D7vG.mjs";
11
+ import { n as PostgresContractView } from "./postgres-contract-view-B0KloSYp-Cbbl_pIv.mjs";
10
12
  import { t as dataTransform } from "./data-transform-Bo32KRbq-BLn1_UG-.mjs";
11
13
  import { blindCast } from "@prisma/orm-framework/utils/casts";
12
14
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
@@ -18,7 +20,77 @@ import { SqlCheckConstraintIR, SqlIndexIR } from "@prisma/orm-family-sql/schema-
18
20
  import { errorMigrationOperationOptionRemoved } from "@prisma/orm-framework/errors/migration";
19
21
  import { Migration } from "@prisma/orm-family-sql/family/migration";
20
22
  import { MigrationContractViews } from "@prisma/orm-toolchain/migration-tools/migration";
21
- //#region ../../../3-targets/3-targets/postgres/dist/postgres-migration-CmD95Eh_.mjs
23
+ //#region ../../../3-targets/3-targets/postgres/dist/postgres-migration-UVh2xeV0.mjs
24
+ function postgresRenderDefault(def, column, type) {
25
+ if (def.kind === "function") return def.expression;
26
+ return renderDefaultLiteral(def.value, {
27
+ many: column.many,
28
+ ...type
29
+ });
30
+ }
31
+ /**
32
+ * The Postgres schema tree a contract describes, as the planner's "from" side:
33
+ * the target descriptor's `migrations.contractToSchema` hook and the trees
34
+ * `renameTable` compares to find its companion renames both go through here,
35
+ * so they are built with the same type lookups, default renderer and default resolver.
36
+ */
37
+ function postgresContractToSchema(contract, frameworkComponents) {
38
+ const types = sqlTypeLookupsOf(frameworkComponents);
39
+ return contractToPostgresDatabaseSchemaNode(blindCast(contract), {
40
+ annotationNamespace: "pg",
41
+ dataTypeLookup: types.dataTypeLookup,
42
+ codecLookup: types.codecLookup,
43
+ renderDefault: postgresRenderDefault,
44
+ resolveDefault: postgresResolveDefault
45
+ });
46
+ }
47
+ /** The constraint of `nextNodes` the diff pairs with `node` and finds unchanged. */
48
+ function unchangedIn(node, nextNodes) {
49
+ return nextNodes.find((next) => next.id === node.id && next.isEqualTo(node));
50
+ }
51
+ /**
52
+ * The renames of the primary key, unique constraints and foreign keys of one table that the end tree keeps otherwise unchanged but names differently. A constraint's name is its stated name, or the one the planner derives from its table; a start tree read from the database states every name. A constraint whose start and end names differ is renamed to the end name. The diff never compares constraint names, so without these the database keeps the old name. A database may already have the new name, as when Prisma 7 created it and the contract only now states it; the rename's postcheck then holds before it runs, and the runner skips it.
53
+ */
54
+ function constraintNameRenames(input) {
55
+ const { schemaName, from, to, previous, next } = input;
56
+ const rename = (kind, oldName, unchanged, derivedName) => {
57
+ if (unchanged === void 0) return [];
58
+ const newName = unchanged.name ?? derivedName;
59
+ return oldName === newName ? [] : [new RenameConstraintCall(schemaName, to, kind, oldName, newName)];
60
+ };
61
+ const primaryKey = previous.primaryKey === void 0 ? [] : rename("primaryKey", previous.primaryKey.name ?? defaultPrimaryKeyName(from), unchangedIn(previous.primaryKey, next.primaryKey === void 0 ? [] : [next.primaryKey]), defaultPrimaryKeyName(to));
62
+ const uniques = previous.uniques.flatMap((unique) => rename("unique", unique.name ?? defaultUniqueName(from, unique.columns), unchangedIn(unique, next.uniques), defaultUniqueName(to, unique.columns)));
63
+ const foreignKeys = previous.foreignKeys.flatMap((fk) => rename("foreignKey", fk.name ?? defaultForeignKeyName(from, fk.columns), unchangedIn(fk, next.foreignKeys), defaultForeignKeyName(to, fk.columns)));
64
+ return [
65
+ ...primaryKey,
66
+ ...uniques,
67
+ ...foreignKeys
68
+ ];
69
+ }
70
+ /**
71
+ * The constraint renames of a plan: {@link constraintNameRenames} for every table the start tree the planner was given and the end contract both have. The start tree comes from the start contract for `migration plan` and from the database for `db update`, so a database Prisma 8 created under derived names is renamed too once the contract states other names.
72
+ */
73
+ function plannedConstraintNameRenames(options) {
74
+ if (!options.policy.allowedOperationClasses.includes("widening")) return [];
75
+ PostgresDatabaseSchemaNode.assert(options.schema);
76
+ const startTablesBySchema = new Map(Object.values(options.schema.namespaces).map((namespace) => [namespace.schemaName, namespace.tables]));
77
+ const contract = options.contract;
78
+ const end = postgresContractToSchema(contract, options.frameworkComponents);
79
+ return Object.values(end.namespaces).flatMap((namespace) => {
80
+ const startTables = startTablesBySchema.get(namespace.schemaName) ?? {};
81
+ const schemaName = resolveNamespaceIdForDdlSchema(contract, namespace.schemaName) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : namespace.schemaName;
82
+ return Object.entries(namespace.tables).flatMap(([tableName, next]) => {
83
+ const previous = startTables[tableName];
84
+ return previous === void 0 ? [] : constraintNameRenames({
85
+ schemaName,
86
+ from: tableName,
87
+ to: tableName,
88
+ previous,
89
+ next
90
+ });
91
+ });
92
+ });
93
+ }
22
94
  /**
23
95
  * Rename post-pass for indexes, per `(schema, table)`, widening-only,
24
96
  * deterministic by sorted names — the same structure as the policy pass
@@ -198,29 +270,6 @@ function pairCheckRenames(options, issues) {
198
270
  consumed
199
271
  };
200
272
  }
201
- function postgresRenderDefault(def, column, type) {
202
- if (def.kind === "function") return def.expression;
203
- return renderDefaultLiteral(def.value, {
204
- many: column.many,
205
- ...type
206
- });
207
- }
208
- /**
209
- * The Postgres schema tree a contract describes, as the planner's "from" side:
210
- * the target descriptor's `migrations.contractToSchema` hook and the trees
211
- * `renameTable` compares to find its companion renames both go through here,
212
- * so they are built with the same type lookups, default renderer and default resolver.
213
- */
214
- function postgresContractToSchema(contract, frameworkComponents) {
215
- const types = sqlTypeLookupsOf(frameworkComponents);
216
- return contractToPostgresDatabaseSchemaNode(blindCast(contract), {
217
- annotationNamespace: "pg",
218
- dataTypeLookup: types.dataTypeLookup,
219
- codecLookup: types.codecLookup,
220
- renderDefault: postgresRenderDefault,
221
- resolveDefault: postgresResolveDefault
222
- });
223
- }
224
273
  function renamedMarker(marker, rename) {
225
274
  if (!(marker instanceof PostgresRlsEnablement) || marker.tableName !== rename.from) return marker;
226
275
  return new PostgresRlsEnablement({
@@ -253,29 +302,6 @@ function renameRlsReferences(entries, rename) {
253
302
  ...policies === void 0 ? {} : { policy: Object.fromEntries(Object.entries(policies).map(([name, policy]) => [name, renamedPolicy(policy, rename)])) }
254
303
  };
255
304
  }
256
- /** The constraint of the next table the diff pairs with `node` and finds unchanged, as the diff compares them. */
257
- function unchangedIn(node, nextNodes) {
258
- return nextNodes.find((next) => next.id === node.id && next.isEqualTo(node));
259
- }
260
- /**
261
- * The constraint renames that follow a table rename. A primary key, unique constraint or foreign key the start contract left unnamed carries a name derived from the old table name. When the end contract keeps the same constraint unchanged, it is renamed to the name the end contract gives it explicitly, or otherwise to the name derived from the new table name. A constraint the end contract changes is not renamed, so it keeps its name in the database. A constraint the start contract named keeps its name. Indexes and checks are not handled here: their wire names pair by content hash in the index and check rename passes.
262
- */
263
- function constraintRenamesForTableRename(input) {
264
- const { schemaName, from, to, previous, next } = input;
265
- const rename = (kind, oldName, unchanged, derivedName) => {
266
- if (unchanged === void 0) return [];
267
- const newName = unchanged.name ?? derivedName;
268
- return oldName === newName ? [] : [new RenameConstraintCall(schemaName, to, kind, oldName, newName)];
269
- };
270
- const primaryKey = previous.primaryKey !== void 0 && previous.primaryKey.name === void 0 ? rename("primaryKey", defaultPrimaryKeyName(from), unchangedIn(previous.primaryKey, next.primaryKey === void 0 ? [] : [next.primaryKey]), defaultPrimaryKeyName(to)) : [];
271
- const uniques = previous.uniques.filter((unique) => unique.name === void 0).flatMap((unique) => rename("unique", defaultUniqueName(from, unique.columns), unchangedIn(unique, next.uniques), defaultUniqueName(to, unique.columns)));
272
- const foreignKeys = previous.foreignKeys.filter((fk) => fk.name === void 0).flatMap((fk) => rename("foreignKey", defaultForeignKeyName(from, fk.columns), unchangedIn(fk, next.foreignKeys), defaultForeignKeyName(to, fk.columns)));
273
- return [
274
- ...primaryKey,
275
- ...uniques,
276
- ...foreignKeys
277
- ];
278
- }
279
305
  const RENAME_POLICY = { allowedOperationClasses: ["widening"] };
280
306
  function emissionSchemaForNamespace(contract, namespaceId) {
281
307
  return namespaceId === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : resolveDdlSchemaForNamespaceStorage(contract.storage, namespaceId);
@@ -287,7 +313,7 @@ function renamedTableNode(schema, contract, rename) {
287
313
  return table;
288
314
  }
289
315
  /**
290
- * The calls a migration's `renameTable` emits: the table rename, then a rename of each primary key, unique constraint and foreign key the start contract left unnamed, and of each wire-named index and check whose prefix derives from the table name. Only objects the end contract leaves otherwise unchanged are renamed; an unchanged constraint takes the end contract's explicit name if it has one. Throws `MIGRATION.TABLE_RENAME_UNMATCHED` when the start contract lacks the table or the end contract lacks the new name.
316
+ * The calls a migration's `renameTable` emits: the table rename, then a rename of each primary key, unique constraint and foreign key the start contract left unnamed, and of each wire-named index and check whose prefix derives from the table name. Only objects the end contract leaves otherwise unchanged are renamed; a constraint takes the end contract's stated name, or the name derived from the new table name. Throws `MIGRATION.TABLE_RENAME_UNMATCHED` when the start contract lacks the table or the end contract lacks the new name.
291
317
  */
292
318
  function postgresTableRenameCalls(input) {
293
319
  const applied = applyTableRename({
@@ -314,7 +340,7 @@ function postgresTableRenameCalls(input) {
314
340
  };
315
341
  return [
316
342
  new RenameTableCall(schemaName, rename.from, rename.to),
317
- ...constraintRenamesForTableRename({
343
+ ...constraintNameRenames({
318
344
  schemaName,
319
345
  from: rename.from,
320
346
  to: rename.to,
@@ -565,6 +591,6 @@ function refuseEarlierSetDefaultOptions(options) {
565
591
  });
566
592
  }
567
593
  //#endregion
568
- export { postgresContractToSchema as a, pairIndexRenames as i, emissionSchemaForNamespace as n, postgresRenderDefault as o, pairCheckRenames as r, PostgresMigration as t };
594
+ export { plannedConstraintNameRenames as a, pairIndexRenames as i, emissionSchemaForNamespace as n, postgresContractToSchema as o, pairCheckRenames as r, postgresRenderDefault as s, PostgresMigration as t };
569
595
 
570
- //# sourceMappingURL=postgres-migration-CmD95Eh_-DGLByWZD.mjs.map
596
+ //# sourceMappingURL=postgres-migration-UVh2xeV0-DW8V_8aj.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgres-migration-UVh2xeV0-DW8V_8aj.mjs","names":["#endView","#startView"],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-migration-UVh2xeV0.mjs"],"sourcesContent":["import { t as errorPostgresMigrationStackMissing } from \"./errors-DYyzTYzE.mjs\";\nimport { _ as PostgresRlsPolicy, v as PostgresRlsEnablement } from \"./postgres-schema-AlEVkXXS.mjs\";\nimport { n as postgresResolveDefault } from \"./default-normalizer-CrMBHF0W.mjs\";\nimport { i as PostgresDatabaseSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { t as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-BthOWVjF.mjs\";\nimport { r as contractToPostgresDatabaseSchemaNode, t as buildPostgresPlanDiff } from \"./diff-database-schema-zc7d2uxC.mjs\";\nimport { c as issueNode, n as resolveNamespaceIdForDdlSchema } from \"./control-policy-bwcdB78Y.mjs\";\nimport { A as RenameIndexCall, B as installExtension, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, M as RenameTableCall, N as SetDefaultCall, P as SetNotNullCall, 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 RenamePostgresRlsPolicyCall, k as RenameConstraintCall, 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-DdXVWQlV.mjs\";\nimport { n as renderDefaultLiteral } from \"./planner-ddl-builders-DRProi99.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-B0KloSYp.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 { applyTableRename, sqlTypeLookupsOf } from \"@internal/family-sql/control\";\nimport { namingOf, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { SqlCheckConstraintIR, SqlIndexIR } from \"@internal/sql-schema-ir/types\";\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/constraint-name-renames.ts\n/** The constraint of `nextNodes` the diff pairs with `node` and finds unchanged. */\nfunction unchangedIn(node, nextNodes) {\n\treturn nextNodes.find((next) => next.id === node.id && next.isEqualTo(node));\n}\n/**\n* The renames of the primary key, unique constraints and foreign keys of one table that the end tree keeps otherwise unchanged but names differently. A constraint's name is its stated name, or the one the planner derives from its table; a start tree read from the database states every name. A constraint whose start and end names differ is renamed to the end name. The diff never compares constraint names, so without these the database keeps the old name. A database may already have the new name, as when Prisma 7 created it and the contract only now states it; the rename's postcheck then holds before it runs, and the runner skips it.\n*/\nfunction constraintNameRenames(input) {\n\tconst { schemaName, from, to, previous, next } = input;\n\tconst rename = (kind, oldName, unchanged, derivedName) => {\n\t\tif (unchanged === void 0) return [];\n\t\tconst newName = unchanged.name ?? derivedName;\n\t\treturn oldName === newName ? [] : [new RenameConstraintCall(schemaName, to, kind, oldName, newName)];\n\t};\n\tconst primaryKey = previous.primaryKey === void 0 ? [] : rename(\"primaryKey\", previous.primaryKey.name ?? defaultPrimaryKeyName(from), unchangedIn(previous.primaryKey, next.primaryKey === void 0 ? [] : [next.primaryKey]), defaultPrimaryKeyName(to));\n\tconst uniques = previous.uniques.flatMap((unique) => rename(\"unique\", unique.name ?? defaultUniqueName(from, unique.columns), unchangedIn(unique, next.uniques), defaultUniqueName(to, unique.columns)));\n\tconst foreignKeys = previous.foreignKeys.flatMap((fk) => rename(\"foreignKey\", fk.name ?? defaultForeignKeyName(from, fk.columns), unchangedIn(fk, next.foreignKeys), defaultForeignKeyName(to, fk.columns)));\n\treturn [\n\t\t...primaryKey,\n\t\t...uniques,\n\t\t...foreignKeys\n\t];\n}\n/**\n* The constraint renames of a plan: {@link constraintNameRenames} for every table the start tree the planner was given and the end contract both have. The start tree comes from the start contract for `migration plan` and from the database for `db update`, so a database Prisma 8 created under derived names is renamed too once the contract states other names.\n*/\nfunction plannedConstraintNameRenames(options) {\n\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return [];\n\tPostgresDatabaseSchemaNode.assert(options.schema);\n\tconst startTablesBySchema = new Map(Object.values(options.schema.namespaces).map((namespace) => [namespace.schemaName, namespace.tables]));\n\tconst contract = options.contract;\n\tconst end = postgresContractToSchema(contract, options.frameworkComponents);\n\treturn Object.values(end.namespaces).flatMap((namespace) => {\n\t\tconst startTables = startTablesBySchema.get(namespace.schemaName) ?? {};\n\t\tconst schemaName = resolveNamespaceIdForDdlSchema(contract, namespace.schemaName) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : namespace.schemaName;\n\t\treturn Object.entries(namespace.tables).flatMap(([tableName, next]) => {\n\t\t\tconst previous = startTables[tableName];\n\t\t\treturn previous === void 0 ? [] : constraintNameRenames({\n\t\t\t\tschemaName,\n\t\t\t\tfrom: tableName,\n\t\t\t\tto: tableName,\n\t\t\t\tprevious,\n\t\t\t\tnext\n\t\t\t});\n\t\t});\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 the slice-1 behavior: an add,\n* plus a drop when `destructive` is allowed too.\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/rename-rls-references.ts\nfunction renamedMarker(marker, rename) {\n\tif (!(marker instanceof PostgresRlsEnablement) || marker.tableName !== rename.from) return marker;\n\treturn new PostgresRlsEnablement({\n\t\ttableName: rename.to,\n\t\tnamespaceId: marker.namespaceId\n\t});\n}\nfunction renamedPolicy(policy, rename) {\n\tif (!(policy instanceof PostgresRlsPolicy) || policy.tableName !== rename.from) return policy;\n\treturn new PostgresRlsPolicy({\n\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\ttableName: rename.to,\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});\n}\n/**\n* Moves the RLS marker and the policies of a renamed table onto its new name. The marker is keyed by table name; policies are keyed by their own name and only their `tableName` changes. Policy names do not derive from the table name, so none is renamed.\n*/\nfunction renameRlsReferences(entries, rename) {\n\tconst markers = entries[\"rls\"];\n\tconst policies = entries[\"policy\"];\n\treturn {\n\t\t...entries,\n\t\t...markers === void 0 ? {} : { rls: Object.fromEntries(Object.entries(markers).map(([tableName, marker]) => [tableName === rename.from ? rename.to : tableName, renamedMarker(marker, rename)])) },\n\t\t...policies === void 0 ? {} : { policy: Object.fromEntries(Object.entries(policies).map(([name, policy]) => [name, renamedPolicy(policy, rename)])) }\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}\nfunction renamedTableNode(schema, contract, rename) {\n\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, rename.namespaceId);\n\tconst table = Object.values(schema.namespaces).find((namespace) => namespace.schemaName === ddlSchema)?.tables[rename.to];\n\tassertDefined(table, `a resolved rename names table \"${rename.to}\" in schema \"${ddlSchema}\"`);\n\treturn table;\n}\n/**\n* The calls a migration's `renameTable` emits: the table rename, then a rename of each primary key, unique constraint and foreign key the start contract left unnamed, and of each wire-named index and check whose prefix derives from the table name. Only objects the end contract leaves otherwise unchanged are renamed; a constraint takes the end contract's stated name, or the name derived from the new table name. Throws `MIGRATION.TABLE_RENAME_UNMATCHED` when the start contract lacks the table or the end contract lacks the new name.\n*/\nfunction postgresTableRenameCalls(input) {\n\tconst applied = applyTableRename({\n\t\tstartContract: input.startContract,\n\t\tendContract: input.endContract,\n\t\trename: input.rename,\n\t\trenameTableReferences: renameRlsReferences\n\t});\n\tif (!applied.ok) throw applied.failure;\n\tconst { rename } = applied.value;\n\tconst contract = input.endContract;\n\tconst schemaName = emissionSchemaForNamespace(contract, rename.namespaceId);\n\tconst previousSchema = postgresContractToSchema(applied.value.contract, input.frameworkComponents);\n\tconst nextSchema = postgresContractToSchema(contract, input.frameworkComponents);\n\tconst { issues } = buildPostgresPlanDiff({\n\t\tcontract,\n\t\tactualSchema: previousSchema,\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 [\n\t\tnew RenameTableCall(schemaName, rename.from, rename.to),\n\t\t...constraintNameRenames({\n\t\t\tschemaName,\n\t\t\tfrom: rename.from,\n\t\t\tto: rename.to,\n\t\t\tprevious: renamedTableNode(previousSchema, contract, rename),\n\t\t\tnext: renamedTableNode(nextSchema, contract, rename)\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//#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#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\treturn new RenameConstraintCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.kind, options.from, options.to).toOp(this.controlAdapterFor(\"renameConstraint\"));\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, unique constraint, foreign key, index and check whose name was derived from the old table name, read from this migration's start and end contracts. Spread the result into `operations`: `...this.renameTable({ table: 'userProfile', to: 'UserProfile' })`. `schema` names the table's namespace when more than one declares the table. Throws `MIGRATION.TABLE_RENAME_UNMATCHED` when the start contract lacks the table or the end contract lacks the new name.\n\t*/\n\trenameTable(options) {\n\t\tconst adapter = this.controlAdapterFor(\"renameTable\");\n\t\treturn postgresTableRenameCalls({\n\t\t\tstartContract: this.startContract,\n\t\t\tendContract: this.endContract,\n\t\t\trename: {\n\t\t\t\tnamespaceId: options.schema,\n\t\t\t\tfrom: options.table,\n\t\t\t\tto: options.to\n\t\t\t},\n\t\t\tframeworkComponents: this.frameworkComponents()\n\t\t}).map(async (call) => call.toOp(adapter));\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).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\treturn new RenameIndexCall(options.schema, options.table, options.from, options.to).toOp(this.controlAdapterFor(\"renameIndex\"));\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\treturn new RenamePostgresRlsPolicyCall(options.schema, options.table, options.from, options.to).toOp(this.controlAdapterFor(\"renameRlsPolicy\"));\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 { plannedConstraintNameRenames as a, pairIndexRenames as i, emissionSchemaForNamespace as n, postgresContractToSchema as o, pairCheckRenames as r, postgresRenderDefault as s, PostgresMigration as t };\n\n//# sourceMappingURL=postgres-migration-UVh2xeV0.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,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;;AAIA,SAAS,YAAY,MAAM,WAAW;CACrC,OAAO,UAAU,MAAM,SAAS,KAAK,OAAO,KAAK,MAAM,KAAK,UAAU,IAAI,CAAC;AAC5E;;;;AAIA,SAAS,sBAAsB,OAAO;CACrC,MAAM,EAAE,YAAY,MAAM,IAAI,UAAU,SAAS;CACjD,MAAM,UAAU,MAAM,SAAS,WAAW,gBAAgB;EACzD,IAAI,cAAc,KAAK,GAAG,OAA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