@prisma/orm-target-postgres 8.0.0-rc.17-dev.37 → 8.0.0-rc.17-dev.38

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 (162) hide show
  1. package/dist/{adapter-C0SKPLzt-D3_mXLaM.mjs → adapter-C0SKPLzt-flxKm2YQ.mjs} +5 -5
  2. package/dist/{adapter-C0SKPLzt-D3_mXLaM.mjs.map → adapter-C0SKPLzt-flxKm2YQ.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-kZOSollq-DP0v31A_.mjs → authoring-CTn87jlt-VHX7hiNU.mjs} +5 -5
  9. package/dist/{authoring-kZOSollq-DP0v31A_.mjs.map → authoring-CTn87jlt-VHX7hiNU.mjs.map} +1 -1
  10. package/dist/autoincrement-widths-DbyXRo5B-BUVCYb_V.mjs +39 -0
  11. package/dist/autoincrement-widths-DbyXRo5B-BUVCYb_V.mjs.map +1 -0
  12. package/dist/{check-expressions-BaFrBceq-ChgvazEN.mjs → check-expressions-CVLs1Cgf-DaMRk-Q4.mjs} +3 -3
  13. package/dist/{check-expressions-BaFrBceq-ChgvazEN.mjs.map → check-expressions-CVLs1Cgf-DaMRk-Q4.mjs.map} +1 -1
  14. package/dist/{codec-registry-CKBDkxX7-Kw84Or3s.mjs → codec-registry-BWUY_QLt-CzrMkP9N.mjs} +4 -4
  15. package/dist/{codec-registry-CKBDkxX7-Kw84Or3s.mjs.map → codec-registry-BWUY_QLt-CzrMkP9N.mjs.map} +1 -1
  16. package/dist/{codecs-BK3J4C0n-B8EnUXZf.mjs → codecs-Cb5S70Lx-WRSQkpza.mjs} +3 -3
  17. package/dist/{codecs-BK3J4C0n-B8EnUXZf.mjs.map → codecs-Cb5S70Lx-WRSQkpza.mjs.map} +1 -1
  18. package/dist/{contract-free-DjI-gclO.mjs → contract-free-spGyVyoh.mjs} +3 -3
  19. package/dist/{contract-free-DjI-gclO.mjs.map → contract-free-spGyVyoh.mjs.map} +1 -1
  20. package/dist/{control-DJo3P3yL.mjs → control-C4-UbYOH.mjs} +6 -3
  21. package/dist/control-C4-UbYOH.mjs.map +1 -0
  22. package/dist/{control-C5pTVhtN.mjs → control-DnqvbRrL.mjs} +105 -23
  23. package/dist/control-DnqvbRrL.mjs.map +1 -0
  24. package/dist/{control-adapter-CEeF_Na4-CMRZNp7S.mjs → control-adapter-CEeF_Na4-Cp6Si4hD.mjs} +6 -6
  25. package/dist/{control-adapter-CEeF_Na4-CMRZNp7S.mjs.map → control-adapter-CEeF_Na4-Cp6Si4hD.mjs.map} +1 -1
  26. package/dist/{control-policy-C5VoaD11-lzAw5cjN.mjs → control-policy-DXaIsgUW-Btyo9Vs8.mjs} +172 -130
  27. package/dist/control-policy-DXaIsgUW-Btyo9Vs8.mjs.map +1 -0
  28. package/dist/data-transform-C-3UJ3hC.d.mts +1 -0
  29. package/dist/{data-transform-Bo32KRbq-BLn1_UG-.mjs → data-transform-CtHnNYhF-r19375h3.mjs} +11 -4
  30. package/dist/data-transform-CtHnNYhF-r19375h3.mjs.map +1 -0
  31. package/dist/{data-transform-Ck5FbyNO-BNE7QlAo.d.mts → data-transform-nGy9rz87-CEOXAj91.d.mts} +14 -3
  32. package/dist/data-transform-nGy9rz87-CEOXAj91.d.mts.map +1 -0
  33. package/dist/{data-type-entries-DoR61yeO-BB2cY7rI.mjs → data-type-entries-15a-vBdm-vIj5l1u5.mjs} +3 -3
  34. package/dist/{data-type-entries-DoR61yeO-BB2cY7rI.mjs.map → data-type-entries-15a-vBdm-vIj5l1u5.mjs.map} +1 -1
  35. package/dist/{data-types-DRkmmE9S-C5Q9oH4Q.mjs → data-types-K6tDhu1D-BN--9o1o.mjs} +3 -3
  36. package/dist/{data-types-DRkmmE9S-C5Q9oH4Q.mjs.map → data-types-K6tDhu1D-BN--9o1o.mjs.map} +1 -1
  37. package/dist/{ddl-CFWv3VOT-Ad-I5p22.mjs → ddl-BKqbtVN3-CPHiYaCY.mjs} +3 -3
  38. package/dist/{ddl-CFWv3VOT-Ad-I5p22.mjs.map → ddl-BKqbtVN3-CPHiYaCY.mjs.map} +1 -1
  39. package/dist/{descriptor-meta-Dekti3e8-DLSepvAq.mjs → descriptor-meta-D5OipARb-6znWwvjE.mjs} +8 -8
  40. package/dist/{descriptor-meta-Dekti3e8-DLSepvAq.mjs.map → descriptor-meta-D5OipARb-6znWwvjE.mjs.map} +1 -1
  41. package/dist/{descriptor-meta-DyjDJfnQ-5lgalclQ.mjs → descriptor-meta-DyjDJfnQ-CoD4Kmpz.mjs} +3 -3
  42. package/dist/{descriptor-meta-DyjDJfnQ-5lgalclQ.mjs.map → descriptor-meta-DyjDJfnQ-CoD4Kmpz.mjs.map} +1 -1
  43. package/dist/{descriptor-meta-runtime-iArZEoCE-GhLNDdg-.mjs → descriptor-meta-runtime-D4a-hsd_-B_YkwgHQ.mjs} +3 -3
  44. package/dist/{descriptor-meta-runtime-iArZEoCE-GhLNDdg-.mjs.map → descriptor-meta-runtime-D4a-hsd_-B_YkwgHQ.mjs.map} +1 -1
  45. package/dist/{diff-database-schema-CUSXh2y2-CWRGCPL7.mjs → diff-database-schema-BV6Px0Gg-DAC6TL3P.mjs} +6 -6
  46. package/dist/{diff-database-schema-CUSXh2y2-CWRGCPL7.mjs.map → diff-database-schema-BV6Px0Gg-DAC6TL3P.mjs.map} +1 -1
  47. package/dist/driver.mjs +1 -1
  48. package/dist/driver__control.mjs +1 -1
  49. package/dist/{errors-DZ3zQdpT.d.mts → errors-D5sJ0fgp.d.mts} +2 -2
  50. package/dist/{errors-DZ3zQdpT.d.mts.map → errors-D5sJ0fgp.d.mts.map} +1 -1
  51. package/dist/{full-text-search-document-DJd-9K-K-CuV_QLH3.mjs → full-text-search-document-DYNz29YC-CfVTPwIL.mjs} +3 -3
  52. package/dist/{full-text-search-document-DJd-9K-K-CuV_QLH3.mjs.map → full-text-search-document-DYNz29YC-CfVTPwIL.mjs.map} +1 -1
  53. package/dist/indexes-BWHRVhke-vqXUnRfT.d.mts +49 -0
  54. package/dist/indexes-BWHRVhke-vqXUnRfT.d.mts.map +1 -0
  55. package/dist/{infer-psl-contract-BCPaLzjl-ByBJpE6R.mjs → infer-psl-contract-B_Bl_RJC-BfJbvDUs.mjs} +6 -6
  56. package/dist/{infer-psl-contract-BCPaLzjl-ByBJpE6R.mjs.map → infer-psl-contract-B_Bl_RJC-BfJbvDUs.mjs.map} +1 -1
  57. package/dist/{issue-planner-BLOtwO3z.d.mts → issue-planner-BiJDKtW5.d.mts} +10 -3
  58. package/dist/issue-planner-BiJDKtW5.d.mts.map +1 -0
  59. package/dist/migration-C9ZH26Nj.mjs.map +1 -1
  60. package/dist/{migration-CQeS0oqg.d.mts → migration-NJo7cPpB.d.mts} +6 -6
  61. package/dist/{migration-CQeS0oqg.d.mts.map → migration-NJo7cPpB.d.mts.map} +1 -1
  62. package/dist/{op-factory-call-DF9ijUbg-CSF8ZhJM.d.mts → op-factory-call-DkaMatJ4-D_7fWo-v.d.mts} +46 -87
  63. package/dist/op-factory-call-DkaMatJ4-D_7fWo-v.d.mts.map +1 -0
  64. package/dist/op-factory-call-LGCmMtZM.d.mts +1 -0
  65. package/dist/{op-factory-call-DiwaNQVO-NSekrcmI.mjs → op-factory-call-ltgiEZ8g-CX6WX57X.mjs} +163 -99
  66. package/dist/op-factory-call-ltgiEZ8g-CX6WX57X.mjs.map +1 -0
  67. package/dist/{planner-DCYVwcYk-vGUsjG3x.mjs → planner-Ccn9yxL7-B6Pgoz6c.mjs} +95 -18
  68. package/dist/planner-Ccn9yxL7-B6Pgoz6c.mjs.map +1 -0
  69. package/dist/{planner-C6vpC6nq.d.mts → planner-Xei8enE-.d.mts} +5 -4
  70. package/dist/planner-Xei8enE-.d.mts.map +1 -0
  71. package/dist/{planner-ddl-builders-Y0_96xpe-BzugdEDO.mjs → planner-ddl-builders-BcJ353Wj-Dfaixf4X.mjs} +6 -38
  72. package/dist/planner-ddl-builders-BcJ353Wj-Dfaixf4X.mjs.map +1 -0
  73. package/dist/{planner-identity-values-CRS2cQ6v-DakZeIQj.mjs → planner-identity-values-BZdomjRU-G521DabU.mjs} +3 -3
  74. package/dist/{planner-identity-values-CRS2cQ6v-DakZeIQj.mjs.map → planner-identity-values-BZdomjRU-G521DabU.mjs.map} +1 -1
  75. package/dist/{planner-produced-postgres-migration-BPk0jQUi-BFV5JJn1.mjs → planner-produced-postgres-migration-Brgj59VY-DOOLRWyy.mjs} +4 -4
  76. package/dist/{planner-produced-postgres-migration-BPk0jQUi-BFV5JJn1.mjs.map → planner-produced-postgres-migration-Brgj59VY-DOOLRWyy.mjs.map} +1 -1
  77. package/dist/planner-produced-postgres-migration-DgyIhdpw.d.mts +1 -0
  78. package/dist/{planner-produced-postgres-migration-CoLy4THO-CkCRWsv_.d.mts → planner-produced-postgres-migration-MoopN05f-CfmsQNwj.d.mts} +3 -3
  79. package/dist/planner-produced-postgres-migration-MoopN05f-CfmsQNwj.d.mts.map +1 -0
  80. package/dist/{planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs → planner-schema-lookup-CdgWer9s.mjs} +2 -2
  81. package/dist/planner-schema-lookup-CdgWer9s.mjs.map +1 -0
  82. package/dist/{planner-sql-checks-CXDdt_9m.d.mts → planner-sql-checks-C54jJ5qt.d.mts} +16 -2
  83. package/dist/planner-sql-checks-C54jJ5qt.d.mts.map +1 -0
  84. package/dist/planner-sql-checks-CX37qDix-Gkq38UQQ.mjs +108 -0
  85. package/dist/planner-sql-checks-CX37qDix-Gkq38UQQ.mjs.map +1 -0
  86. package/dist/planner-target-details-CUEF0s90-COTks5yz.mjs +14 -0
  87. package/dist/planner-target-details-CUEF0s90-COTks5yz.mjs.map +1 -0
  88. package/dist/{postgres-codec-traits-BUygtI9N-CB-uwvY1.mjs → postgres-codec-traits-BV62PF0L-NuMNArAx.mjs} +3 -3
  89. package/dist/{postgres-codec-traits-BUygtI9N-CB-uwvY1.mjs.map → postgres-codec-traits-BV62PF0L-NuMNArAx.mjs.map} +1 -1
  90. package/dist/{postgres-contract-view-6xGfZyGS-C58Bint3.mjs → postgres-contract-view-3yxlqPfK-CRFLsRHu.mjs} +7 -7
  91. package/dist/{postgres-contract-view-6xGfZyGS-C58Bint3.mjs.map → postgres-contract-view-3yxlqPfK-CRFLsRHu.mjs.map} +1 -1
  92. package/dist/{postgres-migration-BSvGOQze-WEc_3gN0.mjs → postgres-migration-CLIfS2iQ-BgnVMLRT.mjs} +63 -20
  93. package/dist/postgres-migration-CLIfS2iQ-BgnVMLRT.mjs.map +1 -0
  94. package/dist/{postgres-migration-Dajq9YrO-_sZwyRnK.d.mts → postgres-migration-D5OiThXV-CihIARAE.d.mts} +27 -8
  95. package/dist/{postgres-migration-Dajq9YrO-_sZwyRnK.d.mts.map → postgres-migration-D5OiThXV-CihIARAE.d.mts.map} +1 -1
  96. package/dist/{postgres-schema-DIaAgaL6-Dmqzjbu5.mjs → postgres-schema-Ysxbqkzr-hFRwS-zT.mjs} +3 -3
  97. package/dist/{postgres-schema-DIaAgaL6-Dmqzjbu5.mjs.map → postgres-schema-Ysxbqkzr-hFRwS-zT.mjs.map} +1 -1
  98. package/dist/{prisma7-binding-DQlvZyAM.mjs → prisma7-binding-nxvUgQTH.mjs} +6 -6
  99. package/dist/{prisma7-binding-DQlvZyAM.mjs.map → prisma7-binding-nxvUgQTH.mjs.map} +1 -1
  100. package/dist/{render-ops-D1lOuFbE-d95NrYqF.mjs → render-ops-Cw9B6aq6-CMzRGNUZ.mjs} +3 -3
  101. package/dist/{render-ops-D1lOuFbE-d95NrYqF.mjs.map → render-ops-Cw9B6aq6-CMzRGNUZ.mjs.map} +1 -1
  102. package/dist/{resolve-ddl-schema-b746rtzf-Dydnc_gK.mjs → resolve-ddl-schema-BvsUhPsJ-CY5uEwIr.mjs} +3 -3
  103. package/dist/{resolve-ddl-schema-b746rtzf-Dydnc_gK.mjs.map → resolve-ddl-schema-BvsUhPsJ-CY5uEwIr.mjs.map} +1 -1
  104. package/dist/{sql-renderer-DT4IEOVi-CBE8uTub.mjs → sql-renderer-DT4IEOVi-CGCgCiTV.mjs} +3 -3
  105. package/dist/{sql-renderer-DT4IEOVi-CBE8uTub.mjs.map → sql-renderer-DT4IEOVi-CGCgCiTV.mjs.map} +1 -1
  106. package/dist/{sql-utils-CVsvXiX4-C7xD0Bgv.mjs → sql-utils-Df-nf6eM-Ov1KgjWm.mjs} +24 -3
  107. package/dist/{sql-utils-CVsvXiX4-C7xD0Bgv.mjs.map → sql-utils-Df-nf6eM-Ov1KgjWm.mjs.map} +1 -1
  108. package/dist/target.d.mts +13 -13
  109. package/dist/target.mjs +29 -29
  110. package/dist/target__codecs.mjs +2 -2
  111. package/dist/target__contract-free.mjs +3 -3
  112. package/dist/target__control.mjs +3 -3
  113. package/dist/target__data-transform.d.mts +2 -2
  114. package/dist/target__data-transform.mjs +1 -1
  115. package/dist/target__data-types.mjs +2 -2
  116. package/dist/target__diff-database-schema.mjs +1 -1
  117. package/dist/target__errors.d.mts +1 -1
  118. package/dist/target__full-text-index-authoring.mjs +1 -1
  119. package/dist/target__issue-planner.d.mts +1 -1
  120. package/dist/target__issue-planner.mjs +1 -1
  121. package/dist/target__migration.d.mts +3 -3
  122. package/dist/target__migration.mjs +3 -3
  123. package/dist/target__op-factory-call.d.mts +3 -3
  124. package/dist/target__op-factory-call.mjs +2 -2
  125. package/dist/target__pack.mjs +1 -1
  126. package/dist/target__planner-ddl-builders.mjs +1 -1
  127. package/dist/target__planner-identity-values.mjs +1 -1
  128. package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
  129. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  130. package/dist/target__planner-schema-lookup.mjs +1 -1
  131. package/dist/target__planner-sql-checks.d.mts +2 -2
  132. package/dist/target__planner-sql-checks.mjs +2 -2
  133. package/dist/target__planner.d.mts +1 -1
  134. package/dist/target__planner.mjs +2 -2
  135. package/dist/target__prisma7-binding.mjs +1 -1
  136. package/dist/target__render-ops.mjs +1 -1
  137. package/dist/target__runtime.mjs +4 -4
  138. package/dist/target__runtime.mjs.map +1 -1
  139. package/dist/target__schema-ir-annotations.mjs +1 -1
  140. package/dist/target__sql-utils.mjs +2 -2
  141. package/dist/target__types.mjs +2 -2
  142. package/package.json +9 -9
  143. package/dist/control-C5pTVhtN.mjs.map +0 -1
  144. package/dist/control-DJo3P3yL.mjs.map +0 -1
  145. package/dist/control-policy-C5VoaD11-lzAw5cjN.mjs.map +0 -1
  146. package/dist/data-transform-BSM7TQpE.d.mts +0 -1
  147. package/dist/data-transform-Bo32KRbq-BLn1_UG-.mjs.map +0 -1
  148. package/dist/data-transform-Ck5FbyNO-BNE7QlAo.d.mts.map +0 -1
  149. package/dist/issue-planner-BLOtwO3z.d.mts.map +0 -1
  150. package/dist/op-factory-call-CBqqbXBb.d.mts +0 -1
  151. package/dist/op-factory-call-DF9ijUbg-CSF8ZhJM.d.mts.map +0 -1
  152. package/dist/op-factory-call-DiwaNQVO-NSekrcmI.mjs.map +0 -1
  153. package/dist/planner-C6vpC6nq.d.mts.map +0 -1
  154. package/dist/planner-DCYVwcYk-vGUsjG3x.mjs.map +0 -1
  155. package/dist/planner-ddl-builders-Y0_96xpe-BzugdEDO.mjs.map +0 -1
  156. package/dist/planner-produced-postgres-migration-CoLy4THO-CkCRWsv_.d.mts.map +0 -1
  157. package/dist/planner-produced-postgres-migration-D7zijd5s.d.mts +0 -1
  158. package/dist/planner-schema-lookup-kMIVP2y--CdO4VlnF.mjs.map +0 -1
  159. package/dist/planner-sql-checks-Bt_KuSiH-CdGZDp7M.mjs +0 -46
  160. package/dist/planner-sql-checks-Bt_KuSiH-CdGZDp7M.mjs.map +0 -1
  161. package/dist/planner-sql-checks-CXDdt_9m.d.mts.map +0 -1
  162. package/dist/postgres-migration-BSvGOQze-WEc_3gN0.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-policy-DXaIsgUW-Btyo9Vs8.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/control-policy-DXaIsgUW.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { A as pgTimestamptz, E as pgTime, I as pgVarbit, L as pgVarchar, M as pgTimetz, O as pgTimestamp, R as postgresDataTypes, _ as pgInt8, f as pgFloat4, g as pgInt4, h as pgInt2, p as pgFloat8, w as pgText, x as pgNumeric } from \"./data-types-K6tDhu1D.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-Ysxbqkzr.mjs\";\nimport { n as PostgresNativeEnumSchemaNode, o as postgresNodeEntityKind, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, F as SetNotNullCall, L as columnNameOfCall, O as RawSqlCall, P as SetDefaultCall, S as DropIndexCall, _ as DisableRowLevelSecurityCall, a as AddNativeEnumValueCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, g as DataTransformCall, h as CreateTableCall, i as AddForeignKeyCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, o as AddPrimaryKeyCall, r as AddColumnWithTemporaryDefaultCall, s as AddRequiredColumnToEmptyTableCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall, z as postgresDefaultToDdlColumnDefault } from \"./op-factory-call-ltgiEZ8g.mjs\";\nimport { i as stackDataTypes } from \"./planner-sql-checks-CX37qDix.mjs\";\nimport { t as buildTargetDetails } from \"./planner-target-details-CUEF0s90.mjs\";\nimport { t as buildColumnTypeSql } from \"./planner-ddl-builders-BcJ353Wj.mjs\";\nimport { n as resolveIdentityValue } from \"./planner-identity-values-BZdomjRU.mjs\";\nimport { n as defaultPrimaryKeyName, r as defaultUniqueName, t as defaultForeignKeyName } from \"./default-constraint-names-CtcRXhV8.mjs\";\nimport { dataTypeParams, resolveWrittenSqlTypes, sqlDataTypeOfCodec } from \"@internal/sql-contract/data-type\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { issueOutcome, orderIssuesByDependencies } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID, entityAt } from \"@internal/framework-components/ir\";\nimport { columnTakesTemporaryValue } from \"@internal/family-sql/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport * as contractFree from \"@internal/sql-relational-core/contract-free\";\nimport { RelationalSchemaNodeKind, SqlSchemaIR, contractDefaultRefusal, defaultInCanonicalForm } from \"@internal/sql-schema-ir/types\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/core/schema-ir/node-storage-coordinate.ts\n/**\n* The storage-`entries` coordinate `(entityKind, entityName)` a Postgres diff\n* node addresses — a table by its name, a native enum by its physical type\n* name. `undefined` for a node that is not a whole storage entity (a namespace,\n* a column, a policy). Lets ownership/subject resolution treat every entity kind\n* uniformly, the node self-describing its storage identity.\n*/\nfunction postgresNodeStorageCoordinate(node) {\n\tif (PostgresTableSchemaNode.is(node)) {\n\t\tconst entityKind = postgresNodeEntityKind(node.nodeKind);\n\t\treturn entityKind === void 0 ? void 0 : {\n\t\t\tentityKind,\n\t\t\tentityName: node.name\n\t\t};\n\t}\n\tif (PostgresNativeEnumSchemaNode.is(node)) {\n\t\tconst entityKind = postgresNodeEntityKind(node.nodeKind);\n\t\treturn entityKind === void 0 ? void 0 : {\n\t\t\tentityKind,\n\t\t\tentityName: node.typeName\n\t\t};\n\t}\n}\n//#endregion\n//#region src/core/migrations/column-ddl-rendering.ts\nconst AUTOINCREMENT = \"autoincrement()\";\n/**\n* Reconstructs the `StorageColumn`-shaped fields the DDL builder functions\n* (`buildColumnTypeSql`, `resolveIdentityValue`)\n* expect, from a column node's own stamped codec identity (`codecRef` /\n* `codecBaseNativeType`, Decision 5) — never the contract. The node's fields\n* are already resolved past any `typeRef` indirection, so the builders get\n* no `storageTypes` catalog.\n*/\nfunction columnLike(column) {\n\treturn {\n\t\t...columnTypeLike(`column \"${column.name}\"`, column),\n\t\tnullable: column.nullable,\n\t\t...ifDefined(\"default\", column.authoredDefault ?? column.resolvedDefault)\n\t};\n}\nfunction columnTypeLike(owner, identity) {\n\tif (identity.codecRef === void 0 || identity.codecBaseNativeType === void 0) throw new InternalError(`columnTypeLike: expected ${owner} carries no codec identity — the expected tree must be derived via contractToSchemaIR for planning`);\n\treturn {\n\t\tcodecId: identity.codecRef.codecId,\n\t\tmany: identity.many ?? identity.codecRef.many ? { elementNullable: false } : false,\n\t\t...ifDefined(\"typeParams\", identity.codecRef.typeParams !== void 0 ? blindCast(identity.codecRef.typeParams) : void 0)\n\t};\n}\n/**\n* A literal default in the canonical form of the column's values, which DDL writes (ADR 254). A\n* default the form refuses, which a contract emitted by an earlier version can hold, is refused\n* here rather than written, since the database would never hold the text the contract states.\n*/\nfunction inCanonicalForm(columnName, columnDefault, toCanonicalForm, many) {\n\tif (columnDefault?.kind !== \"literal\") return columnDefault;\n\tconst refusal = contractDefaultRefusal(columnDefault, toCanonicalForm, many);\n\tif (refusal !== void 0) throw postgresError(\"CONTRACT.DEFAULT_INVALID\", `Column \"${columnName}\": ${refusal}`, { meta: {\n\t\treason: \"default-not-canonical\",\n\t\tcolumn: columnName\n\t} });\n\treturn {\n\t\tkind: \"literal\",\n\t\tvalue: defaultInCanonicalForm(columnDefault.value, toCanonicalForm, many).value\n\t};\n}\n/**\n* Builds the `CREATE TABLE` / `ADD COLUMN` DDL column for an expected column\n* node, writing its type from the data type the node's codec represents.\n*/\nfunction renderColumnDdl(name, column, types) {\n\tconst like = columnLike(column);\n\tconst typeSql = buildColumnTypeSql(like, types);\n\tconst ddlDefault = postgresDefaultToDdlColumnDefault(inCanonicalForm(name, like.default, column.toCanonicalForm, like.many !== false));\n\treturn contractFree.col(name, typeSql, {\n\t\t...!column.nullable ? { notNull: true } : {},\n\t\t...ifDefined(\"default\", ddlDefault),\n\t\t...ifDefined(\"codecRef\", column.codecRef)\n\t});\n}\n/**\n* Builds the `ALTER COLUMN … TYPE` operands for an expected column node.\n*/\nfunction renderColumnAlterType(column, types) {\n\treturn buildColumnTypeSql(columnLike(column), types, {}, false);\n}\n/**\n* Resolves the identity value (monoid neutral element) SQL literal used as\n* the temporary default when adding a NOT-NULL column with no contract\n* default (`notNullAddColumnCallStrategy`'s shared-temp-default backfill).\n* `null` when the column's type has no built-in/codec-provided identity\n* value.\n*/\nfunction resolveColumnTemporaryDefault(column, codecHooks, types) {\n\treturn resolveIdentityValue(columnLike(column), codecHooks, types);\n}\n/**\n* The column whose `SET DEFAULT` a column-default diff node asks for, carrying its authored default, or its resolved one when nothing was authored, and its type and codec, from which the adapter writes the clause. An `autoincrement()` default is carried as itself, for `setDefault` to attach a sequence, or to refuse when the column is not a smallint, integer or bigint. `undefined` when the node carries no default, or one DDL does not write.\n*/\nfunction buildSetDefaultColumn(columnName, defaultNode, types) {\n\tconst authored = defaultNode.authored ?? defaultNode.resolved;\n\tif (authored === void 0) return void 0;\n\tconst typeLike = columnTypeLike(\"column default\", defaultNode);\n\tif (authored.kind === \"function\" && authored.expression === AUTOINCREMENT) return contractFree.col(columnName, buildColumnTypeSql(typeLike, types, {}, false), {\n\t\tdefault: contractFree.fn(AUTOINCREMENT),\n\t\t...ifDefined(\"codecRef\", defaultNode.codecRef)\n\t});\n\tconst ddlDefault = postgresDefaultToDdlColumnDefault(inCanonicalForm(columnName, authored, defaultNode.toCanonicalForm, typeLike.many !== false));\n\tif (ddlDefault === void 0) return void 0;\n\treturn contractFree.col(columnName, buildColumnTypeSql(typeLike, types, {}, false), {\n\t\tdefault: ddlDefault,\n\t\t...ifDefined(\"codecRef\", defaultNode.codecRef)\n\t});\n}\n//#endregion\n//#region src/core/migrations/safe-widenings.ts\n/** The changes between data types that keep every value: each pair is `from→to` by data type id. */\nconst SAFE_WIDENINGS = /* @__PURE__ */ new Set([\n\t`${pgInt2.id}→${pgInt4.id}`,\n\t`${pgInt2.id}→${pgInt8.id}`,\n\t`${pgInt4.id}→${pgInt8.id}`,\n\t`${pgInt2.id}→${pgFloat4.id}`,\n\t`${pgInt2.id}→${pgFloat8.id}`,\n\t`${pgInt4.id}→${pgFloat8.id}`,\n\t`${pgFloat4.id}→${pgFloat8.id}`,\n\t`${pgVarchar.id}→${pgText.id}`,\n\t`${pgInt2.id}→${pgText.id}`,\n\t`${pgInt4.id}→${pgText.id}`,\n\t`${pgInt8.id}→${pgText.id}`,\n\t`${pgNumeric.id}→${pgText.id}`,\n\t`${pgFloat4.id}→${pgText.id}`,\n\t`${pgFloat8.id}→${pgText.id}`\n]);\n/** Types whose `length` caps their values; a larger cap, or none, keeps every value. */\nconst LENGTH_CAPPED = /* @__PURE__ */ new Set([pgVarchar.id, pgVarbit.id]);\n/** Types whose `precision` rounds their fractional seconds; more, or none, keeps every value. */\nconst PRECISION_ROUNDED = /* @__PURE__ */ new Set([\n\tpgTime.id,\n\tpgTimetz.id,\n\tpgTimestamp.id,\n\tpgTimestamptz.id\n]);\nfunction numberParam(params, key) {\n\tconst value = params[key];\n\treturn typeof value === \"number\" ? value : void 0;\n}\n/** Whether a cap, where `undefined` means none, is at least as large as before. */\nfunction capGrows(from, to) {\n\treturn to === void 0 || from !== void 0 && to >= from;\n}\n/**\n* A `numeric` keeps every value when it allows at least as many digits before the point and after\n* it; an unconstrained `numeric` holds any value.\n*/\nfunction numericGrows(from, to) {\n\tconst toPrecision = numberParam(to, \"precision\");\n\tif (toPrecision === void 0) return true;\n\tconst fromPrecision = numberParam(from, \"precision\");\n\tif (fromPrecision === void 0) return false;\n\tconst fromScale = numberParam(from, \"scale\") ?? 0;\n\tconst toScale = numberParam(to, \"scale\") ?? 0;\n\treturn toScale >= fromScale && toPrecision - toScale >= fromPrecision - fromScale;\n}\n/** Whether changing a column from one type to another keeps every value. */\nfunction isSafeTypeWidening(from, to) {\n\tif (SAFE_WIDENINGS.has(`${from.dataType}→${to.dataType}`)) return true;\n\tif (from.dataType !== to.dataType) return false;\n\tif (LENGTH_CAPPED.has(from.dataType)) return capGrows(numberParam(from.params, \"length\"), numberParam(to.params, \"length\"));\n\tif (PRECISION_ROUNDED.has(from.dataType)) return capGrows(numberParam(from.params, \"precision\"), numberParam(to.params, \"precision\"));\n\tif (from.dataType === pgNumeric.id) return numericGrows(from.params, to.params);\n\treturn false;\n}\nfunction isParamRecord(value) {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n/** The data type a column node's codec represents, with its parameters. */\nfunction columnType(column, types) {\n\tif (column.codecRef === void 0) throw new InternalError(`Column \"${column.name}\" carries no codec, so its data type is unknown; a type change is planned only between columns built from contracts.`);\n\tconst type = sqlDataTypeOfCodec(column.codecRef.codecId, types);\n\tconst typeParams = column.codecRef.typeParams;\n\tconst params = isParamRecord(typeParams) ? dataTypeParams(type, typeParams) : {};\n\treturn {\n\t\tdataType: type.id,\n\t\tparams: type.sql.normalize(params)\n\t};\n}\n/** The type of an introspected column, read from the type name introspection reports. */\nfunction introspectedColumnType(column) {\n\tif (column.resolvedNativeType === void 0) return void 0;\n\tconst [only, ...others] = resolveWrittenSqlTypes(column.resolvedNativeType, postgresDataTypes);\n\treturn only === void 0 || others.length > 0 ? void 0 : {\n\t\tdataType: only.dataType,\n\t\tparams: only.typeParams\n\t};\n}\n/**\n* Whether changing a live column to the contract's column keeps every value. A column introspected\n* from the database carries no codec, so its type is read from the name introspection reports.\n*/\nfunction liveColumnWidensSafely(expected, actual, types) {\n\tif (expected.many === true || actual.many === true) return false;\n\tconst from = actual.codecRef === void 0 ? introspectedColumnType(actual) : columnType(actual, types);\n\treturn from !== void 0 && isSafeTypeWidening(from, columnType(expected, types));\n}\n//#endregion\n//#region src/core/migrations/planner-strategies.ts\n/**\n* Look up a storage table by its explicit namespace coordinate. Returns\n* `undefined` when the namespace has no table by that name (or no such\n* namespace exists). Callers that get `undefined` MUST treat it as an\n* explicit conflict — never silently fall back to a global default\n* schema or a name-only walk, because that footgun would resolve a\n* stale or duplicate table name to whichever namespace the iteration\n* order surfaced first (a real data-loss hazard in multi-namespace\n* contracts where two namespaces can carry the same table name).\n*/\nfunction tableAt(storage, namespaceId, tableName) {\n\tconst ns = storage.namespaces[namespaceId];\n\tif (ns === void 0) return void 0;\n\treturn ns.entries.table?.[tableName];\n}\n/**\n* Recovers the contract namespace id for a DDL schema name embedded in a\n* diff-issue path (`path[1]`). The strategies need the CONTRACT column/table\n* (for codec-hook reads and eligibility probes the retained subsystems still\n* run) even though the issue itself only carries the resolved DDL schema —\n* this is the reverse of `resolveDdlSchemaForNamespace`.\n*/\nfunction namespaceIdForDdlSchema(ctx, ddlSchemaName) {\n\treturn resolveNamespaceIdForDdlSchema(ctx.toContract, ddlSchemaName);\n}\n/** A `not-equal` column issue whose node pair is narrowed to `SqlColumnIR`. */\nfunction columnNodePair(issue) {\n\tconst node = issueNode(issue);\n\tif (node === void 0 || node.nodeKind !== RelationalSchemaNodeKind.column) return void 0;\n\tif (issue.expected === void 0 || issue.actual === void 0) return void 0;\n\treturn {\n\t\texpected: blindCast(issue.expected),\n\t\tactual: blindCast(issue.actual)\n\t};\n}\n/** The `--backfill` statement's column an issue is about, if a statement names it. */\nfunction backfilled(ctx, ddlSchemaName, tableName, columnName) {\n\tconst namespaceId = namespaceIdForDdlSchema(ctx, ddlSchemaName);\n\treturn ctx.statementColumns.backfill.find((column) => column.namespaceId === namespaceId && column.table === tableName && column.column === columnName);\n}\n/**\n* Handles a required column with no default added to an existing table, for a field a\n* `--backfill` statement names: a nullable add, a data transform whose slots the user fills, then\n* `SET NOT NULL`. Every other such column is left to `notNullAddColumnCallStrategy`.\n*/\nconst notNullBackfillCallStrategy = (issues, ctx) => {\n\tif (!ctx.policy.allowedOperationClasses.includes(\"data\")) return { kind: \"no_match\" };\n\tconst matched = [];\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-found\") continue;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || node.nodeKind !== RelationalSchemaNodeKind.column) continue;\n\t\tconst expected = blindCast(issue.expected);\n\t\tif (expected.nullable !== false || expected.resolvedDefault !== void 0) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst named = backfilled(ctx, ddlSchemaName, tableName, expected.name);\n\t\tif (named === void 0) continue;\n\t\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\t\tconst slot = named.text;\n\t\tmatched.push(issue);\n\t\tconst ddl = renderColumnDdl(expected.name, expected, ctx.types);\n\t\tconst nullableSpec = contractFree.col(ddl.name, ddl.type, { ...ddl.codecRef !== void 0 ? { codecRef: ddl.codecRef } : {} });\n\t\tcalls.push(new AddColumnCall(schemaName, tableName, nullableSpec), new DataTransformCall(`backfill-${tableName}-${expected.name}`, `${slot}:check`, `${slot}:run`, \"data\", {\n\t\t\tschema: schemaName,\n\t\t\ttable: tableName,\n\t\t\tcolumn: expected.name\n\t\t}), new SetNotNullCall(schemaName, tableName, expected.name));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\n/**\n* Handles a `not-equal` column issue whose type differs, for a field a `--convert` statement names,\n* in a plan that may include `data` operations: `migration plan`. The alter is classed `data` and\n* its USING clause is a slot the user fills with the conversion. A known-safe widening needs no\n* conversion and is left to `mapNodeIssueToCall`, as is every type change no statement names: a\n* direct alter, `widening` or `destructive`, which the plan asks about.\n*\n* One node issue can carry both type and nullability drift, so the strategy also emits the\n* nullability change: `SET NOT NULL` after the alter, whose conversion can map NULL to a value.\n*/\n/** A field as a statement names it: with its namespace only when the contract has several. */\nconst typeChangeCallStrategy = (issues, ctx) => {\n\tif (ctx.fromContract === null || !ctx.policy.allowedOperationClasses.includes(\"data\")) return { kind: \"no_match\" };\n\tconst matched = [];\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-equal\") continue;\n\t\tconst pair = columnNodePair(issue);\n\t\tif (pair === void 0) continue;\n\t\tconst { expected, actual } = pair;\n\t\tif (!columnTypeChangedNativeOnly(expected, actual)) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst namespaceId = namespaceIdForDdlSchema(ctx, ddlSchemaName);\n\t\tconst converted = ctx.statementColumns.convert.find((column) => column.namespaceId === namespaceId && column.table === tableName && column.column === expected.name);\n\t\tif (converted === void 0) continue;\n\t\tif (isSafeTypeWidening(columnType(actual, ctx.types), columnType(expected, ctx.types))) continue;\n\t\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\t\tmatched.push(issue);\n\t\tcalls.push(new AlterColumnTypeCall({\n\t\t\tschemaName,\n\t\t\ttableName,\n\t\t\tcolumnName: expected.name,\n\t\t\ttype: renderColumnAlterType(expected, ctx.types),\n\t\t\tusing: {\n\t\t\t\tkind: \"placeholder\",\n\t\t\t\tslot: `${converted.text}:convert`\n\t\t\t},\n\t\t\tdataTypes: ctx.dataTypes\n\t\t}));\n\t\tif (expected.nullable !== actual.nullable) calls.push(expected.nullable ? new DropNotNullCall(schemaName, tableName, expected.name) : new SetNotNullCall(schemaName, tableName, expected.name));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\n/**\n* Whether the raw (unresolved) native type differs — the SAME comparison\n* `typeChangeCallStrategy` always used (`fromColumn.nativeType !==\n* toColumn.nativeType`), which for the widenable numeric/float types\n* `SAFE_WIDENINGS` lists is identical to the resolved comparison\n* `columnTypeChanged` (in `issue-planner.ts`) performs.\n*/\nfunction columnTypeChangedNativeOnly(expected, actual) {\n\treturn expected.nativeType !== actual.nativeType;\n}\n/**\n* Handles a `not-equal` column issue whose type did not change but which becomes required, for a\n* field a `--backfill` statement names: a data transform whose slots the user fills with values for\n* the NULLs, then `SET NOT NULL`. Every other such column gets the direct `SET NOT NULL` of\n* `mapNodeIssueToCall`. A type-changed issue's nullability is handled by `typeChangeCallStrategy`\n* or the direct alter.\n*/\nconst nullableTighteningCallStrategy = (issues, ctx) => {\n\tif (!ctx.policy.allowedOperationClasses.includes(\"data\")) return { kind: \"no_match\" };\n\tconst matched = [];\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-equal\") continue;\n\t\tconst pair = columnNodePair(issue);\n\t\tif (pair === void 0) continue;\n\t\tconst { expected, actual } = pair;\n\t\tif (columnTypeChangedNativeOnly(expected, actual)) continue;\n\t\tif (expected.nullable !== false || actual.nullable !== true) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst named = backfilled(ctx, ddlSchemaName, tableName, expected.name);\n\t\tif (named === void 0) continue;\n\t\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\t\tconst slot = named.text;\n\t\tmatched.push(issue);\n\t\tcalls.push(new DataTransformCall(`handle-nulls-${tableName}-${expected.name}`, `${slot}:check`, `${slot}:run`, \"data\", {\n\t\t\tschema: schemaName,\n\t\t\ttable: tableName,\n\t\t\tcolumn: expected.name\n\t\t}), new SetNotNullCall(schemaName, tableName, expected.name));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls,\n\t\trecipe: true\n\t};\n};\n/**\n* Dispatches codec-typed storage types through their codec's\n* `planTypeOperations` hook (the authoritative source for codec-driven DDL\n* such as custom type creation). Codec extension/type ops are not modeled as\n* diff nodes — this strategy drives entirely off `ctx.toContract.storage.types`\n* + codec hooks, consuming nothing from the node issue list (there is no\n* node-vocabulary equivalent of `type_missing` / `enum_values_changed`).\n*/\nconst storageTypePlanCallStrategy = (issues, ctx) => {\n\tconst storageTypes = ctx.toContract.storage.types ?? {};\n\tif (Object.keys(storageTypes).length === 0) return { kind: \"no_match\" };\n\tconst calls = [];\n\tfor (const [typeName, typeInstance] of Object.entries(storageTypes).sort(([a], [b]) => a.localeCompare(b))) {\n\t\tconst codecInstance = blindCast(typeInstance);\n\t\tconst hook = ctx.codecHooks.get(codecInstance.codecId);\n\t\tif (!hook?.planTypeOperations) continue;\n\t\tconst planResult = hook.planTypeOperations({\n\t\t\ttypeName,\n\t\t\ttypeInstance: codecInstance,\n\t\t\tcontract: ctx.toContract,\n\t\t\tschema: ctx.schema,\n\t\t\tschemaName: ctx.schemaName,\n\t\t\tpolicy: ctx.policy\n\t\t});\n\t\tif (!planResult) continue;\n\t\tfor (const op of planResult.operations) calls.push(new RawSqlCall(blindCast({\n\t\t\t...op,\n\t\t\ttarget: {\n\t\t\t\tid: op.target.id,\n\t\t\t\tdetails: buildTargetDetails(\"type\", typeName, ctx.schemaName)\n\t\t\t}\n\t\t})));\n\t}\n\tif (calls.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues,\n\t\tcalls\n\t};\n};\n/**\n* Handles `not-found` column issues for NOT NULL columns without a contract\n* default. Replaces the legacy `buildAddColumnItem` non-default branches.\n*\n* Two shapes:\n* - Shared-temp-default safe: emit a single atomic composite op (add\n* nullable → backfill identity value → `SET NOT NULL` → `DROP DEFAULT`).\n* The temp-default value is resolved from the column node's `codecRef`\n* (`resolveColumnTemporaryDefault`, wrapping `resolveIdentityValue`).\n* - Empty-table guarded, for a column in a key, or whose values come from a value set, which\n* no one value stands in for: emit a hand-built op with a `tableIsEmptyCheck`\n* precheck so the failure message is \"table is not empty\" rather than the\n* raw PG NOT NULL violation.\n*\n* \"Normal\" not-found column cases (nullable or has a contract default) are\n* left for `mapNodeIssueToCall`'s default `AddColumnCall` emission.\n*/\nconst notNullAddColumnCallStrategy = (issues, ctx) => {\n\tconst matched = [];\n\tconst calls = [];\n\tfor (const issue of issues) {\n\t\tif (issueOutcome(issue) !== \"not-found\") continue;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0 || node.nodeKind !== RelationalSchemaNodeKind.column) continue;\n\t\tconst expected = blindCast(issue.expected);\n\t\tif (expected.nullable !== false || expected.resolvedDefault !== void 0) continue;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tconst tableName = issueTableName(issue);\n\t\tif (ddlSchemaName === void 0 || tableName === void 0) continue;\n\t\tconst namespaceId = namespaceIdForDdlSchema(ctx, ddlSchemaName);\n\t\tconst schemaName = namespaceId === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchemaName;\n\t\tconst contractTable = tableAt(ctx.toContract.storage, namespaceId, tableName);\n\t\tconst column = contractTable?.columns[expected.name];\n\t\tif (!contractTable || !column) continue;\n\t\tif (ctx.schema.tables[tableName] === void 0) continue;\n\t\tconst temporaryDefault = resolveColumnTemporaryDefault(expected, ctx.codecHooks, ctx.types);\n\t\tconst canUseSharedTempDefault = temporaryDefault !== null && columnTakesTemporaryValue(contractTable, expected.name);\n\t\tmatched.push(issue);\n\t\tconst ddl = renderColumnDdl(expected.name, expected, ctx.types);\n\t\tcalls.push(canUseSharedTempDefault && temporaryDefault !== null ? new AddColumnWithTemporaryDefaultCall(schemaName, tableName, ddl.name, ddl.type, temporaryDefault) : new AddRequiredColumnToEmptyTableCall(schemaName, tableName, ddl.name, ddl.type));\n\t}\n\tif (matched.length === 0) return { kind: \"no_match\" };\n\treturn {\n\t\tkind: \"match\",\n\t\tissues: issues.filter((i) => !matched.includes(i)),\n\t\tcalls\n\t};\n};\n/**\n* Ordered list of Postgres planner strategies, shared by `migration plan`\n* and `db update` / `db init`. The issue planner runs each strategy in\n* order, letting it consume any issues it handles, and routes whatever's\n* left through `mapNodeIssueToCall`.\n*\n* The strategies that write a placeholder (`notNullBackfillCallStrategy`,\n* `typeChangeCallStrategy`, `nullableTighteningCallStrategy`) act only on a\n* field a `--backfill` or `--convert` statement names, and only when the\n* policy allows `data` (`migration plan`). Every other required field added to\n* an existing table gets the temporary default of\n* `notNullAddColumnCallStrategy`, and every other change the direct DDL of\n* `mapNodeIssueToCall`, under either command.\n*\n* Codec-typed storage type entries are dispatched through\n* `storageTypePlanCallStrategy`.\n*/\nconst postgresPlannerStrategies = [\n\tnotNullBackfillCallStrategy,\n\ttypeChangeCallStrategy,\n\tnullableTighteningCallStrategy,\n\tstorageTypePlanCallStrategy,\n\tnotNullAddColumnCallStrategy\n];\n//#endregion\n//#region src/core/migrations/issue-planner.ts\nfunction issueConflict(kind, summary, location) {\n\treturn {\n\t\tkind,\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\t...location ? { location } : {}\n\t};\n}\n/**\n* Classifies calls into DDL sequencing buckets. The order matches the\n* legacy walk-schema planner's emission order so `db init` and `db update`\n* produce byte-identical plans for the shared shape (deps → drops → tables\n* → columns → alters → PKs → uniques → indexes → FKs).\n*\n* `dropType` (DROP TYPE for a managed native enum) is its own bucket, ordered\n* after the general drop bucket: a type can only be dropped once every table\n* whose column uses it is gone. A column→enum edge would make this precise,\n* but `coalesceSubtreeIssues` removes the column issue under a whole-table\n* drop, so the edge never reaches the graph; the coarse bucket stands in until\n* that edge lands (the coordinate work is a later slice).\n*/\nfunction classifyCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"createExtension\":\n\t\tcase \"createSchema\":\n\t\tcase \"createNativeEnumType\":\n\t\tcase \"addNativeEnumValue\": return \"dep\";\n\t\tcase \"dropNativeEnumType\": return \"dropType\";\n\t\tcase \"dropTable\":\n\t\tcase \"dropColumn\":\n\t\tcase \"dropConstraint\":\n\t\tcase \"dropCheckConstraint\":\n\t\tcase \"dropIndex\":\n\t\tcase \"dropDefault\": return \"drop\";\n\t\tcase \"addCheckConstraint\":\n\t\tcase \"renameConstraint\": return \"unique\";\n\t\tcase \"createTable\":\n\t\tcase \"renameTable\": return \"table\";\n\t\tcase \"enableRowLevelSecurity\":\n\t\tcase \"disableRowLevelSecurity\": return \"rlsEnable\";\n\t\tcase \"createRlsPolicy\": return \"rlsPolicy\";\n\t\tcase \"dropRlsPolicy\": return \"drop\";\n\t\tcase \"addColumn\":\n\t\tcase \"renameColumn\": return \"column\";\n\t\tcase \"alterColumnType\":\n\t\tcase \"setNotNull\":\n\t\tcase \"dropNotNull\":\n\t\tcase \"setDefault\": return \"alter\";\n\t\tcase \"addPrimaryKey\": return \"primaryKey\";\n\t\tcase \"addUnique\": return \"unique\";\n\t\tcase \"createIndex\":\n\t\tcase \"renameIndex\": return \"index\";\n\t\tcase \"addForeignKey\": return \"foreignKey\";\n\t\tcase \"rawSql\":\n\t\t\tif (blindCast(call).op?.target?.details?.objectType === \"type\") return \"dep\";\n\t\t\treturn \"alter\";\n\t\tdefault: return \"alter\";\n\t}\n}\nconst DEFAULT_POLICY = { allowedOperationClasses: [\n\t\"additive\",\n\t\"widening\",\n\t\"destructive\",\n\t\"data\"\n] };\nfunction emptySchemaIR() {\n\treturn new SqlSchemaIR({ tables: {} });\n}\nfunction conflictKindForCall(call) {\n\tswitch (call.factoryName) {\n\t\tcase \"alterColumnType\": return \"typeMismatch\";\n\t\tcase \"setNotNull\":\n\t\tcase \"dropNotNull\": return \"nullabilityConflict\";\n\t\tcase \"addForeignKey\":\n\t\tcase \"dropConstraint\": return \"foreignKeyConflict\";\n\t\tcase \"createIndex\":\n\t\tcase \"renameIndex\":\n\t\tcase \"dropIndex\": return \"indexIncompatible\";\n\t\tcase \"createRlsPolicy\":\n\t\tcase \"dropRlsPolicy\":\n\t\tcase \"renameRlsPolicy\": return \"rlsPolicyIncompatible\";\n\t\tdefault: return \"missingButNonAdditive\";\n\t}\n}\nfunction locationForCall(call) {\n\tconst anyCall = blindCast(call);\n\tconst location = {};\n\tif (anyCall.tableName) {\n\t\tlocation.entityKind = \"table\";\n\t\tlocation.entityName = anyCall.tableName;\n\t} else if (anyCall.typeName) {\n\t\tlocation.entityKind = \"native_enum\";\n\t\tlocation.entityName = anyCall.typeName;\n\t}\n\tconst columnName = columnNameOfCall(call);\n\tif (columnName) location.column = columnName;\n\tif (anyCall.indexName) location.index = anyCall.indexName;\n\telse if (anyCall.newIndexName) location.index = anyCall.newIndexName;\n\tif (anyCall.constraintName) location.constraint = anyCall.constraintName;\n\telse if (anyCall.newConstraintName) location.constraint = anyCall.newConstraintName;\n\tif (anyCall.policyName) location.rlsPolicy = anyCall.policyName;\n\telse if (anyCall.policy?.name) location.rlsPolicy = anyCall.policy.name;\n\telse if (anyCall.newPolicyName) location.rlsPolicy = anyCall.newPolicyName;\n\treturn Object.keys(location).length > 0 ? blindCast(location) : void 0;\n}\nfunction conflictForDisallowedCall(call, allowed) {\n\tconst summary = `Operation \"${call.label}\" requires class \"${call.operationClass}\", but policy allows only: ${allowed.join(\", \")}`;\n\tconst location = locationForCall(call);\n\treturn {\n\t\tkind: conflictKindForCall(call),\n\t\tsummary,\n\t\twhy: \"Use `migration new` to author a custom migration for this change.\",\n\t\trefusedOperationClass: call.operationClass,\n\t\t...location ? { location } : {}\n\t};\n}\n/** The diff node an issue concerns — expected when present, else the actual (extra) node. */\nfunction issueNode(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn blindCast(node);\n}\n/** DDL schema segment of a table-or-descendant issue path: `[database, ddlSchema, table, …]`. */\nfunction issueSchemaName(issue) {\n\treturn issue.path[1];\n}\n/** Table segment of a table-or-descendant issue path: `[database, ddlSchema, table, …]`. */\nfunction issueTableName(issue) {\n\treturn issue.path[2];\n}\n/** Column name embedded in a column/default issue path segment (`column:<name>`). */\nfunction issueColumnName(issue) {\n\tconst segment = issue.path[3];\n\tif (segment === void 0 || !segment.startsWith(\"column:\")) return void 0;\n\treturn segment.slice(7);\n}\n/**\n* The DDL schema name to use when EMITTING an op against `ddlSchemaName` (the\n* diff tree's resolved physical schema, `issueSchemaName(issue)`). The\n* unbound namespace's diff-tree identity resolves to `public` (a concrete\n* physical default the differ needs in order to compare its tree against\n* introspection — `resolveDdlSchemaForNamespaceStorage`), but DDL EMISSION\n* must stay unqualified so the live connection's `search_path` resolves it\n* at runtime (`boundSchema`). Recovers the logical namespace id via the\n* contract and substitutes the unbound sentinel back in when it resolves\n* there; every other namespace's `ddlSchemaName` already agrees between the\n* two resolution paths, so it passes through unchanged.\n*/\nfunction emissionSchemaName(ctx, ddlSchemaName) {\n\treturn resolveNamespaceIdForDdlSchema(ctx.toContract, ddlSchemaName) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchemaName;\n}\n/** Whether the expected/actual native type (resolved, or raw+many fallback) differs — mirrors `SqlColumnIR.isEqualTo`'s type comparison. */\nfunction columnTypeChanged(expected, actual) {\n\tif (expected.resolvedNativeType !== void 0 && actual.resolvedNativeType !== void 0) return expected.resolvedNativeType !== actual.resolvedNativeType;\n\treturn expected.nativeType !== actual.nativeType || Boolean(expected.many) !== Boolean(actual.many);\n}\n/**\n* The generic differ is total: a missing/extra table (or column) emits an\n* issue for itself AND for every node in its subtree. `CreateTable`/`DropTable`\n* and `AddColumn`/`DropColumn` already account for the whole subtree, so the\n* nested issues are redundant — coalescing drops any issue whose path is a\n* strict descendant of a `not-found`/`not-expected` issue's path. Run over the\n* relational subset ONLY (policy issues and synthesized namespace issues are\n* handled on their own paths, never coalesced against tables).\n*/\nfunction coalesceSubtreeIssues(issues) {\n\tconst collapsingPaths = issues.filter((issue) => issueOutcome(issue) !== \"not-equal\").map((issue) => issue.path);\n\tif (collapsingPaths.length === 0) return issues;\n\treturn issues.filter((issue) => !collapsingPaths.some((ancestor) => isStrictDescendantPath(issue.path, ancestor)));\n}\nfunction isStrictDescendantPath(path, ancestor) {\n\tif (path.length <= ancestor.length) return false;\n\tfor (let i = 0; i < ancestor.length; i += 1) if (path[i] !== ancestor[i]) return false;\n\treturn true;\n}\nfunction fkSpecFromNode(fk, tableName) {\n\treturn {\n\t\tname: fk.name ?? defaultForeignKeyName(tableName, fk.columns),\n\t\tcolumns: [...fk.columns],\n\t\treferences: {\n\t\t\tschema: fk.referencedSchema ?? \"\",\n\t\t\ttable: fk.referencedTable,\n\t\t\tcolumns: [...fk.referencedColumns]\n\t\t},\n\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t...ifDefined(\"onUpdate\", fk.onUpdate)\n\t};\n}\n/**\n* Builds the `CreateTable` + child `CreateIndex` / `AddForeignKey` / `AddUnique`\n* calls for a newly-expected table, reading only the table node's children. The\n* PK and every declared CHECK go inline as table constraints; indexes\n* (declared + FK-backing, already merged and ordered at derivation) and the\n* FK / unique constraints are separate calls (re-bucketed downstream). Every\n* column's DDL is resolved from its `codecRef` via `renderColumnDdl`.\n*/\nfunction buildCreateTableCallsFromNode(schemaName, ddlSchemaName, table, types) {\n\tconst ddlColumns = Object.values(table.columns).map((c) => renderColumnDdl(c.name, c, types));\n\tconst primaryKeyConstraints = table.primaryKey ? [contractFree.primaryKey([...table.primaryKey.columns], { ...ifDefined(\"name\", table.primaryKey.name) })] : [];\n\tconst declaredChecks = (table.checks ?? []).map((c) => contractFree.checkExpression(c.name, c.expression));\n\tconst allTableConstraints = [...primaryKeyConstraints, ...declaredChecks];\n\tconst calls = [new CreateTableCall(schemaName, table.name, ddlColumns, allTableConstraints.length > 0 ? allTableConstraints : void 0)];\n\tfor (const index of table.indexes) calls.push(createIndexCallFromNode(index, schemaName, table.name));\n\tfor (const fk of table.foreignKeys) calls.push(new AddForeignKeyCall(schemaName, table.name, fkSpecFromNode(fk, table.name)));\n\tfor (const unique of table.uniques) {\n\t\tconst constraintName = unique.name ?? defaultUniqueName(table.name, unique.columns);\n\t\tcalls.push(new AddUniqueCall(schemaName, table.name, constraintName, [...unique.columns]));\n\t}\n\tif (table.rlsEnabled) calls.push(new EnableRowLevelSecurityCall(ddlSchemaName, table.name));\n\treturn calls;\n}\nfunction nodeConflict(kind, message) {\n\treturn issueConflict(kind, message);\n}\n/**\n* True when `actualMembers` (the live database's ordered members) is a\n* strict, order-preserving prefix of `expectedMembers` (the contract's) —\n* the database already carries every contract member, in declaration\n* order, and the contract declares at least one member the database still\n* lacks. Any other relationship — a renamed value, a removed value, a\n* reordering, or the database holding members the contract lacks — is not\n* a suffix append.\n*/\nfunction isNativeEnumSuffixAppend(actualMembers, expectedMembers) {\n\tif (actualMembers.length >= expectedMembers.length) return false;\n\treturn actualMembers.every((member, index) => member === expectedMembers[index]);\n}\n/** Operator-worded refusal for a native-enum member change beyond a suffix append (design ruling — tests match this verbatim). */\nfunction nativeEnumMemberChangeRefusal(options) {\n\treturn `Native enum type \"${options.ddlSchemaName}\".\"${options.typeName}\" changed beyond appending new values (contract declares [${options.expectedMembers.join(\", \")}], database has [${options.actualMembers.join(\", \")}]). Prisma 8 does not modify a native enum's existing values (rename, removal, reorder) — see https://pris.ly/d/postgres-native-enums. Author the change manually with \\`migration new\\`.`;\n}\n/**\n* Managed native-enum issue -> op lowering. A missing declared type creates\n* it; an unclaimed live type drops it (ownership-scoped upstream by\n* `retainUnownedExtras`, and the `widening` drop gated by the operation-class\n* policy); a paired member-value mismatch lowers to one `ALTER TYPE ... ADD\n* VALUE` per appended member when the database's members are a strict,\n* order-preserving prefix of the contract's — any other change (rename,\n* removal, reorder, or the database holding members the contract lacks) is\n* refused with a NAMED diagnostic, never a silent no-op and never a\n* drop-and-recreate.\n*/\nfunction mapNativeEnumNodeIssue(issue, ctx) {\n\tconst ddlSchemaName = issueSchemaName(issue);\n\tif (ddlSchemaName === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Enum issue has no schema in its path: ${issue.path.join(\"/\")}`));\n\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst expected = blindCast(issue.expected);\n\t\treturn ok([new CreateNativeEnumTypeCall(schemaName, expected.typeName, expected.members)]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropNativeEnumTypeCall(schemaName, blindCast(issue.actual).typeName)]);\n\tconst expected = blindCast(issue.expected);\n\tconst actual = blindCast(issue.actual);\n\tif (isNativeEnumSuffixAppend(actual.members, expected.members)) return ok(expected.members.slice(actual.members.length).map((value) => new AddNativeEnumValueCall(schemaName, expected.typeName, value)));\n\treturn notOk(nodeConflict(\"unsupportedOperation\", nativeEnumMemberChangeRefusal({\n\t\tddlSchemaName,\n\t\ttypeName: expected.typeName,\n\t\texpectedMembers: expected.members,\n\t\tactualMembers: actual.members\n\t})));\n}\nfunction mapTableNodeIssue(issue, schemaName, ddlSchemaName, types) {\n\tif (issueOutcome(issue) === \"not-found\") return ok(buildCreateTableCallsFromNode(schemaName, ddlSchemaName, blindCast(issue.expected), types));\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropTableCall(schemaName, blindCast(issue.actual).name)]);\n\tconst expected = blindCast(issue.expected);\n\tconst actual = blindCast(issue.actual);\n\tif (expected.rlsEnabled && !actual.rlsEnabled) return ok([new EnableRowLevelSecurityCall(ddlSchemaName, expected.name)]);\n\tif (!expected.rlsEnabled && actual.rlsEnabled) return ok([new DisableRowLevelSecurityCall(ddlSchemaName, expected.name)]);\n\treturn notOk(nodeConflict(\"unsupportedOperation\", `unhandled table-attribute drift on \"${expected.name}\": table not-equal with no rlsEnabled delta (a second table attribute drifted)`));\n}\nfunction mapColumnNodeIssue(issue, schemaName, tableName, types, dataTypes) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst column = blindCast(issue.expected);\n\t\treturn ok([new AddColumnCall(schemaName, tableName, renderColumnDdl(column.name, column, types))]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropColumnCall(schemaName, tableName, blindCast(issue.actual).name)]);\n\tconst expected = blindCast(issue.expected);\n\tconst actual = blindCast(issue.actual);\n\tconst calls = [];\n\tif (columnTypeChanged(expected, actual)) calls.push(new AlterColumnTypeCall({\n\t\tschemaName,\n\t\ttableName,\n\t\tcolumnName: expected.name,\n\t\ttype: renderColumnAlterType(expected, types),\n\t\tdataTypes,\n\t\toperationClass: liveColumnWidensSafely(expected, actual, types) ? \"widening\" : \"destructive\"\n\t}));\n\tif (expected.nullable !== actual.nullable) calls.push(expected.nullable ? new DropNotNullCall(schemaName, tableName, expected.name) : new SetNotNullCall(schemaName, tableName, expected.name));\n\treturn ok(calls);\n}\nfunction mapColumnDefaultNodeIssue(issue, schemaName, tableName, columnName, types) {\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropDefaultCall(schemaName, tableName, columnName)]);\n\tif (issue.expected === void 0) return ok([]);\n\tconst column = buildSetDefaultColumn(columnName, blindCast(issue.expected), types);\n\tif (column === void 0) return ok([]);\n\treturn ok([new SetDefaultCall(schemaName, tableName, column, issueOutcome(issue) === \"not-equal\" ? \"widening\" : \"additive\")]);\n}\nfunction mapPrimaryKeyNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst pk = blindCast(issue.expected);\n\t\treturn ok([new AddPrimaryKeyCall(schemaName, tableName, pk.name ?? defaultPrimaryKeyName(tableName), [...pk.columns])]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropConstraintCall(schemaName, tableName, blindCast(issue.actual).name ?? defaultPrimaryKeyName(tableName), \"primaryKey\")]);\n\treturn notOk(nodeConflict(\"indexIncompatible\", issue.path.join(\"/\")));\n}\nfunction mapForeignKeyNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") return ok([new AddForeignKeyCall(schemaName, tableName, fkSpecFromNode(blindCast(issue.expected), tableName))]);\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst fk = blindCast(issue.actual);\n\t\treturn ok([new DropConstraintCall(schemaName, tableName, fk.name ?? defaultForeignKeyName(tableName, fk.columns), \"foreignKey\")]);\n\t}\n\treturn notOk(nodeConflict(\"foreignKeyConflict\", issue.path.join(\"/\")));\n}\nfunction mapUniqueNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst unique = blindCast(issue.expected);\n\t\treturn ok([new AddUniqueCall(schemaName, tableName, unique.name ?? defaultUniqueName(tableName, unique.columns), [...unique.columns])]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") {\n\t\tconst unique = blindCast(issue.actual);\n\t\treturn ok([new DropConstraintCall(schemaName, tableName, unique.name ?? defaultUniqueName(tableName, unique.columns), \"unique\")]);\n\t}\n\treturn notOk(nodeConflict(\"indexIncompatible\", issue.path.join(\"/\")));\n}\n/**\n* The CreateIndexCall for a name-identified index node: the node's own name\n* verbatim, its element list (column tuple or opaque expression), and the\n* unique/type/options/where attributes carried through.\n*/\nfunction createIndexCallFromNode(index, schemaName, tableName) {\n\tconst extras = {};\n\tif (index.type !== void 0) extras.type = index.type;\n\tif (index.options !== void 0) extras.options = index.options;\n\tif (index.where !== void 0) extras.where = index.where;\n\tif (index.unique) extras.unique = true;\n\treturn new CreateIndexCall(schemaName, tableName, index.name, index.columns !== void 0 ? { columns: [...index.columns] } : { expression: index.expression ?? \"\" }, extras);\n}\nfunction mapIndexNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") return ok([createIndexCallFromNode(blindCast(issue.expected), schemaName, tableName)]);\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropIndexCall(schemaName, tableName, blindCast(issue.actual).name)]);\n\treturn notOk(nodeConflict(\"indexIncompatible\", issue.path.join(\"/\")));\n}\n/**\n* The index treatment: a missing check is added, an undeclared live check is\n* dropped, and a paired divergence is a conflict. `not-equal` is reachable only\n* for an exact-named expected check — a wire-named one compares by name, so a\n* changed predicate re-suffixes the name and arrives as missing + extra\n* instead.\n*/\nfunction mapCheckNodeIssue(issue, schemaName, tableName) {\n\tif (issueOutcome(issue) === \"not-found\") {\n\t\tconst check = blindCast(issue.expected);\n\t\treturn ok([new AddCheckConstraintCall(schemaName, tableName, check.name, check.expression)]);\n\t}\n\tif (issueOutcome(issue) === \"not-expected\") return ok([new DropCheckConstraintCall(schemaName, tableName, blindCast(issue.actual).name)]);\n\treturn notOk(nodeConflict(\"unsupportedOperation\", issue.path.join(\"/\")));\n}\n/**\n* Maps one node-typed diff issue to its migration call(s), dispatching on the\n* node's `nodeKind` and the issue's presence-derived `issueOutcome`, reading\n* nodes and resolving column DDL from `codecRef` via `column-ddl-rendering.ts`.\n*/\nfunction mapNodeIssueToCall(issue, ctx) {\n\tconst node = issueNode(issue);\n\tif (node === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Issue carries neither an expected nor an actual node: ${issue.path.join(\"/\")}`));\n\tif (node.nodeKind === PostgresSchemaNodeKind.namespace) {\n\t\tif (issueOutcome(issue) !== \"not-found\") return notOk(nodeConflict(\"unsupportedOperation\", `Unexpected namespace drift: ${issue.path.join(\"/\")}`));\n\t\treturn ok([new CreateSchemaCall(blindCast(issue.expected).schemaName)]);\n\t}\n\tif (node.nodeKind === PostgresSchemaNodeKind.nativeEnum) return mapNativeEnumNodeIssue(issue, ctx);\n\tconst ddlSchemaName = issueSchemaName(issue);\n\tconst tableName = issueTableName(issue);\n\tif (ddlSchemaName === void 0 || tableName === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Issue has no schema/table in its path: ${issue.path.join(\"/\")}`));\n\tconst schemaName = emissionSchemaName(ctx, ddlSchemaName);\n\tswitch (node.nodeKind) {\n\t\tcase PostgresSchemaNodeKind.table: return mapTableNodeIssue(issue, schemaName, ddlSchemaName, ctx.types);\n\t\tcase RelationalSchemaNodeKind.column: return mapColumnNodeIssue(issue, schemaName, tableName, ctx.types, ctx.dataTypes);\n\t\tcase RelationalSchemaNodeKind.columnDefault: {\n\t\t\tconst columnName = issueColumnName(issue);\n\t\t\tif (columnName === void 0) return notOk(nodeConflict(\"unsupportedOperation\", `Default issue has no column in its path: ${issue.path.join(\"/\")}`));\n\t\t\treturn mapColumnDefaultNodeIssue(issue, schemaName, tableName, columnName, ctx.types);\n\t\t}\n\t\tcase RelationalSchemaNodeKind.primaryKey: return mapPrimaryKeyNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.foreignKey: return mapForeignKeyNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.unique: return mapUniqueNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.index: return mapIndexNodeIssue(issue, schemaName, tableName);\n\t\tcase RelationalSchemaNodeKind.check: return mapCheckNodeIssue(issue, schemaName, tableName);\n\t\tdefault: return notOk(nodeConflict(\"unsupportedOperation\", `Unhandled node kind: ${node.nodeKind}`));\n\t}\n}\n/**\n* Runs the ordered strategy list over the node-typed diff issues, maps\n* leftover issues via {@link mapNodeIssueToCall}, applies operation-class\n* policy gating, and buckets calls into the fixed DDL emission order (dep →\n* drop → table → column → recipe → alter → primaryKey → unique → index →\n* foreignKey).\n*/\nfunction planIssues(options) {\n\tconst policyProvided = options.policy !== void 0;\n\tconst policy = options.policy ?? DEFAULT_POLICY;\n\tconst schema = options.schema ?? emptySchemaIR();\n\tconst frameworkComponents = options.frameworkComponents ?? [];\n\tconst context = {\n\t\ttoContract: options.toContract,\n\t\tfromContract: options.fromContract,\n\t\tschemaName: options.schemaName,\n\t\tcodecHooks: options.codecHooks,\n\t\ttypes: options.types,\n\t\tstorageTypes: options.storageTypes,\n\t\tschema,\n\t\tpolicy,\n\t\tframeworkComponents,\n\t\tstatementColumns: options.statementColumns ?? {\n\t\t\tconvert: [],\n\t\t\tbackfill: []\n\t\t},\n\t\tdataTypes: stackDataTypes(frameworkComponents)\n\t};\n\tconst strategies = options.strategies ?? postgresPlannerStrategies;\n\tlet remaining = options.issues;\n\tconst recipeCalls = [];\n\tconst bucketablePatternCalls = [];\n\tfor (const strategy of strategies) {\n\t\tconst result = strategy(remaining, context);\n\t\tif (result.kind === \"match\") {\n\t\t\tremaining = result.issues;\n\t\t\tif (result.recipe) recipeCalls.push(...result.calls);\n\t\t\telse bucketablePatternCalls.push(...result.calls);\n\t\t}\n\t}\n\tconst sorted = orderIssuesByDependencies(remaining);\n\tconst defaultCalls = [];\n\tconst conflicts = [];\n\tfor (const issue of sorted) {\n\t\tconst result = mapNodeIssueToCall(issue, context);\n\t\tif (result.ok) defaultCalls.push(...result.value);\n\t\telse conflicts.push(result.failure);\n\t}\n\tconst allowed = policy.allowedOperationClasses;\n\tlet gatedDefault = defaultCalls;\n\tlet gatedRecipe = recipeCalls;\n\tlet gatedBucketable = bucketablePatternCalls;\n\tif (policyProvided) {\n\t\tconst keepIfAllowed = (bucket) => (call) => {\n\t\t\tif (allowed.includes(call.operationClass)) {\n\t\t\t\tbucket.push(call);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconflicts.push(conflictForDisallowedCall(call, allowed));\n\t\t};\n\t\tconst gatedDefaultBucket = [];\n\t\tconst gatedRecipeBucket = [];\n\t\tconst gatedBucketableBucket = [];\n\t\tdefaultCalls.forEach(keepIfAllowed(gatedDefaultBucket));\n\t\trecipeCalls.forEach(keepIfAllowed(gatedRecipeBucket));\n\t\tbucketablePatternCalls.forEach(keepIfAllowed(gatedBucketableBucket));\n\t\tgatedDefault = gatedDefaultBucket;\n\t\tgatedRecipe = gatedRecipeBucket;\n\t\tgatedBucketable = gatedBucketableBucket;\n\t}\n\tif (conflicts.length > 0) return notOk(conflicts);\n\tconst combinedBucketable = [...gatedDefault, ...gatedBucketable];\n\tconst byCategory = (cat) => combinedBucketable.filter((c) => classifyCall(c) === cat);\n\treturn ok({ calls: [\n\t\t...byCategory(\"dep\"),\n\t\t...byCategory(\"drop\"),\n\t\t...byCategory(\"dropType\"),\n\t\t...byCategory(\"table\"),\n\t\t...byCategory(\"column\"),\n\t\t...gatedRecipe,\n\t\t...byCategory(\"alter\"),\n\t\t...byCategory(\"primaryKey\"),\n\t\t...byCategory(\"unique\"),\n\t\t...byCategory(\"index\"),\n\t\t...byCategory(\"foreignKey\"),\n\t\t...byCategory(\"rlsEnable\")\n\t] });\n}\n//#endregion\n//#region src/core/migrations/control-policy.ts\n/**\n* Factory calls that create a whole, previously-absent top-level storage\n* object. Used to decide whether `tolerated` permits a call (it only allows\n* creating absent objects, never modifying existing ones).\n*\n* Deliberately an explicit, closed set rather than a `factoryName`\n* create/alter/drop classification: it answers exactly one yes/no question\n* and is fail-closed. Any call not listed here — including future or\n* extension-contributed factories — is treated as NOT object-creation, so it\n* is suppressed under `tolerated` rather than permissively emitted.\n*\n* Lists the creation factories that actually reach the call-side resolver\n* (`resolvePostgresCallControlPolicySubject`) — today only RLS policy\n* creation, from `planPostgresSchemaDiff`. Every other whole-object create\n* (table, schema, native enum, and RLS enablement) is constructed inside\n* `planIssues` and graded on the node side by\n* `resolvePostgresNodeIssueCreationFactoryName`, so none of them are listed\n* here.\n*/\nconst OBJECT_CREATION_FACTORIES = /* @__PURE__ */ new Set([\"createRlsPolicy\"]);\nfunction createsNewTopLevelObject(call) {\n\treturn OBJECT_CREATION_FACTORIES.has(call.factoryName);\n}\nfunction ddlSchemaNameForNamespace(contract, namespaceId) {\n\tconst namespace = contract.storage.namespaces[namespaceId];\n\treturn isPostgresSchema(namespace) ? namespace.ddlSchemaName(contract.storage) : namespaceId;\n}\n/**\n* Resolve the namespace a declared storage entity lives in by walking every\n* namespace for one whose `entries` map actually contains the coordinate —\n* a table by its name, a native enum by its physical type name (see\n* {@link postgresNodeStorageCoordinate}). When `ddlSchemaName` is given, the\n* match must also land in that DDL schema (disambiguates same-named entities\n* declared under different namespaces); when omitted, the first namespace\n* that declares the entity wins. Falls back to {@link UNBOUND_NAMESPACE_ID}\n* when no namespace declares it — e.g. an extra/dropped entity the contract\n* doesn't claim at all.\n*/\nfunction resolveNamespaceIdForEntity(contract, coordinate, ddlSchemaName) {\n\tfor (const namespaceId of Object.keys(contract.storage.namespaces)) {\n\t\tif (!entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t})) continue;\n\t\tif (ddlSchemaName === void 0 || ddlSchemaNameForNamespace(contract, namespaceId) === ddlSchemaName) return namespaceId;\n\t}\n\treturn UNBOUND_NAMESPACE_ID;\n}\nfunction resolveNamespaceIdForTable(contract, tableName, ddlSchemaName) {\n\treturn resolveNamespaceIdForEntity(contract, {\n\t\tentityKind: \"table\",\n\t\tentityName: tableName\n\t}, ddlSchemaName);\n}\nfunction resolveNamespaceIdForDdlSchema(contract, ddlSchemaName) {\n\tfor (const namespaceId of Object.keys(contract.storage.namespaces)) {\n\t\tconst ns = contract.storage.namespaces[namespaceId];\n\t\tif (isPostgresSchema(ns) && ns.ddlSchemaName(contract.storage) === ddlSchemaName) return namespaceId;\n\t\tif (namespaceId === ddlSchemaName) return namespaceId;\n\t}\n\treturn UNBOUND_NAMESPACE_ID;\n}\nfunction postgresCallFields(call) {\n\treturn {\n\t\t...ifDefined(\"schemaName\", \"schemaName\" in call ? call.schemaName : void 0),\n\t\t...ifDefined(\"tableName\", \"tableName\" in call ? call.tableName : void 0),\n\t\t...ifDefined(\"columnName\", columnNameOfCall(call))\n\t};\n}\nfunction formatSuppressionSubjectLabel(subject, contract) {\n\tif (subject === void 0) return \"unknown\";\n\tconst ddlSchema = ddlSchemaNameForNamespace(contract, subject.namespaceId);\n\tif (subject.entityKind !== void 0 && subject.entityName !== void 0) {\n\t\tconst entityLabel = `${subject.entityKind} \"${ddlSchema}.${subject.entityName}\"`;\n\t\treturn subject.rlsPolicy !== void 0 ? `RLS policy \"${subject.rlsPolicy}\" on ${entityLabel}` : entityLabel;\n\t}\n\treturn `namespace \"${ddlSchema}\"`;\n}\nfunction postgresSuppressionSummary(subjectLabel, subject, policy) {\n\tconst namespace = subject?.namespaceId ?? \"unknown\";\n\tconst declared = subject?.explicitNodeControlPolicy;\n\tif (policy === \"external\" && declared === \"managed\") return `control policy suppressed: ${subjectLabel} — namespace '${namespace}' has effective control 'external' but declared 'managed'`;\n\treturn `control policy suppressed: ${subjectLabel} — namespace '${namespace}' has effective control '${policy}'${declared ? ` but declared '${declared}'` : \"\"}`;\n}\n/**\n* Render one family {@link SuppressionRecord} into a target `SqlPlannerConflict`.\n* The family decides *that* a subject is suppressed and hands over the raw\n* coordinate + policy; the label, message, and location are rendered here,\n* driven entirely by the subject's own `(entityKind, entityName)` coordinate\n* — no target-owned table-vs-enum vocabulary.\n*/\nfunction renderPostgresSuppression(record, contract) {\n\tconst subject = record.subject;\n\treturn {\n\t\tkind: \"controlPolicySuppressedCall\",\n\t\tsummary: postgresSuppressionSummary(formatSuppressionSubjectLabel(subject, contract), subject, record.policy),\n\t\tlocation: {\n\t\t\t...ifDefined(\"namespaceId\", subject?.namespaceId),\n\t\t\t...ifDefined(\"entityKind\", subject?.entityKind),\n\t\t\t...ifDefined(\"entityName\", subject?.entityName),\n\t\t\t...ifDefined(\"column\", subject?.column),\n\t\t\t...ifDefined(\"rlsPolicy\", subject?.rlsPolicy)\n\t\t},\n\t\tmeta: {\n\t\t\tcontrolPolicy: record.policy,\n\t\t\t...ifDefined(\"factoryName\", record.factoryName),\n\t\t\t...ifDefined(\"rlsPolicy\", subject?.rlsPolicy),\n\t\t\t...ifDefined(\"declaredControlPolicy\", subject?.explicitNodeControlPolicy)\n\t\t}\n\t};\n}\nfunction resolvePostgresCallControlPolicySubject(call, contract) {\n\tconst callFields = postgresCallFields(call);\n\tconst createsNewObject = createsNewTopLevelObject(call);\n\tif (call.factoryName === \"createSchema\" && callFields.schemaName) return {\n\t\tnamespaceId: resolveNamespaceIdForDdlSchema(contract, callFields.schemaName),\n\t\tcreatesNewObject\n\t};\n\tif (callFields.tableName) {\n\t\tconst namespaceId = resolveNamespaceIdForTable(contract, callFields.tableName, callFields.schemaName);\n\t\tconst tableControlPolicy = entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: callFields.tableName\n\t\t})?.control;\n\t\treturn {\n\t\t\tnamespaceId,\n\t\t\tentityKind: \"table\",\n\t\t\tentityName: callFields.tableName,\n\t\t\t...ifDefined(\"column\", callFields.columnName),\n\t\t\t...ifDefined(\"explicitNodeControlPolicy\", tableControlPolicy),\n\t\t\tcreatesNewObject\n\t\t};\n\t}\n\tif (callFields.schemaName) return {\n\t\tnamespaceId: resolveNamespaceIdForDdlSchema(contract, callFields.schemaName),\n\t\tcreatesNewObject\n\t};\n}\n/**\n* Node kinds whose *absence* is the creation of a whole, top-level Postgres\n* object: a namespace, a table, or a native enum. Used by\n* {@link resolvePostgresNodeIssueCreationFactoryName} to decide whether a\n* `tolerated` subject permits the issue to flow into the planner\n* (create-if-absent) and to seed the suppressed-subject warning's\n* `factoryName` when the planner is skipped. RLS policy creation is not\n* listed here — policy issues never reach this issue-based partition (they\n* are routed to `planPostgresSchemaDiff` and gated via the call-based\n* {@link resolvePostgresCallControlPolicySubject} instead).\n*/\nconst POSTGRES_NODE_CREATION_FACTORY = Object.freeze({\n\t[PostgresSchemaNodeKind.namespace]: \"createSchema\",\n\t[PostgresSchemaNodeKind.table]: \"createTable\",\n\t[PostgresSchemaNodeKind.nativeEnum]: \"createNativeEnumType\"\n});\n/**\n* A table `not-equal` issue whose `rlsEnabled` flips OFF→ON (expected on,\n* actual off) is enablement toward `ENABLE ROW LEVEL SECURITY`. It is\n* creation-class on the node side because `isEnablementCreationIssue` and\n* {@link resolvePostgresNodeIssueCreationFactoryName} treat this OFF→ON delta\n* as a creation: enabling RLS establishes the fail-closed guard the declared\n* policy set attaches to, the same grant `tolerated` extends to creating the\n* policies themselves. The opposite direction (`DISABLE`) is a modification\n* and stays managed-only. Keying on the actual delta (not just the expected\n* bit) keeps this correct if a second table attribute ever joins\n* `isEqualTo`: a not-equal with no `rlsEnabled` delta is not enablement, so\n* it is not admitted as creation-class here.\n*/\nfunction isEnablementCreationIssue(issue) {\n\tif (issueOutcome(issue) !== \"not-equal\") return false;\n\tconst { expected, actual } = issue;\n\treturn expected !== void 0 && actual !== void 0 && PostgresTableSchemaNode.is(expected) && PostgresTableSchemaNode.is(actual) && expected.rlsEnabled === true && actual.rlsEnabled === false;\n}\nfunction resolvePostgresNodeIssueCreationFactoryName(issue) {\n\tif (isEnablementCreationIssue(issue)) return \"enableRowLevelSecurity\";\n\tif (issueOutcome(issue) !== \"not-found\") return void 0;\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\treturn POSTGRES_NODE_CREATION_FACTORY[node.nodeKind];\n}\n/**\n* Resolves the control-policy subject for a node-typed {@link SchemaDiffIssue}\n* (the issue-side mirror of `resolvePostgresCallControlPolicySubject`).\n* Storage entities resolve off their node coordinate; a sub-entity issue\n* resolves off the enclosing table read from the issue path; an unclaimed\n* extra falls back to the unbound coordinate. A role always resolves\n* `'external'` — roles are referenced, never owned.\n*/\nfunction resolvePostgresNodeIssueControlPolicySubject(issue, contract) {\n\tconst node = issue.expected ?? issue.actual;\n\tif (node === void 0) return void 0;\n\tif (node.nodeKind === PostgresSchemaNodeKind.namespace) return {\n\t\tnamespaceId: resolveNamespaceIdForDdlSchema(contract, blindCast(node).schemaName),\n\t\tcreatesNewObject: issueOutcome(issue) === \"not-found\"\n\t};\n\tif (node.nodeKind === PostgresSchemaNodeKind.role) {\n\t\tconst roleName = issue.path[1];\n\t\treturn {\n\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\texplicitNodeControlPolicy: (roleName === void 0 ? void 0 : entityAt(contract.storage, {\n\t\t\t\tnamespaceId: UNBOUND_NAMESPACE_ID,\n\t\t\t\tentityKind: \"role\",\n\t\t\t\tentityName: roleName\n\t\t\t}))?.control ?? \"external\",\n\t\t\tcreatesNewObject: false\n\t\t};\n\t}\n\tconst coordinate = postgresNodeStorageCoordinate(node);\n\tif (coordinate !== void 0) {\n\t\tconst namespaceId = resolveNamespaceIdForEntity(contract, coordinate, issue.path[1]);\n\t\tconst entityControl = entityAt(contract.storage, {\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t})?.control;\n\t\treturn {\n\t\t\tnamespaceId,\n\t\t\t...coordinate,\n\t\t\t...ifDefined(\"column\", issueColumnName(issue)),\n\t\t\t...ifDefined(\"explicitNodeControlPolicy\", entityControl),\n\t\t\tcreatesNewObject: resolvePostgresNodeIssueCreationFactoryName(issue) !== void 0\n\t\t};\n\t}\n\tconst tableName = issue.path[2];\n\tif (tableName === void 0) return void 0;\n\tconst ddlSchemaName = issue.path[1];\n\tconst namespaceId = resolveNamespaceIdForTable(contract, tableName, ddlSchemaName);\n\tconst table = entityAt(contract.storage, {\n\t\tnamespaceId,\n\t\tentityKind: \"table\",\n\t\tentityName: tableName\n\t});\n\treturn {\n\t\tnamespaceId,\n\t\tentityKind: \"table\",\n\t\tentityName: tableName,\n\t\t...ifDefined(\"column\", issueColumnName(issue)),\n\t\t...ifDefined(\"explicitNodeControlPolicy\", table?.control),\n\t\tcreatesNewObject: resolvePostgresNodeIssueCreationFactoryName(issue) !== void 0\n\t};\n}\n//#endregion\nexport { resolvePostgresNodeIssueCreationFactoryName as a, issueNode as c, postgresPlannerStrategies as d, postgresNodeStorageCoordinate as f, resolvePostgresNodeIssueControlPolicySubject as i, issueSchemaName as l, resolveNamespaceIdForDdlSchema as n, coalesceSubtreeIssues as o, resolvePostgresCallControlPolicySubject as r, conflictForDisallowedCall as s, renderPostgresSuppression as t, planIssues as u };\n\n//# sourceMappingURL=control-policy-DXaIsgUW.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAS,8BAA8B,MAAM;CAC5C,IAAI,wBAAwB,GAAG,IAAI,GAAG;EACrC,MAAM,aAAa,uBAAuB,KAAK,QAAQ;EACvD,OAAO,eAAe,KAAK,IAAI,KAAK,IAAI;GACvC;GACA,YAAY,KAAK;EAClB;CACD;CACA,IAAI,6BAA6B,GAAG,IAAI,GAAG;EAC1C,MAAM,aAAa,uBAAuB,KAAK,QAAQ;EACvD,OAAO,eAAe,KAAK,IAAI,KAA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./planner-target-details-CUEF0s90-COTks5yz.mjs";
1
2
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
3
+ import { requiredColumnMeta } from "@prisma/orm-family-sql/family/control";
2
4
  import { errorDataTransformContractMismatch } from "@prisma/orm-framework/errors/migration";
3
- //#region ../../../3-targets/3-targets/postgres/dist/data-transform-Bo32KRbq.mjs
5
+ //#region ../../../3-targets/3-targets/postgres/dist/data-transform-CtHnNYhF.mjs
4
6
  async function dataTransform(contract, name, options, adapter) {
5
7
  const runClosures = Array.isArray(options.run) ? options.run : [options.run];
6
8
  const checkPlan = options.check ? await invokeAndLower(options.check, contract, adapter, name) : null;
@@ -15,17 +17,22 @@ async function dataTransform(contract, name, options, adapter) {
15
17
  sql: plan.sql,
16
18
  params: plan.params ?? []
17
19
  }));
20
+ const { backfillsColumn } = options;
18
21
  const postcheck = checkPlan ? [{
19
22
  description: `Verify ${name} resolved all violations`,
20
23
  sql: `SELECT NOT EXISTS (${checkPlan.sql}) AS ok`,
21
- params: checkPlan.params ?? []
24
+ params: checkPlan.params ?? [],
25
+ ...ifDefined("meta", backfillsColumn && requiredColumnMeta(backfillsColumn.table, backfillsColumn.column, "backfillMissedRows"))
22
26
  }] : [];
23
27
  return {
24
28
  id: `data_migration.${name}`,
25
29
  label: `Data transform: ${name}`,
26
30
  operationClass: "data",
27
31
  ...ifDefined("invariantId", options.invariantId),
28
- target: { id: "postgres" },
32
+ target: {
33
+ id: "postgres",
34
+ ...ifDefined("details", backfillsColumn && buildTargetDetails("column", backfillsColumn.column, backfillsColumn.schema, backfillsColumn.table))
35
+ },
29
36
  precheck,
30
37
  execute,
31
38
  postcheck
@@ -50,4 +57,4 @@ function assertContractMatches(plan, contract, name) {
50
57
  //#endregion
51
58
  export { dataTransform as t };
52
59
 
53
- //# sourceMappingURL=data-transform-Bo32KRbq-BLn1_UG-.mjs.map
60
+ //# sourceMappingURL=data-transform-CtHnNYhF-r19375h3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-transform-CtHnNYhF-r19375h3.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/data-transform-CtHnNYhF.mjs"],"sourcesContent":["import { t as buildTargetDetails } from \"./planner-target-details-CUEF0s90.mjs\";\nimport { requiredColumnMeta } from \"@internal/family-sql/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { errorDataTransformContractMismatch } from \"@internal/errors/migration\";\n//#region src/core/migrations/operations/data-transform.ts\nasync function dataTransform(contract, name, options, adapter) {\n\tconst runClosures = Array.isArray(options.run) ? options.run : [options.run];\n\tconst checkPlan = options.check ? await invokeAndLower(options.check, contract, adapter, name) : null;\n\tconst runPlans = await Promise.all(runClosures.map((closure) => invokeAndLower(closure, contract, adapter, name)));\n\tconst precheck = checkPlan ? [{\n\t\tdescription: `Check ${name} has work to do`,\n\t\tsql: `SELECT EXISTS (${checkPlan.sql}) AS ok`,\n\t\tparams: checkPlan.params ?? []\n\t}] : [];\n\tconst execute = runPlans.map((plan) => ({\n\t\tdescription: `Run ${name}`,\n\t\tsql: plan.sql,\n\t\tparams: plan.params ?? []\n\t}));\n\tconst { backfillsColumn } = options;\n\tconst postcheck = checkPlan ? [{\n\t\tdescription: `Verify ${name} resolved all violations`,\n\t\tsql: `SELECT NOT EXISTS (${checkPlan.sql}) AS ok`,\n\t\tparams: checkPlan.params ?? [],\n\t\t...ifDefined(\"meta\", backfillsColumn && requiredColumnMeta(backfillsColumn.table, backfillsColumn.column, \"backfillMissedRows\"))\n\t}] : [];\n\treturn {\n\t\tid: `data_migration.${name}`,\n\t\tlabel: `Data transform: ${name}`,\n\t\toperationClass: \"data\",\n\t\t...ifDefined(\"invariantId\", options.invariantId),\n\t\ttarget: {\n\t\t\tid: \"postgres\",\n\t\t\t...ifDefined(\"details\", backfillsColumn && buildTargetDetails(\"column\", backfillsColumn.column, backfillsColumn.schema, backfillsColumn.table))\n\t\t},\n\t\tprecheck,\n\t\texecute,\n\t\tpostcheck\n\t};\n}\nasync function invokeAndLower(closure, contract, adapter, name) {\n\tconst result = closure();\n\tconst plan = isBuildable(result) ? result.build() : result;\n\tassertContractMatches(plan, contract, name);\n\treturn adapter.lowerToExecuteRequest(plan.ast, { contract });\n}\nfunction isBuildable(value) {\n\treturn typeof value === \"object\" && value !== null && \"build\" in value && typeof Reflect.get(value, \"build\") === \"function\";\n}\nfunction assertContractMatches(plan, contract, name) {\n\tif (plan.meta.storageHash !== contract.storage.storageHash) throw errorDataTransformContractMismatch({\n\t\tdataTransformName: name,\n\t\texpected: contract.storage.storageHash,\n\t\tactual: plan.meta.storageHash\n\t});\n}\n//#endregion\nexport { dataTransform as t };\n\n//# sourceMappingURL=data-transform-CtHnNYhF.mjs.map"],"mappings":";;;;;AAKA,eAAe,cAAc,UAAU,MAAM,SAAS,SAAS;CAC9D,MAAM,cAAc,MAAM,QAAQ,QAAQ,GAAG,IAAI,QAAQ,MAAM,CAAC,QAAQ,GAAG;CAC3E,MAAM,YAAY,QAAQ,QAAQ,MAAM,eAAe,QAAQ,OAAO,UAAU,SAAS,IAAI,IAAI;CACjG,MAAM,WAAW,MAAM,QAAQ,IAAI,YAAY,KAAK,YAAY,eAAe,SAAS,UAAU,SAAS,IAAI,CAAC,CAAC;CACjH,MAAM,WAAW,YAAY,CAAC;EAC7B,aAAa,SAAS,KAAK;EAC3B,KAAK,kBAAkB,UAAU,IAAI;EACrC,QAAQ,UAAU,UAAU,CAAC;CAC9B,CAAC,IAAI,CAAC;CACN,MAAM,UAAU,SAAS,KAAK,UAAU;EACvC,aAAa,OAAO;EACpB,KAAK,KAAK;EACV,QAAQ,KAAK,UAAU,CAAC;CACzB,EAAE;CACF,MAAM,EAAE,oBAAoB;CAC5B,MAAM,YAAY,YAAY,CAAC;EAC9B,aAAa,UAAU,KAAK;EAC5B,KAAK,sBAAsB,UAAU,IAAI;EACzC,QAAQ,UAAU,UAAU,CAAC;EAC7B,GAAG,UAAU,QAAQ,mBAAmB,mBAAmB,gBAAgB,OAAO,gBAAgB,QAAQ,oBAAoB,CAAC;CAChI,CAAC,IAAI,CAAC;CACN,OAAO;EACN,IAAI,kBAAkB;EACtB,OAAO,mBAAmB;EAC1B,gBAAgB;EAChB,GAAG,UAAU,eAAe,QAAQ,WAAW;EAC/C,QAAQ;GACP,IAAI;GACJ,GAAG,UAAU,WAAW,mBAAmB,mBAAmB,UAAU,gBAAgB,QAAQ,gBAAgB,QAAQ,gBAAgB,KAAK,CAAC;EAC/I;EACA;EACA;EACA;CACD;AACD;AACA,eAAe,eAAe,SAAS,UAAU,SAAS,MAAM;CAC/D,MAAM,SAAS,QAAQ;CACvB,MAAM,OAAO,YAAY,MAAM,IAAI,OAAO,MAAM,IAAI;CACpD,sBAAsB,MAAM,UAAU,IAAI;CAC1C,OAAO,QAAQ,sBAAsB,KAAK,KAAK,EAAE,SAAS,CAAC;AAC5D;AACA,SAAS,YAAY,OAAO;CAC3B,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,WAAW,SAAS,OAAO,QAAQ,IAAI,OAAO,OAAO,MAAM;AAClH;AACA,SAAS,sBAAsB,MAAM,UAAU,MAAM;CACpD,IAAI,KAAK,KAAK,gBAAgB,SAAS,QAAQ,aAAa,MAAM,mCAAmC;EACpG,mBAAmB;EACnB,UAAU,SAAS,QAAQ;EAC3B,QAAQ,KAAK,KAAK;CACnB,CAAC;AACF"}
@@ -4,7 +4,7 @@ import { SqlMigrationPlanOperation } from "@prisma/orm-family-sql/family/control
4
4
  import { Contract } from "@prisma/orm-framework/contract/types";
5
5
  import { SqlControlAdapter } from "@prisma/orm-family-sql/family/control-adapter";
6
6
  import { SqlQueryPlan } from "@prisma/orm-family-sql/relational-core/plan";
7
- //#region ../../../3-targets/3-targets/postgres/dist/data-transform-Ck5FbyNO.d.mts
7
+ //#region ../../../3-targets/3-targets/postgres/dist/data-transform-nGy9rz87.d.mts
8
8
  //#region src/core/migrations/operations/data-transform.d.ts
9
9
  interface Buildable<R = unknown> {
10
10
  build(): SqlQueryPlan<R>;
@@ -14,6 +14,12 @@ interface Buildable<R = unknown> {
14
14
  * `check` and each `run` entry.
15
15
  */
16
16
  type DataTransformClosure = () => SqlQueryPlan | Buildable;
17
+ /** The column a backfill fills before it becomes required. */
18
+ interface DataTransformColumn {
19
+ readonly schema: string;
20
+ readonly table: string;
21
+ readonly column: string;
22
+ }
17
23
  interface DataTransformOptions {
18
24
  /**
19
25
  * Optional opt-in routing identity. Presence opts the transform into
@@ -31,8 +37,13 @@ interface DataTransformOptions {
31
37
  readonly check?: DataTransformClosure;
32
38
  /** One or more mutation queries to execute. */
33
39
  readonly run: DataTransformClosure | readonly DataTransformClosure[];
40
+ /**
41
+ * The column the transform fills before a later operation makes it required. When `check` still
42
+ * finds rows after `run`, the failure counts the rows the column holds NULL in.
43
+ */
44
+ readonly backfillsColumn?: DataTransformColumn;
34
45
  }
35
46
  declare function dataTransform<TContract extends Contract<SqlStorage>>(contract: TContract, name: string, options: DataTransformOptions, adapter: SqlControlAdapter<'postgres'>): Promise<SqlMigrationPlanOperation<PostgresPlanTargetDetails>>;
36
47
  //#endregion
37
- export { DataTransformOptions as n, dataTransform as r, DataTransformClosure as t };
38
- //# sourceMappingURL=data-transform-Ck5FbyNO-BNE7QlAo.d.mts.map
48
+ export { dataTransform as i, DataTransformColumn as n, DataTransformOptions as r, DataTransformClosure as t };
49
+ //# sourceMappingURL=data-transform-nGy9rz87-CEOXAj91.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-transform-nGy9rz87-CEOXAj91.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/data-transform-nGy9rz87.d.mts"],"mappings":";;;;;;;;UAOU,UAAU;EAClB,SAAS,aAAa;;;;;;KAMnB,6BAA6B,eAAe;;UAEvC;WACC;WACA;WACA;;UAED;;;;;;WAMC;;;;;;;;WAQA,QAAQ;;WAER,KAAK,gCAAgC;;;;;WAKrC,kBAAkB;;iBAEZ,cAAc,kBAAkB,SAAS,aAAa,UAAU,WAAW,cAAc,SAAS,sBAAsB,SAAS,gCAAgC,QAAQ,0BAA0B"}
@@ -1,8 +1,8 @@
1
- import { _ as pgInt8, g as pgInt4, h as pgInt2, i as pgBool, w as pgText, x as pgNumeric, y as pgJson } from "./data-types-DRkmmE9S-C5Q9oH4Q.mjs";
1
+ import { _ as pgInt8, g as pgInt4, h as pgInt2, i as pgBool, w as pgText, x as pgNumeric, y as pgJson } from "./data-types-K6tDhu1D-BN--9o1o.mjs";
2
2
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
3
3
  import { numeralText } from "@prisma/orm-family-sql/contract/data-type";
4
4
  import { createNumberClassifier, parseJsonText, printJsonText, signedRange } from "@prisma/orm-family-sql/contract/data-type-support";
5
- //#region ../../../3-targets/3-targets/postgres/dist/data-type-entries-DoR61yeO.mjs
5
+ //#region ../../../3-targets/3-targets/postgres/dist/data-type-entries-15a-vBdm.mjs
6
6
  /**
7
7
  * PostgreSQL's own rule for a written number: a whole number takes the narrowest of `int2`, `int4`
8
8
  * and `int8` that holds it, and anything else — a larger whole number, a number with a fraction, or
@@ -99,4 +99,4 @@ function postgresDataTypeEntries() {
99
99
  //#endregion
100
100
  export { postgresDataTypeEntries as t };
101
101
 
102
- //# sourceMappingURL=data-type-entries-DoR61yeO-BB2cY7rI.mjs.map
102
+ //# sourceMappingURL=data-type-entries-15a-vBdm-vIj5l1u5.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-type-entries-DoR61yeO-BB2cY7rI.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/data-type-entries-DoR61yeO.mjs"],"sourcesContent":["import { _ as pgInt8, g as pgInt4, h as pgInt2, i as pgBool, w as pgText, x as pgNumeric, y as pgJson } from \"./data-types-DRkmmE9S.mjs\";\nimport { numeralText } from \"@internal/sql-contract/data-type\";\nimport { createNumberClassifier, parseJsonText, printJsonText, signedRange } from \"@internal/sql-contract/data-type-support\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/core/data-type-entries.ts\n/**\n* PostgreSQL's own rule for a written number: a whole number takes the narrowest of `int2`, `int4`\n* and `int8` that holds it, and anything else — a larger whole number, a number with a fraction, or\n* one of the three words — is a `numeric`.\n*/\nconst classifyPostgresNumber = createNumberClassifier({\n\tintegers: [\n\t\t{\n\t\t\ttype: pgInt2.id,\n\t\t\tform: \"number\",\n\t\t\t...signedRange(16)\n\t\t},\n\t\t{\n\t\t\ttype: pgInt4.id,\n\t\t\tform: \"number\",\n\t\t\t...signedRange(32)\n\t\t},\n\t\t{\n\t\t\ttype: pgInt8.id,\n\t\t\tform: \"text\",\n\t\t\t...signedRange(64)\n\t\t}\n\t],\n\tlargerWhole: {\n\t\ttype: pgNumeric.id,\n\t\tform: \"text\"\n\t},\n\tfraction: {\n\t\ttype: pgNumeric.id,\n\t\tform: \"text\"\n\t},\n\twords: {\n\t\ttype: pgNumeric.id,\n\t\tform: \"text\"\n\t}\n});\nfunction readBoolean(text) {\n\tif (text === \"true\" || text === \"false\") return text === \"true\";\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `\"${text}\" is not a boolean.`, {\n\t\twhy: \"The only text a boolean reads is true or false.\",\n\t\tfix: \"Use true or false.\"\n\t});\n}\n/** The text of a number-shaped stored value: a number written out, or text taken as it stands. */\nfunction printNumber(value) {\n\treturn typeof value === \"number\" ? numeralText(value) : String(value);\n}\nfunction postgresDataTypeEntries() {\n\treturn {\n\t\t[pgText.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"string\",\n\t\t\t\tparse: (text) => text\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"Text.\"\n\t\t},\n\t\t[pgBool.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"boolean\",\n\t\t\t\tparse: readBoolean\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"A boolean, written true or false.\"\n\t\t},\n\t\t[pgNumeric.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"number\",\n\t\t\t\ttypes: [\n\t\t\t\t\tpgInt2.id,\n\t\t\t\t\tpgInt4.id,\n\t\t\t\t\tpgInt8.id,\n\t\t\t\t\tpgNumeric.id\n\t\t\t\t],\n\t\t\t\tclassify: classifyPostgresNumber\n\t\t\t},\n\t\t\tprint: printNumber,\n\t\t\tdocumentation: \"A number, whose type comes from its own size and precision.\"\n\t\t},\n\t\t[pgJson.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"json\",\n\t\t\t\tparse: parseJsonText\n\t\t\t},\n\t\t\tprint: printJsonText,\n\t\t\tdocumentation: \"Reads the text as a JSON document and stores it as the default value.\"\n\t\t}\n\t};\n}\n//#endregion\nexport { postgresDataTypeEntries as t };\n\n//# sourceMappingURL=data-type-entries-DoR61yeO.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,yBAAyB,uBAAuB;CACrD,UAAU;EACT;GACC,MAAM,OAAO;GACb,MAAM;GACN,GAAG,YAAY,EAAE;EAClB;EACA;GACC,MAAM,OAAO;GACb,MAAM;GACN,GAAG,YAAY,EAAE;EAClB;EACA;GACC,MAAM,OAAO;GACb,MAAM;GACN,GAAG,YAAY,EAAE;EAClB;CACD;CACA,aAAa;EACZ,MAAM,UAAU;EAChB,MAAM;CACP;CACA,UAAU;EACT,MAAM,UAAU;EAChB,MAAM;CACP;CACA,OAAO;EACN,MAAM,UAAU;EAChB,MAAM;CACP;AACD,CAAC;AACD,SAAS,YAAY,MAAM;CAC1B,IAAI,SAAS,UAAU,SAAS,SAAS,OAAO,SAAS;CACzD,MAAM,gBAAgB,yBAAyB,IAAI,KAAK,sBAAsB;EAC7E,KAAK;EACL,KAAK;CACN,CAAC;AACF;;AAEA,SAAS,YAAY,OAAO;CAC3B,OAAO,OAAO,UAAU,WAAW,YAAY,KAAK,IAAI,OAAO,KAAK;AACrE;AACA,SAAS,0BAA0B;CAClC,OAAO;GACL,OAAO,KAAK;GACZ,SAAS;IACR,MAAM;IACN,QAAQ;IACR,QAAQ,SAAS;GAClB;GACA,QAAQ,UAAU,OAAO,KAAK;GAC9B,eAAe;EAChB;GACC,OAAO,KAAK;GACZ,SAAS;IACR,MAAM;IACN,QAAQ;IACR,OAAO;GACR;GACA,QAAQ,UAAU,OAAO,KAAK;GAC9B,eAAe;EAChB;GACC,UAAU,KAAK;GACf,SAAS;IACR,MAAM;IACN,QAAQ;IACR,OAAO;KACN,OAAO;KACP,OAAO;KACP,OAAO;KACP,UAAU;IACX;IACA,UAAU;GACX;GACA,OAAO;GACP,eAAe;EAChB;GACC,OAAO,KAAK;GACZ,SAAS;IACR,MAAM;IACN,KAAK;IACL,OAAO;GACR;GACA,OAAO;GACP,eAAe;EAChB;CACD;AACD"}
1
+ {"version":3,"file":"data-type-entries-15a-vBdm-vIj5l1u5.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/data-type-entries-15a-vBdm.mjs"],"sourcesContent":["import { _ as pgInt8, g as pgInt4, h as pgInt2, i as pgBool, w as pgText, x as pgNumeric, y as pgJson } from \"./data-types-K6tDhu1D.mjs\";\nimport { numeralText } from \"@internal/sql-contract/data-type\";\nimport { createNumberClassifier, parseJsonText, printJsonText, signedRange } from \"@internal/sql-contract/data-type-support\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/core/data-type-entries.ts\n/**\n* PostgreSQL's own rule for a written number: a whole number takes the narrowest of `int2`, `int4`\n* and `int8` that holds it, and anything else — a larger whole number, a number with a fraction, or\n* one of the three words — is a `numeric`.\n*/\nconst classifyPostgresNumber = createNumberClassifier({\n\tintegers: [\n\t\t{\n\t\t\ttype: pgInt2.id,\n\t\t\tform: \"number\",\n\t\t\t...signedRange(16)\n\t\t},\n\t\t{\n\t\t\ttype: pgInt4.id,\n\t\t\tform: \"number\",\n\t\t\t...signedRange(32)\n\t\t},\n\t\t{\n\t\t\ttype: pgInt8.id,\n\t\t\tform: \"text\",\n\t\t\t...signedRange(64)\n\t\t}\n\t],\n\tlargerWhole: {\n\t\ttype: pgNumeric.id,\n\t\tform: \"text\"\n\t},\n\tfraction: {\n\t\ttype: pgNumeric.id,\n\t\tform: \"text\"\n\t},\n\twords: {\n\t\ttype: pgNumeric.id,\n\t\tform: \"text\"\n\t}\n});\nfunction readBoolean(text) {\n\tif (text === \"true\" || text === \"false\") return text === \"true\";\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `\"${text}\" is not a boolean.`, {\n\t\twhy: \"The only text a boolean reads is true or false.\",\n\t\tfix: \"Use true or false.\"\n\t});\n}\n/** The text of a number-shaped stored value: a number written out, or text taken as it stands. */\nfunction printNumber(value) {\n\treturn typeof value === \"number\" ? numeralText(value) : String(value);\n}\nfunction postgresDataTypeEntries() {\n\treturn {\n\t\t[pgText.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"string\",\n\t\t\t\tparse: (text) => text\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"Text.\"\n\t\t},\n\t\t[pgBool.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"boolean\",\n\t\t\t\tparse: readBoolean\n\t\t\t},\n\t\t\tprint: (value) => String(value),\n\t\t\tdocumentation: \"A boolean, written true or false.\"\n\t\t},\n\t\t[pgNumeric.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"plain\",\n\t\t\t\tsyntax: \"number\",\n\t\t\t\ttypes: [\n\t\t\t\t\tpgInt2.id,\n\t\t\t\t\tpgInt4.id,\n\t\t\t\t\tpgInt8.id,\n\t\t\t\t\tpgNumeric.id\n\t\t\t\t],\n\t\t\t\tclassify: classifyPostgresNumber\n\t\t\t},\n\t\t\tprint: printNumber,\n\t\t\tdocumentation: \"A number, whose type comes from its own size and precision.\"\n\t\t},\n\t\t[pgJson.id]: {\n\t\t\twritten: {\n\t\t\t\tkind: \"tag\",\n\t\t\t\ttag: \"json\",\n\t\t\t\tparse: parseJsonText\n\t\t\t},\n\t\t\tprint: printJsonText,\n\t\t\tdocumentation: \"Reads the text as a JSON document and stores it as the default value.\"\n\t\t}\n\t};\n}\n//#endregion\nexport { postgresDataTypeEntries as t };\n\n//# sourceMappingURL=data-type-entries-15a-vBdm.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,yBAAyB,uBAAuB;CACrD,UAAU;EACT;GACC,MAAM,OAAO;GACb,MAAM;GACN,GAAG,YAAY,EAAE;EAClB;EACA;GACC,MAAM,OAAO;GACb,MAAM;GACN,GAAG,YAAY,EAAE;EAClB;EACA;GACC,MAAM,OAAO;GACb,MAAM;GACN,GAAG,YAAY,EAAE;EAClB;CACD;CACA,aAAa;EACZ,MAAM,UAAU;EAChB,MAAM;CACP;CACA,UAAU;EACT,MAAM,UAAU;EAChB,MAAM;CACP;CACA,OAAO;EACN,MAAM,UAAU;EAChB,MAAM;CACP;AACD,CAAC;AACD,SAAS,YAAY,MAAM;CAC1B,IAAI,SAAS,UAAU,SAAS,SAAS,OAAO,SAAS;CACzD,MAAM,gBAAgB,yBAAyB,IAAI,KAAK,sBAAsB;EAC7E,KAAK;EACL,KAAK;CACN,CAAC;AACF;;AAEA,SAAS,YAAY,OAAO;CAC3B,OAAO,OAAO,UAAU,WAAW,YAAY,KAAK,IAAI,OAAO,KAAK;AACrE;AACA,SAAS,0BAA0B;CAClC,OAAO;GACL,OAAO,KAAK;GACZ,SAAS;IACR,MAAM;IACN,QAAQ;IACR,QAAQ,SAAS;GAClB;GACA,QAAQ,UAAU,OAAO,KAAK;GAC9B,eAAe;EAChB;GACC,OAAO,KAAK;GACZ,SAAS;IACR,MAAM;IACN,QAAQ;IACR,OAAO;GACR;GACA,QAAQ,UAAU,OAAO,KAAK;GAC9B,eAAe;EAChB;GACC,UAAU,KAAK;GACf,SAAS;IACR,MAAM;IACN,QAAQ;IACR,OAAO;KACN,OAAO;KACP,OAAO;KACP,OAAO;KACP,UAAU;IACX;IACA,UAAU;GACX;GACA,OAAO;GACP,eAAe;EAChB;GACC,OAAO,KAAK;GACZ,SAAS;IACR,MAAM;IACN,KAAK;IACL,OAAO;GACR;GACA,OAAO;GACP,eAAe;EAChB;CACD;AACD"}
@@ -1,11 +1,11 @@
1
1
  import { S as pgIntervalCanonical, c as fitsFloat4, f as pgByteaCanonical, i as canonicalUuid, r as canonicalInet } from "./codec-helpers-D0ah5Wb8-wdJJZ_8s.mjs";
2
- import { r as quoteIdentifier } from "./sql-utils-CVsvXiX4-C7xD0Bgv.mjs";
2
+ import { i as quoteIdentifier } from "./sql-utils-Df-nf6eM-Ov1KgjWm.mjs";
3
3
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
4
4
  import { assembleDataTypes, isNonFiniteText } from "@prisma/orm-framework/components/codec";
5
5
  import { numeralText, sqlDataType } from "@prisma/orm-family-sql/contract/data-type";
6
6
  import { canonicalDateTime, integerTextCanonicalForm } from "@prisma/orm-family-sql/contract/data-type-support";
7
7
  import { type } from "arktype";
8
- //#region ../../../3-targets/3-targets/postgres/dist/data-types-DRkmmE9S.mjs
8
+ //#region ../../../3-targets/3-targets/postgres/dist/data-types-K6tDhu1D.mjs
9
9
  /** A cast between two types that store the same shape: the value is already the form this type stores. */
10
10
  const unchanged = (value) => value;
11
11
  function wrongShape(value, expected) {
@@ -372,4 +372,4 @@ function createPostgresBuiltinDataTypeLookup() {
372
372
  //#endregion
373
373
  export { pgTimestamptz as A, pgPrecisionParams as C, pgTimeCanonical as D, pgTime as E, pgUuid as F, pgVarbit as I, pgVarchar as L, pgTimetz as M, pgTimetzCanonical as N, pgTimestamp as O, pgTsquery as P, postgresDataTypes as R, pgNumericParams as S, pgTextArray as T, pgInt8 as _, pgBytea as a, pgJsonb as b, pgDate as c, pgEnumParams as d, pgFloat4 as f, pgInt4 as g, pgInt2 as h, pgBool as i, pgTimestamptzCanonical as j, pgTimestampCanonical as k, pgDateCanonical as l, pgInet as m, pgBit as n, pgChar as o, pgFloat8 as p, pgBitLengthParams as r, pgCharacterLengthParams as s, createPostgresBuiltinDataTypeLookup as t, pgEnum as u, pgInterval as v, pgText as w, pgNumeric as x, pgJson as y };
374
374
 
375
- //# sourceMappingURL=data-types-DRkmmE9S-C5Q9oH4Q.mjs.map
375
+ //# sourceMappingURL=data-types-K6tDhu1D-BN--9o1o.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-types-DRkmmE9S-C5Q9oH4Q.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/data-types-DRkmmE9S.mjs"],"sourcesContent":["import { F as canonicalInet, d as pgByteaCanonical, r as canonicalUuid, s as fitsFloat4, x as pgIntervalCanonical } from \"./codec-helpers-D0ah5Wb8.mjs\";\nimport { r as quoteIdentifier } from \"./sql-utils-CVsvXiX4.mjs\";\nimport { numeralText, sqlDataType } from \"@internal/sql-contract/data-type\";\nimport { canonicalDateTime, integerTextCanonicalForm } from \"@internal/sql-contract/data-type-support\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { assembleDataTypes, isNonFiniteText } from \"@internal/framework-components/codec\";\nimport { type } from \"arktype\";\n//#region src/core/data-types.ts\n/** A cast between two types that store the same shape: the value is already the form this type stores. */\nconst unchanged = (value) => value;\nfunction wrongShape(value, expected) {\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `Expected ${expected}, got ${JSON.stringify(value)}.`, {\n\t\twhy: \"A cast reads the canonical form of the type it takes values of.\",\n\t\tfix: \"Hand the cast a value in the shape its source type stores.\"\n\t});\n}\n/** A whole number as the digit text `int8` and `numeric` store. */\nconst asNumeralText = (value) => typeof value === \"number\" ? numeralText(value) : wrongShape(value, \"a number\");\n/**\n* A number as the floating-point types store it: a JSON number, or one of the three words, which\n* those types keep as text. A magnitude past what a double holds is refused rather than rounded to\n* a word: the database refuses it too, and storing `Infinity` would make a written number\n* indistinguishable from a written `Infinity`.\n*/\nconst asFloat = (value) => {\n\tif (typeof value === \"number\") return value;\n\tif (typeof value !== \"string\") return wrongShape(value, \"a number or numeral text\");\n\tif (isNonFiniteText(value)) return value;\n\tconst converted = Number(value);\n\tif (Number.isFinite(converted)) return converted;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${value} is out of range: no double holds a number that large.`, {\n\t\twhy: \"The floating-point types store a double, which holds magnitudes up to about 1.8e308.\",\n\t\tfix: \"Use a number a double holds, or a numeric column.\"\n\t});\n};\nconst written = (text) => ({\n\ttext,\n\twritten: true\n});\nconst catalog = (text) => ({\n\ttext,\n\tcatalog: true\n});\nconst writtenAndCatalog = (text) => ({\n\ttext,\n\twritten: true,\n\tcatalog: true\n});\nconst claimsOnly = (text) => ({ text });\n/** The precision and scale of `numeric`. PostgreSQL 15 and later take a negative scale and one above the precision. */\nconst pgNumericParams = type({\n\t\"precision?\": \"number.integer >= 1 & number.integer <= 1000\",\n\t\"scale?\": \"number.integer >= -1000 & number.integer <= 1000\"\n}).narrow((params, ctx) => params.scale === void 0 || params.precision !== void 0 || ctx.reject({\n\tpath: [\"scale\"],\n\tmessage: \"scale requires a precision\"\n}));\n/** The length of `char` and `varchar`. */\nconst pgCharacterLengthParams = type({ \"length?\": \"number.integer >= 1 & number.integer <= 10485760\" });\n/** The length of `bit` and `bit varying`. */\nconst pgBitLengthParams = type({ \"length?\": \"number.integer >= 1 & number.integer <= 83886080\" });\n/** The fractional-second precision of the time, timestamp and interval types. */\nconst pgPrecisionParams = type({ \"precision?\": \"number.integer >= 0 & number.integer <= 6\" });\nconst pgEnumParams = type({ typeName: \"string > 0\" });\n/** A type with no parameters that is written and reported by its own name. */\nconst namedOnly = (id, name, casts = {}) => sqlDataType(id, {\n\ttexts: [writtenAndCatalog(name)],\n\tcasts\n});\nconst withDefaultLength = (params) => params.length === void 0 ? {\n\t...params,\n\tlength: 1\n} : params;\nconst pgText = namedOnly(\"pg/text\", \"text\");\nconst pgTextArray = sqlDataType(\"pg/text-array\", {});\n/** The enum's `typeName`: its name in `public` or with no schema, its schema-qualified name elsewhere. */\nfunction qualifiedEnumName(reported) {\n\tconst name = reported.name ?? \"\";\n\treturn reported.schema === void 0 || reported.schema === \"public\" ? name : `${reported.schema}.${name}`;\n}\nconst pgEnum = sqlDataType(\"pg/enum\", {\n\tparams: pgEnumParams,\n\tclaimsKind: \"enum\",\n\trender: ({ typeName }) => {\n\t\tconst dot = typeName.indexOf(\".\");\n\t\treturn dot === -1 ? quoteIdentifier(typeName) : `${quoteIdentifier(typeName.slice(0, dot))}.${quoteIdentifier(typeName.slice(dot + 1))}`;\n\t},\n\tfromReported: (reported) => ({ typeName: qualifiedEnumName(reported) })\n});\nconst pgInt2 = sqlDataType(\"pg/int2\", { texts: [written(\"int2\"), catalog(\"smallint\")] });\nconst pgBool = sqlDataType(\"pg/bool\", { texts: [written(\"bool\"), catalog(\"boolean\")] });\nconst pgJson = namedOnly(\"pg/json\", \"json\");\nconst pgTsquery = namedOnly(\"pg/tsquery\", \"tsquery\");\nconst pgInt4 = sqlDataType(\"pg/int4\", {\n\ttexts: [\n\t\twritten(\"int4\"),\n\t\tcatalog(\"integer\"),\n\t\tclaimsOnly(\"int\")\n\t],\n\tcasts: { [pgInt2.id]: unchanged }\n});\nconst pgInt8 = sqlDataType(\"pg/int8\", {\n\ttexts: [written(\"int8\"), catalog(\"bigint\")],\n\ttoCanonicalForm: integerTextCanonicalForm,\n\tcasts: {\n\t\t[pgInt2.id]: asNumeralText,\n\t\t[pgInt4.id]: asNumeralText\n\t}\n});\nconst pgNumeric = sqlDataType(\"pg/numeric\", {\n\tparams: pgNumericParams,\n\ttexts: [\n\t\twrittenAndCatalog(\"numeric\"),\n\t\twritten(\"numeric({precision})\"),\n\t\twrittenAndCatalog(\"numeric({precision},{scale})\"),\n\t\tclaimsOnly(\"decimal\"),\n\t\tclaimsOnly(\"decimal({precision})\"),\n\t\tclaimsOnly(\"decimal({precision},{scale})\")\n\t],\n\tnormalize: (params) => params.precision !== void 0 && params.scale === void 0 ? {\n\t\t...params,\n\t\tscale: 0\n\t} : params,\n\tcasts: {\n\t\t[pgInt2.id]: asNumeralText,\n\t\t[pgInt4.id]: asNumeralText,\n\t\t[pgInt8.id]: unchanged\n\t}\n});\n/** `float4` stores a single-precision float, so a magnitude past about 3.4e38, or one it would round to 0, does not fit. */\nconst asFloat4 = (value) => {\n\tconst converted = asFloat(value);\n\tif (typeof converted !== \"number\" || fitsFloat4(converted)) return converted;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${converted} is out of range: float4 holds a nonzero magnitude from about 1.4e-45 to 3.4e38.`, {\n\t\twhy: \"float4 stores a single-precision float, which overflows past about 3.4e38 and rounds a magnitude below about 1.4e-45 to 0.\",\n\t\tfix: \"Use a number float4 holds, or a float8 or numeric column.\"\n\t});\n};\nconst floatCastsOf = (cast) => ({\n\t[pgInt2.id]: cast,\n\t[pgInt4.id]: cast,\n\t[pgInt8.id]: cast,\n\t[pgNumeric.id]: cast\n});\nconst pgFloat4 = sqlDataType(\"pg/float4\", {\n\ttexts: [written(\"float4\"), catalog(\"real\")],\n\tcasts: floatCastsOf(asFloat4)\n});\nconst pgFloat8 = sqlDataType(\"pg/float8\", {\n\ttexts: [\n\t\twritten(\"float8\"),\n\t\tcatalog(\"double precision\"),\n\t\tclaimsOnly(\"float\")\n\t],\n\tcasts: floatCastsOf(asFloat)\n});\nconst pgJsonb = namedOnly(\"pg/jsonb\", \"jsonb\", { [pgJson.id]: unchanged });\nconst fromText = { [pgText.id]: unchanged };\nconst pgChar = sqlDataType(\"pg/char\", {\n\tparams: pgCharacterLengthParams,\n\ttexts: [\n\t\twritten(\"character\"),\n\t\twrittenAndCatalog(\"character({length})\"),\n\t\tclaimsOnly(\"char\"),\n\t\tclaimsOnly(\"char({length})\")\n\t],\n\tnormalize: withDefaultLength,\n\tcasts: fromText\n});\nconst pgVarchar = sqlDataType(\"pg/varchar\", {\n\tparams: pgCharacterLengthParams,\n\ttexts: [\n\t\twrittenAndCatalog(\"character varying\"),\n\t\twrittenAndCatalog(\"character varying({length})\"),\n\t\tclaimsOnly(\"varchar\"),\n\t\tclaimsOnly(\"varchar({length})\")\n\t],\n\tcasts: fromText\n});\n/** Text in any form PostgreSQL reads as a UUID, written the way PostgreSQL writes it, so the contract holds the value the database reports. */\nconst asUuid = (value) => {\n\tif (typeof value !== \"string\") return wrongShape(value, \"text\");\n\tconst uuid = canonicalUuid(value);\n\tif (uuid !== void 0) return uuid;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${JSON.stringify(value)} is not a UUID: PostgreSQL reads 32 hexadecimal digits, with a hyphen after any group of four and optionally in braces.`, {\n\t\twhy: \"A uuid column takes only text PostgreSQL reads as a UUID.\",\n\t\tfix: \"Write a UUID such as a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11.\"\n\t});\n};\nconst pgUuid = sqlDataType(\"pg/uuid\", {\n\ttexts: [writtenAndCatalog(\"uuid\")],\n\tcasts: { [pgText.id]: asUuid }\n});\nconst pgBit = sqlDataType(\"pg/bit\", {\n\tparams: pgBitLengthParams,\n\ttexts: [written(\"bit\"), writtenAndCatalog(\"bit({length})\")],\n\tnormalize: withDefaultLength,\n\tcasts: fromText\n});\nconst pgVarbit = sqlDataType(\"pg/varbit\", {\n\tparams: pgBitLengthParams,\n\ttexts: [\n\t\twrittenAndCatalog(\"bit varying\"),\n\t\twrittenAndCatalog(\"bit varying({length})\"),\n\t\tclaimsOnly(\"varbit\"),\n\t\tclaimsOnly(\"varbit({length})\")\n\t],\n\tcasts: fromText\n});\nconst POSTGRES_YEAR = /^(\\d{4,6})(-.*?)( BC)?$/;\n/**\n* Text PostgreSQL prints, in ISO 8601. A year with a ` BC` suffix becomes the ISO year, one higher\n* than its negative, so 1 BC is 0000 and 44 BC is -000043. A year of five or six digits becomes a\n* signed six-digit year. 0 BC does not exist, so it stays as written and the reader refuses it.\n*/\nfunction isoFromPostgresText(text) {\n\tconst match = POSTGRES_YEAR.exec(text);\n\tif (match === null) return text;\n\tconst [, digits = \"\", rest = \"\", bc] = match;\n\tconst year = Number(digits);\n\tif (bc !== void 0) {\n\t\tif (year === 0) return text;\n\t\tconst astronomical = 1 - year;\n\t\treturn astronomical === 0 ? `0000${rest}` : `-${String(-astronomical).padStart(6, \"0\")}${rest}`;\n\t}\n\treturn digits.length > 4 ? `+${String(year).padStart(6, \"0\")}${rest}` : text;\n}\nconst INFINITIES = /* @__PURE__ */ new Set([\"infinity\", \"-infinity\"]);\n/**\n* The canonical form of a date or time type (ADR 254), from ISO 8601 or the text PostgreSQL prints.\n* `infinity` and `-infinity` are values of the types that hold them.\n*/\nfunction postgresDateTime(options, holdsInfinity) {\n\treturn (text) => holdsInfinity && INFINITIES.has(text) ? text : canonicalDateTime(isoFromPostgresText(text), options, text);\n}\n/**\n* Each range is what PostgreSQL and every codec of the type hold: PostgreSQL starts at 4714-11-24\n* BC, and the `Temporal` and `Date` codecs end at +275760-09-13.\n*/\nconst pgDateCanonical = postgresDateTime({\n\tshape: \"date\",\n\townerId: \"pg/date\",\n\trange: {\n\t\tearliest: \"-004713-11-24\",\n\t\tlatest: \"+275760-09-13\"\n\t}\n}, true);\nconst pgTimeCanonical = postgresDateTime({\n\tshape: \"time\",\n\townerId: \"pg/time\"\n}, false);\nconst pgTimetzCanonical = postgresDateTime({\n\tshape: \"timeWithOffset\",\n\townerId: \"pg/timetz\",\n\tmaxOffsetHours: 15\n}, false);\nconst pgTimestampCanonical = postgresDateTime({\n\tshape: \"dateTime\",\n\townerId: \"pg/timestamp\",\n\trange: {\n\t\tearliest: \"-004713-11-24T00:00:00\",\n\t\tlatest: \"+275760-09-13T23:59:59.999999\"\n\t}\n}, true);\nconst pgTimestamptzCanonical = postgresDateTime({\n\tshape: \"instant\",\n\townerId: \"pg/timestamptz\",\n\trange: {\n\t\tearliest: \"-004713-11-24T00:00:00Z\",\n\t\tlatest: \"+275760-09-13T00:00:00Z\"\n\t}\n}, true);\n/** The canonical-form function of a type whose values are written as text. */\nconst canonicalFromText = (canonical) => (value) => typeof value === \"string\" ? canonical(value) : wrongShape(value, \"text\");\n/** A type whose canonical form reads text: that canonical form, and the same function as its cast from text. */\nfunction typeCanonicalFromText(id, canonical, spec) {\n\tconst toCanonicalForm = canonicalFromText(canonical);\n\treturn sqlDataType(id, {\n\t\t...spec,\n\t\ttoCanonicalForm,\n\t\tcasts: { [pgText.id]: toCanonicalForm }\n\t});\n}\nconst pgTimetz = typeCanonicalFromText(\"pg/timetz\", pgTimetzCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"timetz\"),\n\t\twritten(\"timetz({precision})\"),\n\t\tcatalog(\"time with time zone\"),\n\t\tcatalog(\"time({precision}) with time zone\")\n\t]\n});\nconst pgInterval = typeCanonicalFromText(\"pg/interval\", pgIntervalCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [writtenAndCatalog(\"interval\"), writtenAndCatalog(\"interval({precision})\")]\n});\nconst pgBytea = typeCanonicalFromText(\"pg/bytea\", pgByteaCanonical, { texts: [writtenAndCatalog(\"bytea\")] });\n/** Text PostgreSQL reads as an IP address, written the way PostgreSQL writes it, so the contract holds the value the database reports. */\nfunction pgInetCanonical(text) {\n\tconst inet = canonicalInet(text);\n\tif (inet !== void 0) return inet;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${JSON.stringify(text)} is not an IP address: PostgreSQL reads an IPv4 address in decimal octets or an IPv6 address in hexadecimal groups, either optionally followed by / and a prefix length.`, {\n\t\twhy: \"An inet column takes only text PostgreSQL reads as an IP address.\",\n\t\tfix: \"Write an address such as 192.168.0.1 or 2001:db8::1/64.\"\n\t});\n}\nconst pgInet = typeCanonicalFromText(\"pg/inet\", pgInetCanonical, { texts: [writtenAndCatalog(\"inet\")] });\nconst pgDate = typeCanonicalFromText(\"pg/date\", pgDateCanonical, { texts: [writtenAndCatalog(\"date\")] });\nconst pgTime = typeCanonicalFromText(\"pg/time\", pgTimeCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"time\"),\n\t\twritten(\"time({precision})\"),\n\t\tcatalog(\"time without time zone\"),\n\t\tcatalog(\"time({precision}) without time zone\")\n\t]\n});\nconst pgTimestamp = typeCanonicalFromText(\"pg/timestamp\", pgTimestampCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"timestamp\"),\n\t\twritten(\"timestamp({precision})\"),\n\t\tcatalog(\"timestamp without time zone\"),\n\t\tcatalog(\"timestamp({precision}) without time zone\")\n\t]\n});\nconst pgTimestamptz = typeCanonicalFromText(\"pg/timestamptz\", pgTimestamptzCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"timestamptz\"),\n\t\twritten(\"timestamptz({precision})\"),\n\t\tcatalog(\"timestamp with time zone\"),\n\t\tcatalog(\"timestamp({precision}) with time zone\")\n\t]\n});\n/** Every data type this target registers. */\nconst postgresDataTypes = [\n\tpgText,\n\tpgTextArray,\n\tpgEnum,\n\tpgInt2,\n\tpgBool,\n\tpgJson,\n\tpgTsquery,\n\tpgInt4,\n\tpgInt8,\n\tpgNumeric,\n\tpgFloat4,\n\tpgFloat8,\n\tpgJsonb,\n\tpgChar,\n\tpgVarchar,\n\tpgUuid,\n\tpgInet,\n\tpgBit,\n\tpgVarbit,\n\tpgTimetz,\n\tpgInterval,\n\tpgBytea,\n\tpgDate,\n\tpgTime,\n\tpgTimestamp,\n\tpgTimestamptz\n];\n/** A lookup of the data types this target registers. */\nfunction createPostgresBuiltinDataTypeLookup() {\n\treturn assembleDataTypes([{\n\t\tid: \"postgres\",\n\t\tdataTypes: postgresDataTypes\n\t}]).lookup;\n}\n//#endregion\nexport { pgTimestamptz as A, pgPrecisionParams as C, pgTimeCanonical as D, pgTime as E, pgUuid as F, pgVarbit as I, pgVarchar as L, pgTimetz as M, pgTimetzCanonical as N, pgTimestamp as O, pgTsquery as P, postgresDataTypes as R, pgNumericParams as S, pgTextArray as T, pgInt8 as _, pgBytea as a, pgJsonb as b, pgDate as c, pgEnumParams as d, pgFloat4 as f, pgInt4 as g, pgInt2 as h, pgBool as i, pgTimestamptzCanonical as j, pgTimestampCanonical as k, pgDateCanonical as l, pgInet as m, pgBit as n, pgChar as o, pgFloat8 as p, pgBitLengthParams as r, pgCharacterLengthParams as s, createPostgresBuiltinDataTypeLookup as t, pgEnum as u, pgInterval as v, pgText as w, pgNumeric as x, pgJson as y };\n\n//# sourceMappingURL=data-types-DRkmmE9S.mjs.map"],"mappings":";;;;;;;;;AASA,MAAM,aAAa,UAAU;AAC7B,SAAS,WAAW,OAAO,UAAU;CACpC,MAAM,gBAAgB,yBAAyB,YAAY,SAAS,QAAQ,KAAK,UAAU,KAAK,EAAE,IAAI;EACrG,KAAK;EACL,KAAK;CACN,CAAC;AACF;;AAEA,MAAM,iBAAiB,UAAU,OAAO,UAAU,WAAW,YAAY,KAAK,IAAI,WAAW,OAAO,UAAU;;;;;;;AAO9G,MAAM,WAAW,UAAU;CAC1B,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,OAAO,UAAU,UAAU,OAAO,WAAW,OAAO,0BAA0B;CAClF,IAAI,gBAAgB,KAAK,GAAG,OAAO;CACnC,MAAM,YAAY,OAAO,KAAK;CAC9B,IAAI,OAAO,SAAS,SAAS,GAAG,OAAO;CACvC,MAAM,gBAAgB,yBAAyB,GAAG,MAAM,yDAAyD;EAChH,KAAK;EACL,KAAK;CACN,CAAC;AACF;AACA,MAAM,WAAW,UAAU;CAC1B;CACA,SAAS;AACV;AACA,MAAM,WAAW,UAAU;CAC1B;CACA,SAAS;AACV;AACA,MAAM,qBAAqB,UAAU;CACpC;CACA,SAAS;CACT,SAAS;AACV;AACA,MAAM,cAAc,UAAU,EAAE,KAAK;;AAErC,MAAM,kBAAkB,KAAK;CAC5B,cAAc;CACd,UAAU;AACX,CAAC,CAAC,CAAC,QAAQ,QAAQ,QAAQ,OAAO,UAAU,KAAK,KAAK,OAAO,cAAc,KAAK,KAAK,IAAI,OAAO;CAC/F,MAAM,CAAC,OAAO;CACd,SAAS;AACV,CAAC,CAAC;;AAEF,MAAM,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,kBAAkB,wBAAwB;CACrF,QAAQ;CACR,OAAO;EACN,QAAQ,aAAa;EACrB,QAAQ,0BAA0B;EAClC,QAAQ,0BAA0B;EAClC,QAAQ,uCAAuC;CAChD;AACD,CAAC;;AAED,MAAM,oBAAoB;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAEA,SAAS,sCAAsC;CAC9C,OAAO,kBAAkB,CAAC;EACzB,IAAI;EACJ,WAAW;CACZ,CAAC,CAAC,CAAC,CAAC;AACL"}
1
+ {"version":3,"file":"data-types-K6tDhu1D-BN--9o1o.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/data-types-K6tDhu1D.mjs"],"sourcesContent":["import { F as canonicalInet, d as pgByteaCanonical, r as canonicalUuid, s as fitsFloat4, x as pgIntervalCanonical } from \"./codec-helpers-D0ah5Wb8.mjs\";\nimport { i as quoteIdentifier } from \"./sql-utils-Df-nf6eM.mjs\";\nimport { numeralText, sqlDataType } from \"@internal/sql-contract/data-type\";\nimport { canonicalDateTime, integerTextCanonicalForm } from \"@internal/sql-contract/data-type-support\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { assembleDataTypes, isNonFiniteText } from \"@internal/framework-components/codec\";\nimport { type } from \"arktype\";\n//#region src/core/data-types.ts\n/** A cast between two types that store the same shape: the value is already the form this type stores. */\nconst unchanged = (value) => value;\nfunction wrongShape(value, expected) {\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `Expected ${expected}, got ${JSON.stringify(value)}.`, {\n\t\twhy: \"A cast reads the canonical form of the type it takes values of.\",\n\t\tfix: \"Hand the cast a value in the shape its source type stores.\"\n\t});\n}\n/** A whole number as the digit text `int8` and `numeric` store. */\nconst asNumeralText = (value) => typeof value === \"number\" ? numeralText(value) : wrongShape(value, \"a number\");\n/**\n* A number as the floating-point types store it: a JSON number, or one of the three words, which\n* those types keep as text. A magnitude past what a double holds is refused rather than rounded to\n* a word: the database refuses it too, and storing `Infinity` would make a written number\n* indistinguishable from a written `Infinity`.\n*/\nconst asFloat = (value) => {\n\tif (typeof value === \"number\") return value;\n\tif (typeof value !== \"string\") return wrongShape(value, \"a number or numeral text\");\n\tif (isNonFiniteText(value)) return value;\n\tconst converted = Number(value);\n\tif (Number.isFinite(converted)) return converted;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${value} is out of range: no double holds a number that large.`, {\n\t\twhy: \"The floating-point types store a double, which holds magnitudes up to about 1.8e308.\",\n\t\tfix: \"Use a number a double holds, or a numeric column.\"\n\t});\n};\nconst written = (text) => ({\n\ttext,\n\twritten: true\n});\nconst catalog = (text) => ({\n\ttext,\n\tcatalog: true\n});\nconst writtenAndCatalog = (text) => ({\n\ttext,\n\twritten: true,\n\tcatalog: true\n});\nconst claimsOnly = (text) => ({ text });\n/** The precision and scale of `numeric`. PostgreSQL 15 and later take a negative scale and one above the precision. */\nconst pgNumericParams = type({\n\t\"precision?\": \"number.integer >= 1 & number.integer <= 1000\",\n\t\"scale?\": \"number.integer >= -1000 & number.integer <= 1000\"\n}).narrow((params, ctx) => params.scale === void 0 || params.precision !== void 0 || ctx.reject({\n\tpath: [\"scale\"],\n\tmessage: \"scale requires a precision\"\n}));\n/** The length of `char` and `varchar`. */\nconst pgCharacterLengthParams = type({ \"length?\": \"number.integer >= 1 & number.integer <= 10485760\" });\n/** The length of `bit` and `bit varying`. */\nconst pgBitLengthParams = type({ \"length?\": \"number.integer >= 1 & number.integer <= 83886080\" });\n/** The fractional-second precision of the time, timestamp and interval types. */\nconst pgPrecisionParams = type({ \"precision?\": \"number.integer >= 0 & number.integer <= 6\" });\nconst pgEnumParams = type({ typeName: \"string > 0\" });\n/** A type with no parameters that is written and reported by its own name. */\nconst namedOnly = (id, name, casts = {}) => sqlDataType(id, {\n\ttexts: [writtenAndCatalog(name)],\n\tcasts\n});\nconst withDefaultLength = (params) => params.length === void 0 ? {\n\t...params,\n\tlength: 1\n} : params;\nconst pgText = namedOnly(\"pg/text\", \"text\");\nconst pgTextArray = sqlDataType(\"pg/text-array\", {});\n/** The enum's `typeName`: its name in `public` or with no schema, its schema-qualified name elsewhere. */\nfunction qualifiedEnumName(reported) {\n\tconst name = reported.name ?? \"\";\n\treturn reported.schema === void 0 || reported.schema === \"public\" ? name : `${reported.schema}.${name}`;\n}\nconst pgEnum = sqlDataType(\"pg/enum\", {\n\tparams: pgEnumParams,\n\tclaimsKind: \"enum\",\n\trender: ({ typeName }) => {\n\t\tconst dot = typeName.indexOf(\".\");\n\t\treturn dot === -1 ? quoteIdentifier(typeName) : `${quoteIdentifier(typeName.slice(0, dot))}.${quoteIdentifier(typeName.slice(dot + 1))}`;\n\t},\n\tfromReported: (reported) => ({ typeName: qualifiedEnumName(reported) })\n});\nconst pgInt2 = sqlDataType(\"pg/int2\", { texts: [written(\"int2\"), catalog(\"smallint\")] });\nconst pgBool = sqlDataType(\"pg/bool\", { texts: [written(\"bool\"), catalog(\"boolean\")] });\nconst pgJson = namedOnly(\"pg/json\", \"json\");\nconst pgTsquery = namedOnly(\"pg/tsquery\", \"tsquery\");\nconst pgInt4 = sqlDataType(\"pg/int4\", {\n\ttexts: [\n\t\twritten(\"int4\"),\n\t\tcatalog(\"integer\"),\n\t\tclaimsOnly(\"int\")\n\t],\n\tcasts: { [pgInt2.id]: unchanged }\n});\nconst pgInt8 = sqlDataType(\"pg/int8\", {\n\ttexts: [written(\"int8\"), catalog(\"bigint\")],\n\ttoCanonicalForm: integerTextCanonicalForm,\n\tcasts: {\n\t\t[pgInt2.id]: asNumeralText,\n\t\t[pgInt4.id]: asNumeralText\n\t}\n});\nconst pgNumeric = sqlDataType(\"pg/numeric\", {\n\tparams: pgNumericParams,\n\ttexts: [\n\t\twrittenAndCatalog(\"numeric\"),\n\t\twritten(\"numeric({precision})\"),\n\t\twrittenAndCatalog(\"numeric({precision},{scale})\"),\n\t\tclaimsOnly(\"decimal\"),\n\t\tclaimsOnly(\"decimal({precision})\"),\n\t\tclaimsOnly(\"decimal({precision},{scale})\")\n\t],\n\tnormalize: (params) => params.precision !== void 0 && params.scale === void 0 ? {\n\t\t...params,\n\t\tscale: 0\n\t} : params,\n\tcasts: {\n\t\t[pgInt2.id]: asNumeralText,\n\t\t[pgInt4.id]: asNumeralText,\n\t\t[pgInt8.id]: unchanged\n\t}\n});\n/** `float4` stores a single-precision float, so a magnitude past about 3.4e38, or one it would round to 0, does not fit. */\nconst asFloat4 = (value) => {\n\tconst converted = asFloat(value);\n\tif (typeof converted !== \"number\" || fitsFloat4(converted)) return converted;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${converted} is out of range: float4 holds a nonzero magnitude from about 1.4e-45 to 3.4e38.`, {\n\t\twhy: \"float4 stores a single-precision float, which overflows past about 3.4e38 and rounds a magnitude below about 1.4e-45 to 0.\",\n\t\tfix: \"Use a number float4 holds, or a float8 or numeric column.\"\n\t});\n};\nconst floatCastsOf = (cast) => ({\n\t[pgInt2.id]: cast,\n\t[pgInt4.id]: cast,\n\t[pgInt8.id]: cast,\n\t[pgNumeric.id]: cast\n});\nconst pgFloat4 = sqlDataType(\"pg/float4\", {\n\ttexts: [written(\"float4\"), catalog(\"real\")],\n\tcasts: floatCastsOf(asFloat4)\n});\nconst pgFloat8 = sqlDataType(\"pg/float8\", {\n\ttexts: [\n\t\twritten(\"float8\"),\n\t\tcatalog(\"double precision\"),\n\t\tclaimsOnly(\"float\")\n\t],\n\tcasts: floatCastsOf(asFloat)\n});\nconst pgJsonb = namedOnly(\"pg/jsonb\", \"jsonb\", { [pgJson.id]: unchanged });\nconst fromText = { [pgText.id]: unchanged };\nconst pgChar = sqlDataType(\"pg/char\", {\n\tparams: pgCharacterLengthParams,\n\ttexts: [\n\t\twritten(\"character\"),\n\t\twrittenAndCatalog(\"character({length})\"),\n\t\tclaimsOnly(\"char\"),\n\t\tclaimsOnly(\"char({length})\")\n\t],\n\tnormalize: withDefaultLength,\n\tcasts: fromText\n});\nconst pgVarchar = sqlDataType(\"pg/varchar\", {\n\tparams: pgCharacterLengthParams,\n\ttexts: [\n\t\twrittenAndCatalog(\"character varying\"),\n\t\twrittenAndCatalog(\"character varying({length})\"),\n\t\tclaimsOnly(\"varchar\"),\n\t\tclaimsOnly(\"varchar({length})\")\n\t],\n\tcasts: fromText\n});\n/** Text in any form PostgreSQL reads as a UUID, written the way PostgreSQL writes it, so the contract holds the value the database reports. */\nconst asUuid = (value) => {\n\tif (typeof value !== \"string\") return wrongShape(value, \"text\");\n\tconst uuid = canonicalUuid(value);\n\tif (uuid !== void 0) return uuid;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${JSON.stringify(value)} is not a UUID: PostgreSQL reads 32 hexadecimal digits, with a hyphen after any group of four and optionally in braces.`, {\n\t\twhy: \"A uuid column takes only text PostgreSQL reads as a UUID.\",\n\t\tfix: \"Write a UUID such as a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11.\"\n\t});\n};\nconst pgUuid = sqlDataType(\"pg/uuid\", {\n\ttexts: [writtenAndCatalog(\"uuid\")],\n\tcasts: { [pgText.id]: asUuid }\n});\nconst pgBit = sqlDataType(\"pg/bit\", {\n\tparams: pgBitLengthParams,\n\ttexts: [written(\"bit\"), writtenAndCatalog(\"bit({length})\")],\n\tnormalize: withDefaultLength,\n\tcasts: fromText\n});\nconst pgVarbit = sqlDataType(\"pg/varbit\", {\n\tparams: pgBitLengthParams,\n\ttexts: [\n\t\twrittenAndCatalog(\"bit varying\"),\n\t\twrittenAndCatalog(\"bit varying({length})\"),\n\t\tclaimsOnly(\"varbit\"),\n\t\tclaimsOnly(\"varbit({length})\")\n\t],\n\tcasts: fromText\n});\nconst POSTGRES_YEAR = /^(\\d{4,6})(-.*?)( BC)?$/;\n/**\n* Text PostgreSQL prints, in ISO 8601. A year with a ` BC` suffix becomes the ISO year, one higher\n* than its negative, so 1 BC is 0000 and 44 BC is -000043. A year of five or six digits becomes a\n* signed six-digit year. 0 BC does not exist, so it stays as written and the reader refuses it.\n*/\nfunction isoFromPostgresText(text) {\n\tconst match = POSTGRES_YEAR.exec(text);\n\tif (match === null) return text;\n\tconst [, digits = \"\", rest = \"\", bc] = match;\n\tconst year = Number(digits);\n\tif (bc !== void 0) {\n\t\tif (year === 0) return text;\n\t\tconst astronomical = 1 - year;\n\t\treturn astronomical === 0 ? `0000${rest}` : `-${String(-astronomical).padStart(6, \"0\")}${rest}`;\n\t}\n\treturn digits.length > 4 ? `+${String(year).padStart(6, \"0\")}${rest}` : text;\n}\nconst INFINITIES = /* @__PURE__ */ new Set([\"infinity\", \"-infinity\"]);\n/**\n* The canonical form of a date or time type (ADR 254), from ISO 8601 or the text PostgreSQL prints.\n* `infinity` and `-infinity` are values of the types that hold them.\n*/\nfunction postgresDateTime(options, holdsInfinity) {\n\treturn (text) => holdsInfinity && INFINITIES.has(text) ? text : canonicalDateTime(isoFromPostgresText(text), options, text);\n}\n/**\n* Each range is what PostgreSQL and every codec of the type hold: PostgreSQL starts at 4714-11-24\n* BC, and the `Temporal` and `Date` codecs end at +275760-09-13.\n*/\nconst pgDateCanonical = postgresDateTime({\n\tshape: \"date\",\n\townerId: \"pg/date\",\n\trange: {\n\t\tearliest: \"-004713-11-24\",\n\t\tlatest: \"+275760-09-13\"\n\t}\n}, true);\nconst pgTimeCanonical = postgresDateTime({\n\tshape: \"time\",\n\townerId: \"pg/time\"\n}, false);\nconst pgTimetzCanonical = postgresDateTime({\n\tshape: \"timeWithOffset\",\n\townerId: \"pg/timetz\",\n\tmaxOffsetHours: 15\n}, false);\nconst pgTimestampCanonical = postgresDateTime({\n\tshape: \"dateTime\",\n\townerId: \"pg/timestamp\",\n\trange: {\n\t\tearliest: \"-004713-11-24T00:00:00\",\n\t\tlatest: \"+275760-09-13T23:59:59.999999\"\n\t}\n}, true);\nconst pgTimestamptzCanonical = postgresDateTime({\n\tshape: \"instant\",\n\townerId: \"pg/timestamptz\",\n\trange: {\n\t\tearliest: \"-004713-11-24T00:00:00Z\",\n\t\tlatest: \"+275760-09-13T00:00:00Z\"\n\t}\n}, true);\n/** The canonical-form function of a type whose values are written as text. */\nconst canonicalFromText = (canonical) => (value) => typeof value === \"string\" ? canonical(value) : wrongShape(value, \"text\");\n/** A type whose canonical form reads text: that canonical form, and the same function as its cast from text. */\nfunction typeCanonicalFromText(id, canonical, spec) {\n\tconst toCanonicalForm = canonicalFromText(canonical);\n\treturn sqlDataType(id, {\n\t\t...spec,\n\t\ttoCanonicalForm,\n\t\tcasts: { [pgText.id]: toCanonicalForm }\n\t});\n}\nconst pgTimetz = typeCanonicalFromText(\"pg/timetz\", pgTimetzCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"timetz\"),\n\t\twritten(\"timetz({precision})\"),\n\t\tcatalog(\"time with time zone\"),\n\t\tcatalog(\"time({precision}) with time zone\")\n\t]\n});\nconst pgInterval = typeCanonicalFromText(\"pg/interval\", pgIntervalCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [writtenAndCatalog(\"interval\"), writtenAndCatalog(\"interval({precision})\")]\n});\nconst pgBytea = typeCanonicalFromText(\"pg/bytea\", pgByteaCanonical, { texts: [writtenAndCatalog(\"bytea\")] });\n/** Text PostgreSQL reads as an IP address, written the way PostgreSQL writes it, so the contract holds the value the database reports. */\nfunction pgInetCanonical(text) {\n\tconst inet = canonicalInet(text);\n\tif (inet !== void 0) return inet;\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", `${JSON.stringify(text)} is not an IP address: PostgreSQL reads an IPv4 address in decimal octets or an IPv6 address in hexadecimal groups, either optionally followed by / and a prefix length.`, {\n\t\twhy: \"An inet column takes only text PostgreSQL reads as an IP address.\",\n\t\tfix: \"Write an address such as 192.168.0.1 or 2001:db8::1/64.\"\n\t});\n}\nconst pgInet = typeCanonicalFromText(\"pg/inet\", pgInetCanonical, { texts: [writtenAndCatalog(\"inet\")] });\nconst pgDate = typeCanonicalFromText(\"pg/date\", pgDateCanonical, { texts: [writtenAndCatalog(\"date\")] });\nconst pgTime = typeCanonicalFromText(\"pg/time\", pgTimeCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"time\"),\n\t\twritten(\"time({precision})\"),\n\t\tcatalog(\"time without time zone\"),\n\t\tcatalog(\"time({precision}) without time zone\")\n\t]\n});\nconst pgTimestamp = typeCanonicalFromText(\"pg/timestamp\", pgTimestampCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"timestamp\"),\n\t\twritten(\"timestamp({precision})\"),\n\t\tcatalog(\"timestamp without time zone\"),\n\t\tcatalog(\"timestamp({precision}) without time zone\")\n\t]\n});\nconst pgTimestamptz = typeCanonicalFromText(\"pg/timestamptz\", pgTimestamptzCanonical, {\n\tparams: pgPrecisionParams,\n\ttexts: [\n\t\twritten(\"timestamptz\"),\n\t\twritten(\"timestamptz({precision})\"),\n\t\tcatalog(\"timestamp with time zone\"),\n\t\tcatalog(\"timestamp({precision}) with time zone\")\n\t]\n});\n/** Every data type this target registers. */\nconst postgresDataTypes = [\n\tpgText,\n\tpgTextArray,\n\tpgEnum,\n\tpgInt2,\n\tpgBool,\n\tpgJson,\n\tpgTsquery,\n\tpgInt4,\n\tpgInt8,\n\tpgNumeric,\n\tpgFloat4,\n\tpgFloat8,\n\tpgJsonb,\n\tpgChar,\n\tpgVarchar,\n\tpgUuid,\n\tpgInet,\n\tpgBit,\n\tpgVarbit,\n\tpgTimetz,\n\tpgInterval,\n\tpgBytea,\n\tpgDate,\n\tpgTime,\n\tpgTimestamp,\n\tpgTimestamptz\n];\n/** A lookup of the data types this target registers. */\nfunction createPostgresBuiltinDataTypeLookup() {\n\treturn assembleDataTypes([{\n\t\tid: \"postgres\",\n\t\tdataTypes: postgresDataTypes\n\t}]).lookup;\n}\n//#endregion\nexport { pgTimestamptz as A, pgPrecisionParams as C, pgTimeCanonical as D, pgTime as E, pgUuid as F, pgVarbit as I, pgVarchar as L, pgTimetz as M, pgTimetzCanonical as N, pgTimestamp as O, pgTsquery as P, postgresDataTypes as R, pgNumericParams as S, pgTextArray as T, pgInt8 as _, pgBytea as a, pgJsonb as b, pgDate as c, pgEnumParams as d, pgFloat4 as f, pgInt4 as g, pgInt2 as h, pgBool as i, pgTimestamptzCanonical as j, pgTimestampCanonical as k, pgDateCanonical as l, pgInet as m, pgBit as n, pgChar as o, pgFloat8 as p, pgBitLengthParams as r, pgCharacterLengthParams as s, createPostgresBuiltinDataTypeLookup as t, pgEnum as u, pgInterval as v, pgText as w, pgNumeric as x, pgJson as y };\n\n//# sourceMappingURL=data-types-K6tDhu1D.mjs.map"],"mappings":";;;;;;;;;AASA,MAAM,aAAa,UAAU;AAC7B,SAAS,WAAW,OAAO,UAAU;CACpC,MAAM,gBAAgB,yBAAyB,YAAY,SAAS,QAAQ,KAAK,UAAU,KAAK,EAAE,IAAI;EACrG,KAAK;EACL,KAAK;CACN,CAAC;AACF;;AAEA,MAAM,iBAAiB,UAAU,OAAO,UAAU,WAAW,YAAY,KAAK,IAAI,WAAW,OAAO,UAAU;;;;;;;AAO9G,MAAM,WAAW,UAAU;CAC1B,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,OAAO,UAAU,UAAU,OAAO,WAAW,OAAO,0BAA0B;CAClF,IAAI,gBAAgB,KAAK,GAAG,OAAO;CACnC,MAAM,YAAY,OAAO,KAAK;CAC9B,IAAI,OAAO,SAAS,SAAS,GAAG,OAAO;CACvC,MAAM,gBAAgB,yBAAyB,GAAG,MAAM,yDAAyD;EAChH,KAAK;EACL,KAAK;CACN,CAAC;AACF;AACA,MAAM,WAAW,UAAU;CAC1B;CACA,SAAS;AACV;AACA,MAAM,WAAW,UAAU;CAC1B;CACA,SAAS;AACV;AACA,MAAM,qBAAqB,UAAU;CACpC;CACA,SAAS;CACT,SAAS;AACV;AACA,MAAM,cAAc,UAAU,EAAE,KAAK;;AAErC,MAAM,kBAAkB,KAAK;CAC5B,cAAc;CACd,UAA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AsB,gBAAgB,sBAAsB;CAC/E,QAAQ;CACR,OAAO;EACN,QAAQ,WAAW;EACnB,QAAQ,wBAAwB;EAChC,QAAQ,6BAA6B;EACrC,QAAQ,0CAA0C;CACnD;AACD,CAAC;AACD,MAAM,gBAAgB,sBAAsB,kBAAkB,wBAAwB;CACrF,QAAQ;CACR,OAAO;EACN,QAAQ,aAAa;EACrB,QAAQ,0BAA0B;EAClC,QAAQ,0BAA0B;EAClC,QAAQ,uCAAuC;CAChD;AACD,CAAC;;AAED,MAAM,oBAAoB;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAEA,SAAS,sCAAsC;CAC9C,OAAO,kBAAkB,CAAC;EACzB,IAAI;EACJ,WAAW;CACZ,CAAC,CAAC,CAAC,CAAC;AACL"}
@@ -1,10 +1,10 @@
1
1
  import { S as PG_TEXT_CODEC_ID, n as PG_BOOL_CODEC_ID } from "./codec-ids-Cb0yO-IS--e0P2rfI.mjs";
2
- import { h as postgresCreateNamespace, l as PostgresTableSource } from "./postgres-schema-DIaAgaL6-Dmqzjbu5.mjs";
2
+ import { h as postgresCreateNamespace, l as PostgresTableSource } from "./postgres-schema-Ysxbqkzr-hFRwS-zT.mjs";
3
3
  import { a as PostgresAlterTable, c as PostgresCreateSchema, f as PostgresDisableRowLevelSecurity, h as PostgresDropType, i as PostgresAlterPolicyRename, l as PostgresCreateTable, m as PostgresDropPolicy, n as DropDefaultAction, o as PostgresCreateIndex, p as PostgresDropIndex, r as PostgresAlterIndexRename, s as PostgresCreatePolicy, t as AddColumnAction, u as PostgresCreateType } from "./nodes-Bm2a7z6e-BXTXyzZv.mjs";
4
4
  import { opaqueSql } from "@prisma/orm-family-sql/relational-core/ast";
5
5
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
6
6
  import { cfExpr, cfTable, exprSelect } from "@prisma/orm-family-sql/relational-core/contract-free";
7
- //#region ../../../3-targets/3-targets/postgres/dist/ddl-CFWv3VOT.mjs
7
+ //#region ../../../3-targets/3-targets/postgres/dist/ddl-BKqbtVN3.mjs
8
8
  /**
9
9
  * `to_regclass($1)` with the qualified table name bound as a text parameter.
10
10
  * Thin vocabulary wrapper over the core `cfExpr.fn` helper — the target
@@ -449,4 +449,4 @@ function disableRowLevelSecurity(options) {
449
449
  //#endregion
450
450
  export { tableIsEmptyAst as A, nativeEnumTypeExistsAst as C, rlsPolicyExistsAst as D, rlsEnabledAst as E, toRegclass as M, sequenceNameAvailableAst as O, indexExistsAst as S, noNullValuesAst as T, dropDefaultAction as _, columnDefaultAst as a, dropType as b, columnNullabilityAst as c, createIndex as d, createPolicy as f, disableRowLevelSecurity as g, createType as h, alterTable as i, tablePrimaryKeyAst as j, tableExistsAst as k, columnTypeAst as l, createTable as m, alterIndexRename as n, columnDefaultSequenceAst as o, createSchema as p, alterPolicyRename as r, columnExistsAst as s, addColumnAction as t, constraintExistsAst as u, dropIndex as v, nativeEnumValueExistsAst as w, extensionExistsAst as x, dropPolicy as y };
451
451
 
452
- //# sourceMappingURL=ddl-CFWv3VOT-Ad-I5p22.mjs.map
452
+ //# sourceMappingURL=ddl-BKqbtVN3-CPHiYaCY.mjs.map