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

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 (151) hide show
  1. package/dist/{adapter-CEEGgfaS-4MeZ7odP.mjs → adapter-fu5NLR5q-BGMHGbUv.mjs} +4 -4
  2. package/dist/{adapter-CEEGgfaS-4MeZ7odP.mjs.map → adapter-fu5NLR5q-BGMHGbUv.mjs.map} +1 -1
  3. package/dist/adapter.d.mts +2 -2
  4. package/dist/adapter.mjs +6 -6
  5. package/dist/adapter__adapter.mjs +1 -1
  6. package/dist/adapter__column-types.d.mts +2 -2
  7. package/dist/adapter__column-types.mjs +2 -2
  8. package/dist/adapter__control.mjs +78 -12
  9. package/dist/adapter__control.mjs.map +1 -1
  10. package/dist/adapter__runtime.mjs +23 -14
  11. package/dist/adapter__runtime.mjs.map +1 -1
  12. package/dist/adapter__sql-renderer.mjs +1 -1
  13. package/dist/{aggregates-Dh6HPdvC.mjs → aggregates-Ckjhz1o7.mjs} +15 -10
  14. package/dist/aggregates-Ckjhz1o7.mjs.map +1 -0
  15. package/dist/{authoring-BOpdZa2N-ClrLFiXw.mjs → authoring-DayoLvZs-BZzesJbW.mjs} +47 -12
  16. package/dist/authoring-DayoLvZs-BZzesJbW.mjs.map +1 -0
  17. package/dist/{check-expressions-5vhxWaFy-CBcjFeur.mjs → check-expressions-B3Xp6IFg-BzCFYrC9.mjs} +3 -3
  18. package/dist/{check-expressions-5vhxWaFy-CBcjFeur.mjs.map → check-expressions-B3Xp6IFg-BzCFYrC9.mjs.map} +1 -1
  19. package/dist/codec-ids-CmcC76hX-C0JIyoua.d.mts +39 -0
  20. package/dist/codec-ids-CmcC76hX-C0JIyoua.d.mts.map +1 -0
  21. package/dist/codec-ids-D3ZEAmt2-DjoKUAas.mjs +39 -0
  22. package/dist/codec-ids-D3ZEAmt2-DjoKUAas.mjs.map +1 -0
  23. package/dist/codec-ids-cWPqrkcF.d.mts +1 -0
  24. package/dist/{codec-types-BRU4F-7t-BaJbKF_i.d.mts → codec-types-X0ENu4sQ-C6GS_WDR.d.mts} +21 -9
  25. package/dist/codec-types-X0ENu4sQ-C6GS_WDR.d.mts.map +1 -0
  26. package/dist/codec-types-Zel4Dk7S.d.mts +2 -0
  27. package/dist/{codecs-BmPCJWqb-DveZGJvm.mjs → codecs-CxWg7WrX-DtVAuuXA.mjs} +351 -255
  28. package/dist/codecs-CxWg7WrX-DtVAuuXA.mjs.map +1 -0
  29. package/dist/{codecs-B1HgsJZ2.mjs → codecs-DZMfLjGe.mjs} +2 -2
  30. package/dist/codecs-DZMfLjGe.mjs.map +1 -0
  31. package/dist/{codecs-D8tLswBi-_nbo-Z8x.d.mts → codecs-bwX5JaME-ByuPNLC5.d.mts} +146 -86
  32. package/dist/codecs-bwX5JaME-ByuPNLC5.d.mts.map +1 -0
  33. package/dist/{codecs-DmCKO7dg.d.mts → codecs-ePpDWH7z.d.mts} +2 -2
  34. package/dist/codecs-ePpDWH7z.d.mts.map +1 -0
  35. package/dist/{column-types-BH-MU6uU.d.mts → column-types-CwjYfNCi.d.mts} +33 -7
  36. package/dist/column-types-CwjYfNCi.d.mts.map +1 -0
  37. package/dist/{column-types-Bh92dNjD.mjs → column-types-DU7C_gwa.mjs} +37 -9
  38. package/dist/column-types-DU7C_gwa.mjs.map +1 -0
  39. package/dist/{contract-free-aQ4nT-_R.mjs → contract-free-CzTZEwpt.mjs} +5 -5
  40. package/dist/contract-free-CzTZEwpt.mjs.map +1 -0
  41. package/dist/{control-2F195jJk.d.mts → control-ByalKcpe.d.mts} +2 -1
  42. package/dist/control-ByalKcpe.d.mts.map +1 -0
  43. package/dist/{control-V7OkAC55.mjs → control-CwOI5ZH9.mjs} +8 -8
  44. package/dist/control-CwOI5ZH9.mjs.map +1 -0
  45. package/dist/{control-adapter-DGLvLCp7-DaglJOfk.mjs → control-adapter-BvycZgCj-DH90lxuD.mjs} +9 -9
  46. package/dist/control-adapter-BvycZgCj-DH90lxuD.mjs.map +1 -0
  47. package/dist/{control-policy-B53lnBCT-B9K9Cj1x.mjs → control-policy-HgW6zNnz-Ds9U3rSS.mjs} +6 -6
  48. package/dist/{control-policy-B53lnBCT-B9K9Cj1x.mjs.map → control-policy-HgW6zNnz-Ds9U3rSS.mjs.map} +1 -1
  49. package/dist/{ddl-CNQJds-C-WfZ3y4y8.mjs → ddl-GXbCrKp_-CBKFkq1r.mjs} +4 -4
  50. package/dist/{ddl-CNQJds-C-WfZ3y4y8.mjs.map → ddl-GXbCrKp_-CBKFkq1r.mjs.map} +1 -1
  51. package/dist/{descriptor-meta-KVX21fsl-DBDoB4eg.mjs → descriptor-meta-BJvQzm-A-BdYGq2QU.mjs} +50 -21
  52. package/dist/descriptor-meta-BJvQzm-A-BdYGq2QU.mjs.map +1 -0
  53. package/dist/{descriptor-meta-rilAH3ep-dAmiVLpe.mjs → descriptor-meta-DInZZgUC-Cq-SJvwE.mjs} +6 -6
  54. package/dist/{descriptor-meta-rilAH3ep-dAmiVLpe.mjs.map → descriptor-meta-DInZZgUC-Cq-SJvwE.mjs.map} +1 -1
  55. package/dist/{diff-database-schema-DKq76rCk-uehceHYz.mjs → diff-database-schema-B27W13mM-DmRNUFyg.mjs} +6 -6
  56. package/dist/{diff-database-schema-DKq76rCk-uehceHYz.mjs.map → diff-database-schema-B27W13mM-DmRNUFyg.mjs.map} +1 -1
  57. package/dist/driver.mjs +1 -1
  58. package/dist/driver__runtime.mjs +1 -1
  59. package/dist/{errors-CU4xIwwk.d.mts → errors-5fMq0U66.d.mts} +2 -2
  60. package/dist/{errors-CU4xIwwk.d.mts.map → errors-5fMq0U66.d.mts.map} +1 -1
  61. package/dist/errors-DYyzTYzE-39CV_aMo.mjs +92 -0
  62. package/dist/errors-DYyzTYzE-39CV_aMo.mjs.map +1 -0
  63. package/dist/instant-now-generator-lJQqn_8K-JOzseqXI.d.mts +9 -0
  64. package/dist/instant-now-generator-lJQqn_8K-JOzseqXI.d.mts.map +1 -0
  65. package/dist/migration-PTHAY9Cv.mjs.map +1 -1
  66. package/dist/{op-factory-call-H6zeDGLe-_1pAftJk.mjs → op-factory-call-CSkQdszU-C43tr0rP.mjs} +7 -7
  67. package/dist/{op-factory-call-H6zeDGLe-_1pAftJk.mjs.map → op-factory-call-CSkQdszU-C43tr0rP.mjs.map} +1 -1
  68. package/dist/{pack-CySS3DQU.d.mts → pack-DaQJIP6O.d.mts} +143 -11
  69. package/dist/pack-DaQJIP6O.d.mts.map +1 -0
  70. package/dist/{planner-D0uogzvT-1WyGIC5p.mjs → planner-CqeT-P2q-DVglsvwu.mjs} +8 -8
  71. package/dist/{planner-D0uogzvT-1WyGIC5p.mjs.map → planner-CqeT-P2q-DVglsvwu.mjs.map} +1 -1
  72. package/dist/{planner-ddl-builders-Chxh-LEQ-DXvwOeeA.mjs → planner-ddl-builders-CsfmnnKR-CNn0fLyx.mjs} +5 -5
  73. package/dist/{planner-ddl-builders-Chxh-LEQ-DXvwOeeA.mjs.map → planner-ddl-builders-CsfmnnKR-CNn0fLyx.mjs.map} +1 -1
  74. package/dist/{planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs → planner-produced-postgres-migration-Dsri3SjC-DZynrNO-.mjs} +4 -4
  75. package/dist/{planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs.map → planner-produced-postgres-migration-Dsri3SjC-DZynrNO-.mjs.map} +1 -1
  76. package/dist/{planner-sql-checks-ftgzvIO9-BTtBg2Vz.mjs → planner-sql-checks-Bcngv5YZ-Dnp05hSM.mjs} +4 -4
  77. package/dist/{planner-sql-checks-ftgzvIO9-BTtBg2Vz.mjs.map → planner-sql-checks-Bcngv5YZ-Dnp05hSM.mjs.map} +1 -1
  78. package/dist/{postgres-contract-view-B8ykf2cO-T2LvWVFZ.mjs → postgres-contract-view-CzWRnkxb-BpyBv1vn.mjs} +5 -5
  79. package/dist/{postgres-contract-view-B8ykf2cO-T2LvWVFZ.mjs.map → postgres-contract-view-CzWRnkxb-BpyBv1vn.mjs.map} +1 -1
  80. package/dist/{postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs → postgres-migration-DHvU3Jkt-Eah72PD4.mjs} +6 -6
  81. package/dist/{postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs.map → postgres-migration-DHvU3Jkt-Eah72PD4.mjs.map} +1 -1
  82. package/dist/{postgres-schema-CF0yHESb-D7n2X21R.mjs → postgres-schema-B3t7Zr52-CMlY9aGw.mjs} +4 -4
  83. package/dist/{postgres-schema-CF0yHESb-D7n2X21R.mjs.map → postgres-schema-B3t7Zr52-CMlY9aGw.mjs.map} +1 -1
  84. package/dist/{render-ops-DOsRP0Po-BKn_c_Ia.mjs → render-ops-D2vJApKB-B281fzmn.mjs} +3 -3
  85. package/dist/{render-ops-DOsRP0Po-BKn_c_Ia.mjs.map → render-ops-D2vJApKB-B281fzmn.mjs.map} +1 -1
  86. package/dist/{resolve-ddl-schema-CoaeNP35-C-UZldpj.mjs → resolve-ddl-schema-Cab6g5MC-SRco-A7L.mjs} +3 -3
  87. package/dist/{resolve-ddl-schema-CoaeNP35-C-UZldpj.mjs.map → resolve-ddl-schema-Cab6g5MC-SRco-A7L.mjs.map} +1 -1
  88. package/dist/{runtime-C-Hh2m1R.mjs → runtime-BJrfP1e8.mjs} +43 -5
  89. package/dist/runtime-BJrfP1e8.mjs.map +1 -0
  90. package/dist/{runtime-_TfO66h5.d.mts → runtime-bbCw9Omq.d.mts} +2 -1
  91. package/dist/runtime-bbCw9Omq.d.mts.map +1 -0
  92. package/dist/{sql-renderer-ComgusFq-BBlqM1fw.mjs → sql-renderer-ComgusFq-DfvXlBce.mjs} +3 -3
  93. package/dist/{sql-renderer-ComgusFq-BBlqM1fw.mjs.map → sql-renderer-ComgusFq-DfvXlBce.mjs.map} +1 -1
  94. package/dist/{sql-utils-DuzN3JZg-DiXy4Vah.mjs → sql-utils-6j9YTLpr-BCyCBPBg.mjs} +3 -3
  95. package/dist/{sql-utils-DuzN3JZg-DiXy4Vah.mjs.map → sql-utils-6j9YTLpr-BCyCBPBg.mjs.map} +1 -1
  96. package/dist/target.d.mts +12 -11
  97. package/dist/target.mjs +24 -23
  98. package/dist/target__aggregates.mjs +1 -1
  99. package/dist/target__codec-ids.d.mts +3 -3
  100. package/dist/target__codec-ids.mjs +2 -2
  101. package/dist/target__codec-types.d.mts +4 -4
  102. package/dist/target__codecs.d.mts +3 -3
  103. package/dist/target__codecs.mjs +3 -3
  104. package/dist/target__contract-free.mjs +3 -3
  105. package/dist/target__control.d.mts +3 -2
  106. package/dist/target__control.mjs +3 -2
  107. package/dist/target__diff-database-schema.mjs +1 -1
  108. package/dist/target__errors.d.mts +1 -1
  109. package/dist/target__errors.mjs +1 -1
  110. package/dist/target__issue-planner.mjs +1 -1
  111. package/dist/target__migration.mjs +2 -2
  112. package/dist/target__op-factory-call.mjs +1 -1
  113. package/dist/target__pack.d.mts +1 -1
  114. package/dist/target__pack.mjs +1 -1
  115. package/dist/target__planner-ddl-builders.mjs +1 -1
  116. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  117. package/dist/target__planner-sql-checks.mjs +1 -1
  118. package/dist/target__planner.mjs +2 -2
  119. package/dist/target__render-ops.mjs +1 -1
  120. package/dist/target__runtime.d.mts +3 -2
  121. package/dist/target__runtime.mjs +3 -2
  122. package/dist/target__runtime.mjs.map +1 -1
  123. package/dist/target__schema-ir-annotations.mjs +1 -1
  124. package/dist/target__sql-utils.mjs +1 -1
  125. package/dist/target__types.mjs +2 -2
  126. package/package.json +9 -9
  127. package/dist/aggregates-Dh6HPdvC.mjs.map +0 -1
  128. package/dist/authoring-BOpdZa2N-ClrLFiXw.mjs.map +0 -1
  129. package/dist/codec-ids-Bqu_IwO0-DKOdPizQ.d.mts +0 -35
  130. package/dist/codec-ids-Bqu_IwO0-DKOdPizQ.d.mts.map +0 -1
  131. package/dist/codec-ids-C5Rkltkw-DMf87l9s.mjs +0 -35
  132. package/dist/codec-ids-C5Rkltkw-DMf87l9s.mjs.map +0 -1
  133. package/dist/codec-ids-DJ6j6pZc.d.mts +0 -1
  134. package/dist/codec-types-BRU4F-7t-BaJbKF_i.d.mts.map +0 -1
  135. package/dist/codec-types-bX63JRLf.d.mts +0 -2
  136. package/dist/codecs-B1HgsJZ2.mjs.map +0 -1
  137. package/dist/codecs-BmPCJWqb-DveZGJvm.mjs.map +0 -1
  138. package/dist/codecs-D8tLswBi-_nbo-Z8x.d.mts.map +0 -1
  139. package/dist/codecs-DmCKO7dg.d.mts.map +0 -1
  140. package/dist/column-types-BH-MU6uU.d.mts.map +0 -1
  141. package/dist/column-types-Bh92dNjD.mjs.map +0 -1
  142. package/dist/contract-free-aQ4nT-_R.mjs.map +0 -1
  143. package/dist/control-2F195jJk.d.mts.map +0 -1
  144. package/dist/control-V7OkAC55.mjs.map +0 -1
  145. package/dist/control-adapter-DGLvLCp7-DaglJOfk.mjs.map +0 -1
  146. package/dist/descriptor-meta-KVX21fsl-DBDoB4eg.mjs.map +0 -1
  147. package/dist/errors-DKjQzNaN-DFcF1thx.mjs +0 -39
  148. package/dist/errors-DKjQzNaN-DFcF1thx.mjs.map +0 -1
  149. package/dist/pack-CySS3DQU.d.mts.map +0 -1
  150. package/dist/runtime-C-Hh2m1R.mjs.map +0 -1
  151. package/dist/runtime-_TfO66h5.d.mts.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import { t as PostgresRlsPolicy } from "./postgres-rls-policy-CnDxf3z9-C3LIHAIG.mjs";
2
2
  import { a as PostgresRlsEnablementInput, d as postgresCreateNamespace, i as PostgresRlsEnablement, n as PostgresNativeEnum, o as PostgresRole } from "./postgres-schema-Xsjt3RKO-Buv2X8ai.mjs";
3
3
  import { i as postgresRenderCheckExpressions } from "./check-expressions-DRgG8RN5-DiA-22aC.mjs";
4
- import { ot as postgresQualifyColumnType } from "./codecs-D8tLswBi-_nbo-Z8x.mjs";
5
- import { r as CodecTypes } from "./codec-types-BRU4F-7t-BaJbKF_i.mjs";
4
+ import { ot as postgresQualifyColumnType } from "./codecs-bwX5JaME-ByuPNLC5.mjs";
5
+ import { r as CodecTypes } from "./codec-types-X0ENu4sQ-C6GS_WDR.mjs";
6
6
  import { PslExtensionBlock } from "@prisma/orm-framework/components/authoring";
7
7
  import { EntityHandleLoweringInput, LoweredPackEntity, ResolvedPslModelRefs } from "@prisma/orm-family-sql/contract/entity-handle-lowering-hook";
8
8
  //#region ../../../3-targets/3-targets/postgres/dist/pack.d.mts
@@ -139,7 +139,7 @@ declare const postgresTargetDescriptorMetaBase: {
139
139
  readonly dateTime: {
140
140
  readonly kind: "fieldPreset";
141
141
  readonly output: {
142
- readonly codecId: "pg/timestamptz@1";
142
+ readonly codecId: "pg/timestamptz-temporal@1";
143
143
  readonly nativeType: "timestamptz";
144
144
  };
145
145
  };
@@ -164,7 +164,111 @@ declare const postgresTargetDescriptorMetaBase: {
164
164
  readonly optional: true;
165
165
  }];
166
166
  readonly output: {
167
- readonly codecId: "pg/timestamp@1";
167
+ readonly codecId: "pg/timestamp-temporal@1";
168
+ readonly nativeType: "timestamp";
169
+ readonly typeParams: {
170
+ readonly precision: {
171
+ readonly kind: "arg";
172
+ readonly index: 0;
173
+ };
174
+ };
175
+ readonly executionDefaults: {
176
+ readonly onCreate: {
177
+ readonly kind: "select";
178
+ readonly index: 1;
179
+ readonly cases: {
180
+ readonly now: {
181
+ readonly kind: "generator";
182
+ readonly id: "instantNow" | "timestampNow";
183
+ };
184
+ };
185
+ };
186
+ readonly onUpdate: {
187
+ readonly kind: "select";
188
+ readonly index: 2;
189
+ readonly cases: {
190
+ readonly now: {
191
+ readonly kind: "generator";
192
+ readonly id: "instantNow" | "timestampNow";
193
+ };
194
+ };
195
+ };
196
+ };
197
+ };
198
+ };
199
+ readonly timestamptz: {
200
+ readonly kind: "fieldPreset";
201
+ readonly args: readonly [{
202
+ readonly name: "precision";
203
+ readonly kind: "number";
204
+ readonly optional: true;
205
+ readonly integer: true;
206
+ readonly minimum: 0;
207
+ }, {
208
+ readonly name: "onCreate";
209
+ readonly kind: "option";
210
+ readonly values: readonly ["now"];
211
+ readonly optional: true;
212
+ }, {
213
+ readonly name: "onUpdate";
214
+ readonly kind: "option";
215
+ readonly values: readonly ["now"];
216
+ readonly optional: true;
217
+ }];
218
+ readonly output: {
219
+ readonly codecId: "pg/timestamptz-temporal@1";
220
+ readonly nativeType: "timestamptz";
221
+ readonly typeParams: {
222
+ readonly precision: {
223
+ readonly kind: "arg";
224
+ readonly index: 0;
225
+ };
226
+ };
227
+ readonly executionDefaults: {
228
+ readonly onCreate: {
229
+ readonly kind: "select";
230
+ readonly index: 1;
231
+ readonly cases: {
232
+ readonly now: {
233
+ readonly kind: "generator";
234
+ readonly id: "instantNow" | "timestampNow";
235
+ };
236
+ };
237
+ };
238
+ readonly onUpdate: {
239
+ readonly kind: "select";
240
+ readonly index: 2;
241
+ readonly cases: {
242
+ readonly now: {
243
+ readonly kind: "generator";
244
+ readonly id: "instantNow" | "timestampNow";
245
+ };
246
+ };
247
+ };
248
+ };
249
+ };
250
+ };
251
+ readonly timestampString: {
252
+ readonly kind: "fieldPreset";
253
+ readonly args: readonly [{
254
+ readonly name: "precision";
255
+ readonly kind: "number";
256
+ readonly optional: true;
257
+ readonly integer: true;
258
+ readonly minimum: 0;
259
+ }, {
260
+ readonly name: "onCreate";
261
+ readonly kind: "option";
262
+ readonly values: readonly ["now"];
263
+ readonly optional: true;
264
+ }, {
265
+ readonly name: "onUpdate";
266
+ readonly kind: "option";
267
+ readonly values: readonly ["now"];
268
+ readonly optional: true;
269
+ }];
270
+ readonly output: {
271
+ readonly codecId: "pg/timestamp-string@1";
168
272
  readonly nativeType: "timestamp";
169
273
  readonly typeParams: {
170
274
  readonly precision: {
@@ -196,7 +300,7 @@ declare const postgresTargetDescriptorMetaBase: {
196
300
  };
197
301
  };
198
302
  };
199
- readonly timestamptz: {
303
+ readonly timestamptzString: {
200
304
  readonly kind: "fieldPreset";
201
305
  readonly args: readonly [{
202
306
  readonly name: "precision";
@@ -216,7 +320,7 @@ declare const postgresTargetDescriptorMetaBase: {
216
320
  readonly optional: true;
217
321
  }];
218
322
  readonly output: {
219
- readonly codecId: "pg/timestamptz@1";
323
+ readonly codecId: "pg/timestamptz-string@1";
220
324
  readonly nativeType: "timestamptz";
221
325
  readonly typeParams: {
222
326
  readonly precision: {
@@ -248,10 +352,10 @@ declare const postgresTargetDescriptorMetaBase: {
248
352
  };
249
353
  };
250
354
  };
251
- readonly createdAt: {
355
+ readonly createdAtString: {
252
356
  readonly kind: "fieldPreset";
253
357
  readonly output: {
254
- readonly codecId: "pg/timestamptz@1";
358
+ readonly codecId: "pg/timestamptz-string@1";
255
359
  readonly nativeType: "timestamptz";
256
360
  readonly default: {
257
361
  readonly kind: "function";
@@ -259,10 +363,10 @@ declare const postgresTargetDescriptorMetaBase: {
259
363
  };
260
364
  };
261
365
  };
262
- readonly updatedAt: {
366
+ readonly updatedAtString: {
263
367
  readonly kind: "fieldPreset";
264
368
  readonly output: {
265
- readonly codecId: "pg/timestamptz@1";
369
+ readonly codecId: "pg/timestamptz-string@1";
266
370
  readonly nativeType: "timestamptz";
267
371
  readonly executionDefaults: {
268
372
  readonly onCreate: {
@@ -276,6 +380,34 @@ declare const postgresTargetDescriptorMetaBase: {
276
380
  };
277
381
  };
278
382
  };
383
+ readonly createdAt: {
384
+ readonly kind: "fieldPreset";
385
+ readonly output: {
386
+ readonly codecId: "pg/timestamptz-temporal@1";
387
+ readonly nativeType: "timestamptz";
388
+ readonly default: {
389
+ readonly kind: "function";
390
+ readonly expression: "now()";
391
+ };
392
+ };
393
+ };
394
+ readonly updatedAt: {
395
+ readonly kind: "fieldPreset";
396
+ readonly output: {
397
+ readonly codecId: "pg/timestamptz-temporal@1";
398
+ readonly nativeType: "timestamptz";
399
+ readonly executionDefaults: {
400
+ readonly onCreate: {
401
+ readonly kind: "generator";
402
+ readonly id: "instantNow" | "timestampNow";
403
+ };
404
+ readonly onUpdate: {
405
+ readonly kind: "generator";
406
+ readonly id: "instantNow" | "timestampNow";
407
+ };
408
+ };
409
+ };
410
+ };
279
411
  };
280
412
  readonly uuidNative: {
281
413
  readonly kind: "fieldPreset";
@@ -623,4 +755,4 @@ declare const postgresTargetDescriptorMeta: typeof postgresTargetDescriptorMetaB
623
755
  };
624
756
  //#endregion
625
757
  export { postgresTargetDescriptorMeta as t };
626
- //# sourceMappingURL=pack-CySS3DQU.d.mts.map
758
+ //# sourceMappingURL=pack-DaQJIP6O.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-DaQJIP6O.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/pack.d.mts"],"mappings":";;;;;;;;;UAQU,gCAAgC;WAC/B;;;;;;;WAOA,oBAAoB;;;UAGrB,2BAA2B;WAC1B;;;;;;;;;;;;;iBAaM,2BAA2B,OAAO,qCAAqC;;;cAG1E;WACH;WACA,yDAAyD,iBAAiB,uBAAuB;aAC/F;OACN;aACM;OACN;aACM;OACN;aACM;OACN;aACM;OACN;aACM;;WAEF;aACE;eACE;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;;mBAEF;qBACE;;;;;aAKR;eACE;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA;qBACE;qBACA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;qBAEA;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;uBAIN;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;;;;;;;iBAOZ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;uBACA;;;;iBAIN;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;iBAKR;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;uBACA;;;;iBAIN;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;uBAEF;yBACE;yBACA;;;;;;eAMV;iBACE;iBACA;mBACE;mBACA;;;eAGJ;iBACE;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;;;qBAGJ;;;;;aAKR;eACE;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;UACA;;iBAEO;mBACE,UAAU,OAAO,oBAAoB,wDAAwD,2BAA2B;;;eAG5H;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;;iBAEO;mBACE,UAAU,OAAO,+BAA+B;;;eAGpD;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;iBAEO;mBACE,UAAU,OAAO,yBAAyB,wDAAwD,2BAA2B;;;eAGjI;iBACE;iBACA;iBACA,+DAA+D;UACtE;UACA;UACA;UACA;;iBAEO;UACP,UAAU,sCAAsC,mBAAmB,wDAAwD,2BAA2B;UACtJ,iBAAiB,QAAQ;YACvB;YACA;;;;;aAKC;eACE;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;mBACE;qBACE;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;uBACA;uBACA;;;mBAGJ;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;;;iBAGJ;mBACE;mBACA;;;eAGJ;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;mBACE;qBACE;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;uBACA;uBACA;;;mBAGJ;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;;;iBAGJ;mBACE;mBACA;;;eAGJ;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;mBACE;qBACE;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;uBACA;uBACA;;;mBAGJ;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;;;iBAGJ;mBACE;mBACA;;;eAGJ;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;mBACE;qBACE;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;uBACA;uBACA;;;mBAGJ;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;;;iBAGJ;mBACE;mBACA;;;eAGJ;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;mBACE;qBACE;qBACA;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;uBACA;uBACA;;;mBAGJ;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;;;iBAGJ;mBACE;mBACA;;;eAGJ;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;iBACA;;eAEF;iBACE;iBACA;iBACA;iBACA;mBACE;;iBAEF;;;aAGJ;eACE;iBACE;iBACA;iBACA,qCAAqC;iBACrC,QAAQ,SAAS,sBAAsB,wDAAwD;UACtG;UACA,QAAQ;;;;aAIL,wBAAwB;aACxB,0BAA0B;aAC1B,+BAA+B;aAC/B,2BAA2B;;WAE7B;WACA;WACA;WACA;WACA;WACA;WACA,eAAe;;cAEZ,qCAAqC;WACxC,eAAe"}
@@ -1,11 +1,11 @@
1
1
  import { t as DEFAULT_NAMESPACE_ID } from "./namespace-ids-xtp_ZY86-Cpp8PTxD.mjs";
2
- import { d as isPostgresSchema, i as PostgresRlsPolicy } from "./postgres-schema-CF0yHESb-D7n2X21R.mjs";
2
+ import { d as isPostgresSchema, i as PostgresRlsPolicy } from "./postgres-schema-B3t7Zr52-CMlY9aGw.mjs";
3
3
  import { n as PostgresNamespaceSchemaNode, r as PostgresPolicySchemaNode, t as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-B8Z5i5D--PObwlU2Z.mjs";
4
- import { t as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-CoaeNP35-C-UZldpj.mjs";
5
- import { A as RenameIndexCall, T as DropPostgresRlsPolicyCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, p as CreatePostgresRlsPolicyCall } from "./op-factory-call-H6zeDGLe-_1pAftJk.mjs";
6
- import { a as planIssues, c as renderPostgresSuppression, d as resolvePostgresNodeIssueControlPolicySubject, f as resolvePostgresNodeIssueCreationFactoryName, i as issueSchemaName, l as resolveNamespaceIdForDdlSchema, n as conflictForDisallowedCall, o as postgresNodeStorageCoordinate, r as issueNode, s as postgresPlannerStrategies, t as coalesceSubtreeIssues, u as resolvePostgresCallControlPolicySubject } from "./control-policy-B53lnBCT-B9K9Cj1x.mjs";
7
- import { t as buildPostgresPlanDiff } from "./diff-database-schema-DKq76rCk-uehceHYz.mjs";
8
- import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs";
4
+ import { t as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-Cab6g5MC-SRco-A7L.mjs";
5
+ import { A as RenameIndexCall, T as DropPostgresRlsPolicyCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, p as CreatePostgresRlsPolicyCall } from "./op-factory-call-CSkQdszU-C43tr0rP.mjs";
6
+ import { a as planIssues, c as renderPostgresSuppression, d as resolvePostgresNodeIssueControlPolicySubject, f as resolvePostgresNodeIssueCreationFactoryName, i as issueSchemaName, l as resolveNamespaceIdForDdlSchema, n as conflictForDisallowedCall, o as postgresNodeStorageCoordinate, r as issueNode, s as postgresPlannerStrategies, t as coalesceSubtreeIssues, u as resolvePostgresCallControlPolicySubject } from "./control-policy-HgW6zNnz-Ds9U3rSS.mjs";
7
+ import { t as buildPostgresPlanDiff } from "./diff-database-schema-B27W13mM-DmRNUFyg.mjs";
8
+ import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-Dsri3SjC-DZynrNO-.mjs";
9
9
  import { blindCast } from "@prisma/orm-framework/utils/casts";
10
10
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
11
11
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -13,7 +13,7 @@ import { namingOf, parseWireName } from "@prisma/orm-family-sql/schema-ir/naming
13
13
  import { issueOutcome } from "@prisma/orm-framework/components/control";
14
14
  import { controlPolicyForCall, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure } from "@prisma/orm-family-sql/family/control";
15
15
  import { SqlCheckConstraintIR, SqlIndexIR } from "@prisma/orm-family-sql/schema-ir/types";
16
- //#region ../../../3-targets/3-targets/postgres/dist/planner-D0uogzvT.mjs
16
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-CqeT-P2q.mjs
17
17
  /**
18
18
  * Resolves the live-database schema name for a given namespace
19
19
  * coordinate. Mirrors `resolveDdlSchemaForNamespace` in
@@ -668,4 +668,4 @@ function policyNodeToContractPolicy(node) {
668
668
  //#endregion
669
669
  export { createPostgresMigrationPlanner as t };
670
670
 
671
- //# sourceMappingURL=planner-D0uogzvT-1WyGIC5p.mjs.map
671
+ //# sourceMappingURL=planner-CqeT-P2q-DVglsvwu.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-D0uogzvT-1WyGIC5p.mjs","names":["#lowerer"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-D0uogzvT.mjs"],"sourcesContent":["import { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { _ as PostgresRlsPolicy, r as isPostgresSchema } from \"./postgres-schema-CF0yHESb.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { t as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-CoaeNP35.mjs\";\nimport { t as buildPostgresPlanDiff } from \"./diff-database-schema-DKq76rCk.mjs\";\nimport { a as resolvePostgresNodeIssueCreationFactoryName, c as issueNode, d as postgresPlannerStrategies, f as postgresNodeStorageCoordinate, i as resolvePostgresNodeIssueControlPolicySubject, l as issueSchemaName, n as resolveNamespaceIdForDdlSchema, o as coalesceSubtreeIssues, r as resolvePostgresCallControlPolicySubject, s as conflictForDisallowedCall, t as renderPostgresSuppression, u as planIssues } from \"./control-policy-B53lnBCT.mjs\";\nimport { A as RenameIndexCall, T as DropPostgresRlsPolicyCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, p as CreatePostgresRlsPolicyCall } from \"./op-factory-call-H6zeDGLe.mjs\";\nimport { t as TypeScriptRenderablePostgresMigration } from \"./planner-produced-postgres-migration-D5m8nK6s.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { controlPolicyForCall, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure } from \"@internal/family-sql/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { namingOf, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { SqlCheckConstraintIR, SqlIndexIR } from \"@internal/sql-schema-ir/types\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\n//#region src/core/migrations/verify-postgres-namespaces.ts\n/**\n* Resolves the live-database schema name for a given namespace\n* coordinate. Mirrors `resolveDdlSchemaForNamespace` in\n* `planner-strategies.ts` so the verifier's projection and the\n* planner's projection always agree — Postgres-aware namespaces (the\n* production path) dispatch to `ddlSchemaName(storage)`, and bare\n* object payloads (used by some tests) fall back to the coordinate\n* itself.\n*/\nfunction resolveDdlSchemaName(storage, namespaceId) {\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (isPostgresSchema(namespace)) return namespace.ddlSchemaName(storage);\n\treturn namespaceId;\n}\n/**\n* Reads the introspected list of schema names from the database-root schema\n* node. `existingSchemas` is database-level, so it lives on the\n* `PostgresDatabaseSchemaNode` root — not on the per-schema namespace nodes.\n*\n* Defaults to the always-present `public` schema when the node is not the\n* database root — a fresh Postgres database always carries `public` (unless an\n* operator dropped it manually), so any verifier path that runs without an\n* enriched introspection still suppresses the redundant `CREATE SCHEMA\n* \"public\"`.\n*\n* Production introspection (`PostgresControlAdapter.introspect`) is the\n* authoritative source: it queries `pg_namespace` and sets `existingSchemas`\n* on the returned root. Tests that want to assert against a richer initial\n* state construct a `PostgresDatabaseSchemaNode` explicitly.\n*/\nfunction existingSchemasFromSchema(schema) {\n\tif (PostgresDatabaseSchemaNode.is(schema)) return schema.existingSchemas;\n\treturn [DEFAULT_NAMESPACE_ID];\n}\n/**\n* Emits a `postgres-namespace` `not-found` diff issue for every\n* contract-declared Postgres namespace whose live container does not yet\n* exist. The planner prepends these (node-typed, synthesized) to the\n* relational diff issues so a multi-schema plan emits `CREATE SCHEMA`\n* before the tables that need it — a planner-only concern (verify already\n* rejects via the `not-found` table issues a missing schema already\n* produces), so this is not part of the shared diff.\n*\n* A namespace's live container is the schema returned by its\n* polymorphic `ddlSchemaName(storage)` method — named schemas resolve\n* to their own id; the unbound singleton returns `UNBOUND_NAMESPACE_ID`\n* and is skipped explicitly (late-bound namespaces have no fixed DDL\n* schema). Issues are emitted only when the resolved name is a real,\n* creatable schema (not the unbound sentinel) and is missing from the\n* introspected list. `public` is suppressed implicitly because the\n* introspection (or its sensible default) always carries it.\n*\n* Each emitted issue's path is `['database', ddlName]` — an ancestor of\n* every table path under that schema, so it must never be run through\n* `coalesceSubtreeIssues` alongside the table diff (it would swallow the\n* table-level `not-found` issues that drive `CREATE TABLE`); the planner\n* adds these AFTER coalescing the relational issues, and they are not\n* subject to sibling-space ownership scoping (mirrors the retired\n* coordinate walk, which prepended namespace issues after that filter).\n*/\nfunction verifyPostgresNamespacePresence(input) {\n\tconst { contract, schema } = input;\n\tconst existing = new Set(existingSchemasFromSchema(schema));\n\tconst issues = [];\n\tconst namespaceIds = Object.keys(contract.storage.namespaces).sort();\n\tfor (const namespaceId of namespaceIds) {\n\t\tif (namespaceId === UNBOUND_NAMESPACE_ID) continue;\n\t\tconst ddlName = resolveDdlSchemaName(contract.storage, namespaceId);\n\t\tif (ddlName === UNBOUND_NAMESPACE_ID) continue;\n\t\tif (existing.has(ddlName)) continue;\n\t\tconst namespace = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlName,\n\t\t\ttables: {}\n\t\t});\n\t\tissues.push({\n\t\t\tpath: [\"database\", ddlName],\n\t\t\texpected: namespace\n\t\t});\n\t}\n\treturn issues;\n}\n//#endregion\n//#region src/core/migrations/planner.ts\nfunction createPostgresMigrationPlanner(lowerer) {\n\treturn new PostgresMigrationPlanner(lowerer);\n}\n/**\n* Postgres migration planner — a thin wrapper over `planIssues`.\n*\n* `plan()` diffs the target contract against the live schema via the one\n* differ (`buildPostgresPlanDiff`, producing node-typed `SchemaDiffIssue[]`)\n* and delegates to `planIssues` with the unified `postgresPlannerStrategies`\n* list: NOT-NULL backfill, type-change, nullable-tightening, codec-hook\n* storage types, component-declared dependency installs, and\n* shared-temp-default / empty-table-guarded NOT-NULL add-column. The same\n* strategy list runs for `migration plan`, `db update`, and `db init`;\n* behavior diverges purely on `policy.allowedOperationClasses` (the\n* data-safe strategies short-circuit when `'data'` is excluded). The issue\n* planner applies operation-class policy gates and emits a single\n* `PostgresOpFactoryCall[]` that drives both the runtime-ops view (via\n* `renderOps`) and the `renderTypeScript()` authoring surface. RLS policy\n* drift (the structural half of the same one-differ tree) is handled\n* separately via `planPostgresSchemaDiff`.\n*/\nvar PostgresMigrationPlanner = class {\n\t#lowerer;\n\tconstructor(lowerer) {\n\t\tthis.#lowerer = lowerer;\n\t}\n\tplan(options) {\n\t\treturn this.planSql(options);\n\t}\n\temptyMigration(context, spaceId) {\n\t\treturn new TypeScriptRenderablePostgresMigration([], {\n\t\t\tfrom: context.fromHash,\n\t\t\tto: context.toHash\n\t\t}, spaceId, context.snapshotsImportPath, this.#lowerer);\n\t}\n\tplanSql(options) {\n\t\tconst schemaName = options.schemaName ?? Object.keys(options.contract.storage.namespaces).find((id) => id !== UNBOUND_NAMESPACE_ID) ?? UNBOUND_NAMESPACE_ID;\n\t\tconst policyResult = this.ensureAdditivePolicy(options.policy);\n\t\tif (policyResult) return policyResult;\n\t\tPostgresDatabaseSchemaNode.assert(options.schema);\n\t\tconst { issues: rawIssues } = buildPostgresPlanDiff({\n\t\t\tcontract: options.contract,\n\t\t\tactualSchema: options.schema,\n\t\t\tframeworkComponents: options.frameworkComponents\n\t\t});\n\t\tconst policyDiffIssues = rawIssues.filter((issue) => isPolicyDiffIssue(issue));\n\t\tconst relationalDiffIssues = rawIssues.filter((issue) => !isPolicyDiffIssue(issue));\n\t\tconst strict = options.policy.allowedOperationClasses.includes(\"widening\") || options.policy.allowedOperationClasses.includes(\"destructive\");\n\t\tconst owned = retainUnownedExtras(coalesceSubtreeIssues(relationalDiffIssues), options.ownership, options.contract);\n\t\tconst gated = strict ? owned : owned.filter((issue) => issueOutcome(issue) !== \"not-expected\");\n\t\tconst schemaIssues = [...verifyPostgresNamespacePresence({\n\t\t\tcontract: options.contract,\n\t\t\tschema: options.schema\n\t\t}), ...gated];\n\t\tconst indexRenames = this.pairIndexRenames(options, schemaIssues);\n\t\tconst checkRenames = this.pairCheckRenames(options, schemaIssues);\n\t\tconst renameConsumed = /* @__PURE__ */ new Set([...indexRenames.consumed, ...checkRenames.consumed]);\n\t\tconst plannableIssues = renameConsumed.size === 0 ? schemaIssues : schemaIssues.filter((issue) => !renameConsumed.has(issue));\n\t\tconst codecHooks = extractCodecControlHooks(options.frameworkComponents);\n\t\tconst storageTypes = options.contract.storage.types ?? {};\n\t\tconst relationalSchema = relationalNamespaceNode(options.schema, schemaName);\n\t\tconst issuePartition = partitionIssuesByControlPolicy({\n\t\t\tissues: plannableIssues,\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (issue) => resolvePostgresNodeIssueControlPolicySubject(issue, options.contract),\n\t\t\tresolveCreationFactoryName: resolvePostgresNodeIssueCreationFactoryName\n\t\t});\n\t\tconst result = planIssues({\n\t\t\tissues: issuePartition.plannable,\n\t\t\ttoContract: options.contract,\n\t\t\tfromContract: options.fromContract,\n\t\t\tschemaName,\n\t\t\tcodecHooks,\n\t\t\tstorageTypes,\n\t\t\t...ifDefined(\"schema\", relationalSchema),\n\t\t\tpolicy: options.policy,\n\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\tstrategies: postgresPlannerStrategies\n\t\t});\n\t\tconst schemaDiff = this.planPostgresSchemaDiff(options, policyDiffIssues);\n\t\tif (!result.ok || schemaDiff.conflicts.length > 0) return plannerFailure([...result.ok ? [] : result.failure, ...schemaDiff.conflicts]);\n\t\tconst indexRenamePartition = partitionCallsByControlPolicy({\n\t\t\tcalls: [...indexRenames.calls, ...checkRenames.calls],\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, options.contract),\n\t\t\tresolveFactoryName: (call) => call.factoryName\n\t\t});\n\t\tconst schemaDiffPartition = partitionCallsByControlPolicy({\n\t\t\tcalls: schemaDiff.calls,\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, options.contract),\n\t\t\tresolveFactoryName: (call) => call.factoryName\n\t\t});\n\t\tconst fieldEventPartition = partitionCallsByControlPolicy({\n\t\t\tcalls: blindCast(planFieldEventOperations({\n\t\t\t\tpriorContract: options.fromContract,\n\t\t\t\tnewContract: options.contract,\n\t\t\t\tcodecHooks\n\t\t\t})),\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, options.contract),\n\t\t\tresolveFactoryName: (call) => call.factoryName\n\t\t});\n\t\tconst calls = [\n\t\t\t...result.value.calls,\n\t\t\t...indexRenamePartition.kept,\n\t\t\t...schemaDiffPartition.kept,\n\t\t\t...fieldEventPartition.kept\n\t\t];\n\t\tconst seenWarnings = /* @__PURE__ */ new Set();\n\t\tconst warnings = [\n\t\t\t...issuePartition.suppressions,\n\t\t\t...indexRenamePartition.suppressions,\n\t\t\t...schemaDiff.suppressions,\n\t\t\t...schemaDiffPartition.suppressions,\n\t\t\t...fieldEventPartition.suppressions\n\t\t].map((record) => renderPostgresSuppression(record, options.contract)).filter((warning) => {\n\t\t\tconst key = JSON.stringify(warning);\n\t\t\tif (seenWarnings.has(key)) return false;\n\t\t\tseenWarnings.add(key);\n\t\t\treturn true;\n\t\t});\n\t\treturn Object.freeze({\n\t\t\tkind: \"success\",\n\t\t\tplan: new TypeScriptRenderablePostgresMigration(calls, {\n\t\t\t\tfrom: options.fromContract?.storage.storageHash ?? null,\n\t\t\t\tto: options.contract.storage.storageHash\n\t\t\t}, options.spaceId, options.snapshotsImportPath, this.#lowerer),\n\t\t\t...warnings.length > 0 ? { warnings: Object.freeze(warnings) } : {}\n\t\t});\n\t}\n\t/**\n\t* Rename post-pass for indexes, per `(schema, table)`, widening-only,\n\t* deterministic by sorted names — the same structure as the policy pass\n\t* below (which stays untouched: policies pair by hash only).\n\t*\n\t* Hash pairing (prefix-only renames): extras whose live names parse as\n\t* wire names, grouped by `(schema, table, hash)`; missing nodes iterated\n\t* in sorted-name order consume the sorted-name-first candidate.\n\t*\n\t* Content pairing (exact→wire convergence), after hash pairing has\n\t* consumed its matches: the remaining wire-named-missing nodes\n\t* (`prefix` defined) against the remaining extras of any name shape,\n\t* paired iff content-equal (columns ordered-strict both-defined-or-\n\t* both-undefined, `unique`/`type` strict, `options` loose, bodies\n\t* byte-equal).\n\t*\n\t* Leftovers proceed as create/drop exactly as before; without the\n\t* widening allowance the pass is skipped and pairing degrades to the\n\t* additive half, like the policy pass.\n\t*/\n\tpairIndexRenames(options, issues) {\n\t\tconst consumed = /* @__PURE__ */ new Set();\n\t\tconst calls = [];\n\t\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst missing = [];\n\t\tconst extra = [];\n\t\tfor (const issue of issues) {\n\t\t\tconst node = issueNode(issue);\n\t\t\tif (node === void 0 || !SqlIndexIR.is(node)) continue;\n\t\t\tconst ddlSchema = issue.path[1];\n\t\t\tconst tableName = issue.path[2];\n\t\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t}\n\t\tif (missing.length === 0 || extra.length === 0) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\t\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\t\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\t\tfinding.ddlSchema,\n\t\t\tfinding.tableName,\n\t\t\thash\n\t\t]);\n\t\tconst rename = (missingFinding, candidate) => {\n\t\t\tconsumed.add(missingFinding.issue);\n\t\t\tconsumed.add(candidate.issue);\n\t\t\tcalls.push(new RenameIndexCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, candidate.node.name, missingFinding.node.name));\n\t\t};\n\t\tconst sortedMissing = [...missing].sort(byName);\n\t\tconst extrasByHash = /* @__PURE__ */ new Map();\n\t\tfor (const finding of extra) {\n\t\t\tconst parsed = parseWireName(finding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst key = pairingKey(finding, parsed.hash);\n\t\t\tconst group = extrasByHash.get(key) ?? [];\n\t\t\tgroup.push(finding);\n\t\t\textrasByHash.set(key, group);\n\t\t}\n\t\tfor (const group of extrasByHash.values()) group.sort(byName);\n\t\tfor (const missingFinding of sortedMissing) {\n\t\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\t\tif (candidate === void 0) continue;\n\t\t\trename(missingFinding, candidate);\n\t\t}\n\t\tconst sortedExtras = [...extra].sort(byName);\n\t\tfor (const missingFinding of sortedMissing) {\n\t\t\tif (consumed.has(missingFinding.issue)) continue;\n\t\t\tif (missingFinding.node.prefix === void 0) continue;\n\t\t\tconst candidate = sortedExtras.find((extraFinding) => !consumed.has(extraFinding.issue) && extraFinding.ddlSchema === missingFinding.ddlSchema && extraFinding.tableName === missingFinding.tableName && missingFinding.node.contentEquals(extraFinding.node, {\n\t\t\t\tcolumnPresence: \"matching\",\n\t\t\t\tbodies: \"verbatim\"\n\t\t\t}));\n\t\t\tif (candidate === void 0) continue;\n\t\t\trename(missingFinding, candidate);\n\t\t}\n\t\treturn {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t}\n\t/**\n\t* Check-constraint rename post-pass: a `not-found` and a `not-expected`\n\t* check on the same table whose wire-name content hashes match but whose\n\t* prefixes differ is a prefix-only rename, and collapses into one\n\t* `ALTER TABLE … RENAME CONSTRAINT`.\n\t*\n\t* This is the index pass's hash-pairing phase and nothing else. There is\n\t* deliberately no content-pairing phase: a live check body is whatever\n\t* Postgres reprinted, so it never byte-matches the authored text, and\n\t* pairing an exact-named live check by content would bless whatever\n\t* predicate is actually live. Adoption of an old exact-named check stays\n\t* drop + add.\n\t*\n\t* Runs only when the policy allows `widening` (rename's class). Without it\n\t* the pass no-ops and the pair degrades to the slice-1 behavior: an add,\n\t* plus a drop when `destructive` is allowed too.\n\t*/\n\tpairCheckRenames(options, issues) {\n\t\tconst consumed = /* @__PURE__ */ new Set();\n\t\tconst calls = [];\n\t\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst missing = [];\n\t\tconst extra = [];\n\t\tfor (const issue of issues) {\n\t\t\tconst node = issueNode(issue);\n\t\t\tif (node === void 0 || !SqlCheckConstraintIR.is(node)) continue;\n\t\t\tconst ddlSchema = issue.path[1];\n\t\t\tconst tableName = issue.path[2];\n\t\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t}\n\t\tif (missing.length === 0 || extra.length === 0) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\t\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\t\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\t\tfinding.ddlSchema,\n\t\t\tfinding.tableName,\n\t\t\thash\n\t\t]);\n\t\tconst sortedMissing = [...missing].sort(byName);\n\t\tconst extrasByHash = /* @__PURE__ */ new Map();\n\t\tfor (const finding of extra) {\n\t\t\tconst parsed = parseWireName(finding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst key = pairingKey(finding, parsed.hash);\n\t\t\tconst group = extrasByHash.get(key) ?? [];\n\t\t\tgroup.push(finding);\n\t\t\textrasByHash.set(key, group);\n\t\t}\n\t\tfor (const group of extrasByHash.values()) group.sort(byName);\n\t\tfor (const missingFinding of sortedMissing) {\n\t\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\t\tif (candidate === void 0) continue;\n\t\t\tconsumed.add(missingFinding.issue);\n\t\t\tconsumed.add(candidate.issue);\n\t\t\tcalls.push(new RenameCheckConstraintCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, candidate.node.name, missingFinding.node.name));\n\t\t}\n\t\treturn {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t}\n\t/**\n\t* Maps the RLS policy findings of the one combined tree diff\n\t* (`buildPostgresPlanDiff`, already ownership-filtered) into\n\t* `CREATE POLICY` / `DROP POLICY` / `ALTER POLICY … RENAME TO` ops — a\n\t* `not-equal` finding (an exact-named policy whose content drifted)\n\t* becomes drop + create, or a disallowed-call conflict when the policy\n\t* forbids the destructive drop. It\n\t* does not re-diff — it consumes exactly the policy-node subset of the\n\t* shared diff's issues. Enablement is NOT decided here: `ENABLE`/`DISABLE\n\t* ROW LEVEL SECURITY` derive from the table's marker-driven `rlsEnabled`\n\t* attribute diff on the relational side.\n\t*\n\t* Rename post-pass (the index pass's structure): hash pairing pairs a\n\t* `not-found` and a `not-expected` policy on the SAME table whose\n\t* wire-name content hashes match but prefixes differ (prefix-only rename);\n\t* content pairing then pairs remaining wire-named-missing policies against remaining\n\t* extras of any name shape by verbatim content (the node-owned `contentEquals` —\n\t* exact→wire adoption). Multi-candidate groups pair deterministically\n\t* by sorted name; leftovers proceed as create/drop; an exact-named\n\t* missing policy never content-pairs.\n\t*\n\t* The pairing runs only when the policy allows `widening` (rename's\n\t* class). Without it (db-init's additive-only set), pairing degrades\n\t* deliberately to the additive half: the new name is CREATEd and the old\n\t* policy survives live until a widening/destructive-allowed plan runs —\n\t* emitting an ungated widening rename would only fail at the runner's\n\t* class re-enforcement.\n\t*/\n\tplanPostgresSchemaDiff(options, filteredDiffIssues) {\n\t\tconst allowsDestructive = options.policy.allowedOperationClasses.includes(\"destructive\");\n\t\tconst allowsWidening = options.policy.allowedOperationClasses.includes(\"widening\");\n\t\tconst missing = [];\n\t\tconst extra = [];\n\t\tconst changed = [];\n\t\tfor (const issue of filteredDiffIssues) if (issueOutcome(issue) === \"not-equal\") {\n\t\t\tconst expected = issue.expected;\n\t\t\tPostgresPolicySchemaNode.assert(expected);\n\t\t\tchanged.push({\n\t\t\t\tnode: expected,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, expected.namespaceId)\n\t\t\t});\n\t\t} else if (issueOutcome(issue) === \"not-found\") {\n\t\t\tconst expected = issue.expected;\n\t\t\tPostgresPolicySchemaNode.assert(expected);\n\t\t\tmissing.push({\n\t\t\t\tnode: expected,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, expected.namespaceId)\n\t\t\t});\n\t\t} else if (issueOutcome(issue) === \"not-expected\") {\n\t\t\tconst actual = issue.actual;\n\t\t\tPostgresPolicySchemaNode.assert(actual);\n\t\t\textra.push({\n\t\t\t\tnode: actual,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, actual.namespaceId)\n\t\t\t});\n\t\t}\n\t\tconst calls = [];\n\t\tconst conflicts = [];\n\t\tconst suppressions = [];\n\t\tconst renamedExtras = /* @__PURE__ */ new Set();\n\t\tconst renamedMissing = /* @__PURE__ */ new Set();\n\t\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\t\tfinding.schemaForTable,\n\t\t\tfinding.node.tableName,\n\t\t\thash\n\t\t]);\n\t\tif (allowsWidening) {\n\t\t\tconst extrasByGroup = /* @__PURE__ */ new Map();\n\t\t\tfor (const finding of extra) {\n\t\t\t\tconst parsed = parseWireName(finding.node.name);\n\t\t\t\tif (parsed === void 0) continue;\n\t\t\t\tconst key = pairingKey(finding, parsed.hash);\n\t\t\t\tconst group = extrasByGroup.get(key) ?? [];\n\t\t\t\tgroup.push(finding);\n\t\t\t\textrasByGroup.set(key, group);\n\t\t\t}\n\t\t\tfor (const group of extrasByGroup.values()) group.sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tconst sortedMissing = [...missing].sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tfor (const missingFinding of sortedMissing) {\n\t\t\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\t\t\tif (parsed === void 0) continue;\n\t\t\t\tconst candidate = extrasByGroup.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\t\t\tif (candidate === void 0) continue;\n\t\t\t\trenamedExtras.add(candidate);\n\t\t\t\trenamedMissing.add(missingFinding);\n\t\t\t\tcalls.push(new RenamePostgresRlsPolicyCall(missingFinding.schemaForTable, missingFinding.node.tableName, candidate.node.name, missingFinding.node.name));\n\t\t\t}\n\t\t\tconst sortedExtras = [...extra].sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tfor (const missingFinding of sortedMissing) {\n\t\t\t\tif (renamedMissing.has(missingFinding)) continue;\n\t\t\t\tif (missingFinding.node.prefix === void 0) continue;\n\t\t\t\tconst candidate = sortedExtras.find((extraFinding) => !renamedExtras.has(extraFinding) && extraFinding.schemaForTable === missingFinding.schemaForTable && extraFinding.node.tableName === missingFinding.node.tableName && missingFinding.node.contentEquals(extraFinding.node));\n\t\t\t\tif (candidate === void 0) continue;\n\t\t\t\trenamedExtras.add(candidate);\n\t\t\t\trenamedMissing.add(missingFinding);\n\t\t\t\tcalls.push(new RenamePostgresRlsPolicyCall(missingFinding.schemaForTable, missingFinding.node.tableName, candidate.node.name, missingFinding.node.name));\n\t\t\t}\n\t\t}\n\t\tfor (const finding of changed) {\n\t\t\tconst replacement = {\n\t\t\t\tdrop: new DropPostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, finding.node.name),\n\t\t\t\tcreate: new CreatePostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, policyNodeToContractPolicy(finding.node))\n\t\t\t};\n\t\t\tconst graded = gradePolicyReplacement(replacement, options.contract, options.policy.allowedOperationClasses);\n\t\t\tif (graded.disposition === \"suppress\") {\n\t\t\t\tsuppressions.push(graded.record);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (graded.disposition === \"conflict\") {\n\t\t\t\tconflicts.push(graded.conflict);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcalls.push(replacement.drop);\n\t\t\tcalls.push(replacement.create);\n\t\t}\n\t\tfor (const finding of missing) {\n\t\t\tif (renamedMissing.has(finding)) continue;\n\t\t\tcalls.push(new CreatePostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, policyNodeToContractPolicy(finding.node)));\n\t\t}\n\t\tif (allowsDestructive) for (const finding of extra) {\n\t\t\tif (renamedExtras.has(finding)) continue;\n\t\t\tcalls.push(new DropPostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, finding.node.name));\n\t\t}\n\t\treturn {\n\t\t\tcalls,\n\t\t\tconflicts,\n\t\t\tsuppressions\n\t\t};\n\t}\n\tensureAdditivePolicy(policy) {\n\t\tif (!policy.allowedOperationClasses.includes(\"additive\")) return plannerFailure([{\n\t\t\tkind: \"unsupportedOperation\",\n\t\t\tsummary: \"Migration planner requires additive operations be allowed\",\n\t\t\twhy: \"The planner requires the \\\"additive\\\" operation class to be allowed in the policy.\"\n\t\t}]);\n\t\treturn null;\n\t}\n};\n/**\n* A diff issue whose node is an RLS policy — the structural half of the one\n* combined tree diff, routed to `planPostgresSchemaDiff` instead of\n* `planIssues`.\n*/\nfunction isPolicyDiffIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && PostgresPolicySchemaNode.is(node);\n}\n/**\n* Drops a `not-expected` issue when it is a whole extra storage entity (a table\n* or a native enum) that some space in the composition owns. Each such node\n* yields its own storage coordinate (see {@link postgresNodeStorageCoordinate}),\n* so `declaresEntity` answers over the whole composition on one uniform\n* coordinate: a positive answer means a sibling owns this entity here — leave\n* it; a negative answer means a genuine orphan — drop it. A node with no storage\n* coordinate (a namespace, or a deeper column/constraint drift on an owned\n* table) is this space's own and is always kept. No oracle ⇒ keep everything.\n*/\nfunction retainUnownedExtras(issues, ownership, contract) {\n\tif (ownership === void 0) return issues;\n\treturn issues.filter((issue) => {\n\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0) return true;\n\t\tconst coordinate = postgresNodeStorageCoordinate(node);\n\t\tif (coordinate === void 0) return true;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tif (ddlSchemaName === void 0) return true;\n\t\tconst namespaceId = resolveNamespaceIdForDdlSchema(contract, ddlSchemaName);\n\t\treturn !ownership.declaresEntity({\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t});\n\t});\n}\n/**\n* Returns the one namespace node the relational strategy layer probes for\n* live-table existence and reads codec-hook context off — the namespace\n* matching the planner's resolved schema name, or the first namespace when\n* none matches. `undefined` when the tree has no namespaces, so the strategy\n* context uses its empty-schema default.\n*\n* The relational strategies key tables by bare name, so they can only probe one\n* namespace at a time; probing across every namespace at once is future work.\n*\n* Returns the real `PostgresNamespaceSchemaNode` reference rather than a\n* projection: `storageTypePlanCallStrategy` hands this same value to codec\n* `planTypeOperations` hooks as `schema`, and hooks read the Postgres-specific\n* `nativeEnums` field off it (via `PostgresNamespaceSchemaNode.is`) to decide\n* whether a native enum type already exists — a projection that only copies\n* `tables` would silently drop that signal. `StrategyContext.schema`'s\n* declared type (`SqlSchemaIR`, shared with SQLite's flat shape) doesn't\n* capture this, so the return is `blindCast` the same way `namespaceSchemaNodes`\n* in the family's relational walk already treats a namespace node as a\n* structurally-`SqlSchemaIR`-shaped value.\n*/\nfunction relationalNamespaceNode(schema, schemaName) {\n\tconst namespaceNodes = Object.values(schema.namespaces);\n\tconst namespaceNode = namespaceNodes.find((node) => node.schemaName === schemaName) ?? namespaceNodes[0];\n\tif (namespaceNode === void 0) return void 0;\n\treturn blindCast(namespaceNode);\n}\n/**\n* Grades a {@link PolicyReplacement} as one unit against the table's\n* control policy, BEFORE the pair becomes calls or a conflict. This runs\n* ahead of `partitionCallsByControlPolicy`, which later re-grades the\n* surviving calls per-call — a no-op here, since only managed units\n* survive this grading.\n*\n* A replacement is deliberately STRICTER than the shared\n* `callAllowedUnderControlPolicy` rule: `tolerated` permits whole-object\n* creation, but a replacement's create is the second half of a repair of\n* an existing object, not a new object — so ANY non-managed control\n* (external, observed, tolerated) suppresses the whole unit. Drift on an\n* object the plan does not manage is reported, never repaired; the\n* suppression subject names the drifted policy (`rlsPolicy`) so the\n* report says which policy drifted, matching the conflict path's\n* `location.rlsPolicy`.\n*/\nfunction gradePolicyReplacement(replacement, contract, allowedOperationClasses) {\n\tconst subject = resolvePostgresCallControlPolicySubject(replacement.drop, contract);\n\tconst controlPolicy = controlPolicyForCall(subject, contract.defaultControlPolicy);\n\tif (controlPolicy !== \"managed\") return {\n\t\tdisposition: \"suppress\",\n\t\trecord: {\n\t\t\tsubject: subject === void 0 ? void 0 : {\n\t\t\t\t...subject,\n\t\t\t\trlsPolicy: replacement.drop.policyName\n\t\t\t},\n\t\t\tpolicy: controlPolicy,\n\t\t\tfactoryName: void 0,\n\t\t\tcreatesNewObject: false\n\t\t}\n\t};\n\tif (!allowedOperationClasses.includes(\"destructive\")) return {\n\t\tdisposition: \"conflict\",\n\t\tconflict: conflictForDisallowedCall(replacement.drop, allowedOperationClasses)\n\t};\n\treturn { disposition: \"plan\" };\n}\n/**\n* Rebuilds the `PostgresRlsPolicy` contract entity `CreatePostgresRlsPolicyCall`\n* carries (its `renderTypeScript`/`createRlsPolicy` paths serialize the whole\n* entity, `namespaceId` included). This reconstructs rather than looking the\n* original up in the contract on purpose: the diff node's `namespaceId` is the\n* *resolved DDL schema* (set when the expected tree was built), which is the\n* value the emitted op must carry; the contract-stored entity holds the raw,\n* pre-resolution coordinate, so a lookup would change the migration output.\n*/\nfunction policyNodeToContractPolicy(node) {\n\treturn new PostgresRlsPolicy({\n\t\tnaming: namingOf(node.name, node.prefix),\n\t\ttableName: node.tableName,\n\t\tnamespaceId: node.namespaceId,\n\t\toperation: node.operation,\n\t\troles: [...node.roles],\n\t\tusing: node.using,\n\t\twithCheck: node.withCheck,\n\t\tpermissive: node.permissive\n\t});\n}\n//#endregion\nexport { createPostgresMigrationPlanner as t };\n\n//# sourceMappingURL=planner-D0uogzvT.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAS,qBAAqB,SAAS,aAAa;CACnD,MAAM,YAAY,QAAQ,WAAW;CACrC,IAAI,iBAAiB,SAAS,GAAG,OAAO,UAAU,cAAc,OAAO;CACvE,OAAO;AACR;;;;;;;;;;;;;;;;;AAiBA,SAAS,0BAA0B,QAAQ;CAC1C,IAAI,2BAA2B,GAAG,MAAM,GAAG,OAAO,OAAO;CACzD,OAAO,CAAC,oBAAoB;AAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,gCAAgC,OAAO;CAC/C,MAAM,EAAE,UAAU,WAAW;CAC7B,MAAM,WAAW,IAAI,IAAI,0BAA0B,MAAM,CAAC;CAC1D,MAAM,SAAS,CAAC;CAChB,MAAM,eAAe,OAAO,KAAK,SAAS,QAAQ,UAAU,CAAC,CAAC,KAAK;CACnE,KAAK,MAAM,eAAe,cAAc;EACvC,IAAI,gBAAgB,sBAAsB;EAC1C,MAAM,UAAU,qBAAqB,SAAS,SAAS,WAAW;EAClE,IAAI,YAAY,sBAAsB;EACtC,IAAI,SAAS,IAAI,OAAO,GAAG;EAC3B,MAAM,YAAY,IAAI,4BAA4B;GACjD,YAAY;GACZ,QAAQ,CAAC;EACV,CAAC;EACD,OAAO,KAAK;GACX,MAAM,CAAC,YAAY,OAAO;GAC1B,UAAU;EACX,CAAC;CACF;CACA,OAAO;AACR;AAGA,SAAS,+BAA+B,SAAS;CAChD,OAAO,IAAI,yBAAyB,OAAO;AAC5C;;;;;;;;;;;;;;;;;;;AAmBA,IAAI,2BAA2B,MAAM;CACpC;CACA,YAAY,SAAS;EACpB,KAAKA,WAAW;CACjB;CACA,KAAK,SAAS;EACb,OAAO,KAAK,QAAQ,OAAO;CAC5B;CACA,eAAe,SAAS,SAAS;E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ACR,aAAa,KAAK;GAClB,kBAAkB;EACnB;CACD;CACA,IAAI,CAAC,wBAAwB,SAAS,aAAa,GAAG,OAAO;EAC5D,aAAa;EACb,UAAU,0BAA0B,YAAY,MAAM,uBAAuB;CAC9E;CACA,OAAO,EAAE,aAAa,OAAO;AAC9B;;;;;;;;;;AAUA,SAAS,2BAA2B,MAAM;CACzC,OAAO,IAAI,kBAAkB;EAC5B,QAAQ,SAAS,KAAK,MAAM,KAAK,MAAM;EACvC,WAAW,KAAK;EAChB,aAAa,KAAK;EAClB,WAAW,KAAK;EAChB,OAAO,CAAC,GAAG,KAAK,KAAK;EACrB,OAAO,KAAK;EACZ,WAAW,KAAK;EAChB,YAAY,KAAK;CAClB,CAAC;AACF"}
1
+ {"version":3,"file":"planner-CqeT-P2q-DVglsvwu.mjs","names":["#lowerer"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-CqeT-P2q.mjs"],"sourcesContent":["import { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { _ as PostgresRlsPolicy, r as isPostgresSchema } from \"./postgres-schema-B3t7Zr52.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { t as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-Cab6g5MC.mjs\";\nimport { t as buildPostgresPlanDiff } from \"./diff-database-schema-B27W13mM.mjs\";\nimport { a as resolvePostgresNodeIssueCreationFactoryName, c as issueNode, d as postgresPlannerStrategies, f as postgresNodeStorageCoordinate, i as resolvePostgresNodeIssueControlPolicySubject, l as issueSchemaName, n as resolveNamespaceIdForDdlSchema, o as coalesceSubtreeIssues, r as resolvePostgresCallControlPolicySubject, s as conflictForDisallowedCall, t as renderPostgresSuppression, u as planIssues } from \"./control-policy-HgW6zNnz.mjs\";\nimport { A as RenameIndexCall, T as DropPostgresRlsPolicyCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, p as CreatePostgresRlsPolicyCall } from \"./op-factory-call-CSkQdszU.mjs\";\nimport { t as TypeScriptRenderablePostgresMigration } from \"./planner-produced-postgres-migration-Dsri3SjC.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { controlPolicyForCall, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure } from \"@internal/family-sql/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { namingOf, parseWireName } from \"@internal/sql-schema-ir/naming\";\nimport { SqlCheckConstraintIR, SqlIndexIR } from \"@internal/sql-schema-ir/types\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\n//#region src/core/migrations/verify-postgres-namespaces.ts\n/**\n* Resolves the live-database schema name for a given namespace\n* coordinate. Mirrors `resolveDdlSchemaForNamespace` in\n* `planner-strategies.ts` so the verifier's projection and the\n* planner's projection always agree — Postgres-aware namespaces (the\n* production path) dispatch to `ddlSchemaName(storage)`, and bare\n* object payloads (used by some tests) fall back to the coordinate\n* itself.\n*/\nfunction resolveDdlSchemaName(storage, namespaceId) {\n\tconst namespace = storage.namespaces[namespaceId];\n\tif (isPostgresSchema(namespace)) return namespace.ddlSchemaName(storage);\n\treturn namespaceId;\n}\n/**\n* Reads the introspected list of schema names from the database-root schema\n* node. `existingSchemas` is database-level, so it lives on the\n* `PostgresDatabaseSchemaNode` root — not on the per-schema namespace nodes.\n*\n* Defaults to the always-present `public` schema when the node is not the\n* database root — a fresh Postgres database always carries `public` (unless an\n* operator dropped it manually), so any verifier path that runs without an\n* enriched introspection still suppresses the redundant `CREATE SCHEMA\n* \"public\"`.\n*\n* Production introspection (`PostgresControlAdapter.introspect`) is the\n* authoritative source: it queries `pg_namespace` and sets `existingSchemas`\n* on the returned root. Tests that want to assert against a richer initial\n* state construct a `PostgresDatabaseSchemaNode` explicitly.\n*/\nfunction existingSchemasFromSchema(schema) {\n\tif (PostgresDatabaseSchemaNode.is(schema)) return schema.existingSchemas;\n\treturn [DEFAULT_NAMESPACE_ID];\n}\n/**\n* Emits a `postgres-namespace` `not-found` diff issue for every\n* contract-declared Postgres namespace whose live container does not yet\n* exist. The planner prepends these (node-typed, synthesized) to the\n* relational diff issues so a multi-schema plan emits `CREATE SCHEMA`\n* before the tables that need it — a planner-only concern (verify already\n* rejects via the `not-found` table issues a missing schema already\n* produces), so this is not part of the shared diff.\n*\n* A namespace's live container is the schema returned by its\n* polymorphic `ddlSchemaName(storage)` method — named schemas resolve\n* to their own id; the unbound singleton returns `UNBOUND_NAMESPACE_ID`\n* and is skipped explicitly (late-bound namespaces have no fixed DDL\n* schema). Issues are emitted only when the resolved name is a real,\n* creatable schema (not the unbound sentinel) and is missing from the\n* introspected list. `public` is suppressed implicitly because the\n* introspection (or its sensible default) always carries it.\n*\n* Each emitted issue's path is `['database', ddlName]` — an ancestor of\n* every table path under that schema, so it must never be run through\n* `coalesceSubtreeIssues` alongside the table diff (it would swallow the\n* table-level `not-found` issues that drive `CREATE TABLE`); the planner\n* adds these AFTER coalescing the relational issues, and they are not\n* subject to sibling-space ownership scoping (mirrors the retired\n* coordinate walk, which prepended namespace issues after that filter).\n*/\nfunction verifyPostgresNamespacePresence(input) {\n\tconst { contract, schema } = input;\n\tconst existing = new Set(existingSchemasFromSchema(schema));\n\tconst issues = [];\n\tconst namespaceIds = Object.keys(contract.storage.namespaces).sort();\n\tfor (const namespaceId of namespaceIds) {\n\t\tif (namespaceId === UNBOUND_NAMESPACE_ID) continue;\n\t\tconst ddlName = resolveDdlSchemaName(contract.storage, namespaceId);\n\t\tif (ddlName === UNBOUND_NAMESPACE_ID) continue;\n\t\tif (existing.has(ddlName)) continue;\n\t\tconst namespace = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlName,\n\t\t\ttables: {}\n\t\t});\n\t\tissues.push({\n\t\t\tpath: [\"database\", ddlName],\n\t\t\texpected: namespace\n\t\t});\n\t}\n\treturn issues;\n}\n//#endregion\n//#region src/core/migrations/planner.ts\nfunction createPostgresMigrationPlanner(lowerer) {\n\treturn new PostgresMigrationPlanner(lowerer);\n}\n/**\n* Postgres migration planner — a thin wrapper over `planIssues`.\n*\n* `plan()` diffs the target contract against the live schema via the one\n* differ (`buildPostgresPlanDiff`, producing node-typed `SchemaDiffIssue[]`)\n* and delegates to `planIssues` with the unified `postgresPlannerStrategies`\n* list: NOT-NULL backfill, type-change, nullable-tightening, codec-hook\n* storage types, component-declared dependency installs, and\n* shared-temp-default / empty-table-guarded NOT-NULL add-column. The same\n* strategy list runs for `migration plan`, `db update`, and `db init`;\n* behavior diverges purely on `policy.allowedOperationClasses` (the\n* data-safe strategies short-circuit when `'data'` is excluded). The issue\n* planner applies operation-class policy gates and emits a single\n* `PostgresOpFactoryCall[]` that drives both the runtime-ops view (via\n* `renderOps`) and the `renderTypeScript()` authoring surface. RLS policy\n* drift (the structural half of the same one-differ tree) is handled\n* separately via `planPostgresSchemaDiff`.\n*/\nvar PostgresMigrationPlanner = class {\n\t#lowerer;\n\tconstructor(lowerer) {\n\t\tthis.#lowerer = lowerer;\n\t}\n\tplan(options) {\n\t\treturn this.planSql(options);\n\t}\n\temptyMigration(context, spaceId) {\n\t\treturn new TypeScriptRenderablePostgresMigration([], {\n\t\t\tfrom: context.fromHash,\n\t\t\tto: context.toHash\n\t\t}, spaceId, context.snapshotsImportPath, this.#lowerer);\n\t}\n\tplanSql(options) {\n\t\tconst schemaName = options.schemaName ?? Object.keys(options.contract.storage.namespaces).find((id) => id !== UNBOUND_NAMESPACE_ID) ?? UNBOUND_NAMESPACE_ID;\n\t\tconst policyResult = this.ensureAdditivePolicy(options.policy);\n\t\tif (policyResult) return policyResult;\n\t\tPostgresDatabaseSchemaNode.assert(options.schema);\n\t\tconst { issues: rawIssues } = buildPostgresPlanDiff({\n\t\t\tcontract: options.contract,\n\t\t\tactualSchema: options.schema,\n\t\t\tframeworkComponents: options.frameworkComponents\n\t\t});\n\t\tconst policyDiffIssues = rawIssues.filter((issue) => isPolicyDiffIssue(issue));\n\t\tconst relationalDiffIssues = rawIssues.filter((issue) => !isPolicyDiffIssue(issue));\n\t\tconst strict = options.policy.allowedOperationClasses.includes(\"widening\") || options.policy.allowedOperationClasses.includes(\"destructive\");\n\t\tconst owned = retainUnownedExtras(coalesceSubtreeIssues(relationalDiffIssues), options.ownership, options.contract);\n\t\tconst gated = strict ? owned : owned.filter((issue) => issueOutcome(issue) !== \"not-expected\");\n\t\tconst schemaIssues = [...verifyPostgresNamespacePresence({\n\t\t\tcontract: options.contract,\n\t\t\tschema: options.schema\n\t\t}), ...gated];\n\t\tconst indexRenames = this.pairIndexRenames(options, schemaIssues);\n\t\tconst checkRenames = this.pairCheckRenames(options, schemaIssues);\n\t\tconst renameConsumed = /* @__PURE__ */ new Set([...indexRenames.consumed, ...checkRenames.consumed]);\n\t\tconst plannableIssues = renameConsumed.size === 0 ? schemaIssues : schemaIssues.filter((issue) => !renameConsumed.has(issue));\n\t\tconst codecHooks = extractCodecControlHooks(options.frameworkComponents);\n\t\tconst storageTypes = options.contract.storage.types ?? {};\n\t\tconst relationalSchema = relationalNamespaceNode(options.schema, schemaName);\n\t\tconst issuePartition = partitionIssuesByControlPolicy({\n\t\t\tissues: plannableIssues,\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (issue) => resolvePostgresNodeIssueControlPolicySubject(issue, options.contract),\n\t\t\tresolveCreationFactoryName: resolvePostgresNodeIssueCreationFactoryName\n\t\t});\n\t\tconst result = planIssues({\n\t\t\tissues: issuePartition.plannable,\n\t\t\ttoContract: options.contract,\n\t\t\tfromContract: options.fromContract,\n\t\t\tschemaName,\n\t\t\tcodecHooks,\n\t\t\tstorageTypes,\n\t\t\t...ifDefined(\"schema\", relationalSchema),\n\t\t\tpolicy: options.policy,\n\t\t\tframeworkComponents: options.frameworkComponents,\n\t\t\tstrategies: postgresPlannerStrategies\n\t\t});\n\t\tconst schemaDiff = this.planPostgresSchemaDiff(options, policyDiffIssues);\n\t\tif (!result.ok || schemaDiff.conflicts.length > 0) return plannerFailure([...result.ok ? [] : result.failure, ...schemaDiff.conflicts]);\n\t\tconst indexRenamePartition = partitionCallsByControlPolicy({\n\t\t\tcalls: [...indexRenames.calls, ...checkRenames.calls],\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, options.contract),\n\t\t\tresolveFactoryName: (call) => call.factoryName\n\t\t});\n\t\tconst schemaDiffPartition = partitionCallsByControlPolicy({\n\t\t\tcalls: schemaDiff.calls,\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, options.contract),\n\t\t\tresolveFactoryName: (call) => call.factoryName\n\t\t});\n\t\tconst fieldEventPartition = partitionCallsByControlPolicy({\n\t\t\tcalls: blindCast(planFieldEventOperations({\n\t\t\t\tpriorContract: options.fromContract,\n\t\t\t\tnewContract: options.contract,\n\t\t\t\tcodecHooks\n\t\t\t})),\n\t\t\tcontract: options.contract,\n\t\t\tresolveControlPolicySubject: (call) => resolvePostgresCallControlPolicySubject(call, options.contract),\n\t\t\tresolveFactoryName: (call) => call.factoryName\n\t\t});\n\t\tconst calls = [\n\t\t\t...result.value.calls,\n\t\t\t...indexRenamePartition.kept,\n\t\t\t...schemaDiffPartition.kept,\n\t\t\t...fieldEventPartition.kept\n\t\t];\n\t\tconst seenWarnings = /* @__PURE__ */ new Set();\n\t\tconst warnings = [\n\t\t\t...issuePartition.suppressions,\n\t\t\t...indexRenamePartition.suppressions,\n\t\t\t...schemaDiff.suppressions,\n\t\t\t...schemaDiffPartition.suppressions,\n\t\t\t...fieldEventPartition.suppressions\n\t\t].map((record) => renderPostgresSuppression(record, options.contract)).filter((warning) => {\n\t\t\tconst key = JSON.stringify(warning);\n\t\t\tif (seenWarnings.has(key)) return false;\n\t\t\tseenWarnings.add(key);\n\t\t\treturn true;\n\t\t});\n\t\treturn Object.freeze({\n\t\t\tkind: \"success\",\n\t\t\tplan: new TypeScriptRenderablePostgresMigration(calls, {\n\t\t\t\tfrom: options.fromContract?.storage.storageHash ?? null,\n\t\t\t\tto: options.contract.storage.storageHash\n\t\t\t}, options.spaceId, options.snapshotsImportPath, this.#lowerer),\n\t\t\t...warnings.length > 0 ? { warnings: Object.freeze(warnings) } : {}\n\t\t});\n\t}\n\t/**\n\t* Rename post-pass for indexes, per `(schema, table)`, widening-only,\n\t* deterministic by sorted names — the same structure as the policy pass\n\t* below (which stays untouched: policies pair by hash only).\n\t*\n\t* Hash pairing (prefix-only renames): extras whose live names parse as\n\t* wire names, grouped by `(schema, table, hash)`; missing nodes iterated\n\t* in sorted-name order consume the sorted-name-first candidate.\n\t*\n\t* Content pairing (exact→wire convergence), after hash pairing has\n\t* consumed its matches: the remaining wire-named-missing nodes\n\t* (`prefix` defined) against the remaining extras of any name shape,\n\t* paired iff content-equal (columns ordered-strict both-defined-or-\n\t* both-undefined, `unique`/`type` strict, `options` loose, bodies\n\t* byte-equal).\n\t*\n\t* Leftovers proceed as create/drop exactly as before; without the\n\t* widening allowance the pass is skipped and pairing degrades to the\n\t* additive half, like the policy pass.\n\t*/\n\tpairIndexRenames(options, issues) {\n\t\tconst consumed = /* @__PURE__ */ new Set();\n\t\tconst calls = [];\n\t\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst missing = [];\n\t\tconst extra = [];\n\t\tfor (const issue of issues) {\n\t\t\tconst node = issueNode(issue);\n\t\t\tif (node === void 0 || !SqlIndexIR.is(node)) continue;\n\t\t\tconst ddlSchema = issue.path[1];\n\t\t\tconst tableName = issue.path[2];\n\t\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t}\n\t\tif (missing.length === 0 || extra.length === 0) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\t\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\t\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\t\tfinding.ddlSchema,\n\t\t\tfinding.tableName,\n\t\t\thash\n\t\t]);\n\t\tconst rename = (missingFinding, candidate) => {\n\t\t\tconsumed.add(missingFinding.issue);\n\t\t\tconsumed.add(candidate.issue);\n\t\t\tcalls.push(new RenameIndexCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, candidate.node.name, missingFinding.node.name));\n\t\t};\n\t\tconst sortedMissing = [...missing].sort(byName);\n\t\tconst extrasByHash = /* @__PURE__ */ new Map();\n\t\tfor (const finding of extra) {\n\t\t\tconst parsed = parseWireName(finding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst key = pairingKey(finding, parsed.hash);\n\t\t\tconst group = extrasByHash.get(key) ?? [];\n\t\t\tgroup.push(finding);\n\t\t\textrasByHash.set(key, group);\n\t\t}\n\t\tfor (const group of extrasByHash.values()) group.sort(byName);\n\t\tfor (const missingFinding of sortedMissing) {\n\t\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\t\tif (candidate === void 0) continue;\n\t\t\trename(missingFinding, candidate);\n\t\t}\n\t\tconst sortedExtras = [...extra].sort(byName);\n\t\tfor (const missingFinding of sortedMissing) {\n\t\t\tif (consumed.has(missingFinding.issue)) continue;\n\t\t\tif (missingFinding.node.prefix === void 0) continue;\n\t\t\tconst candidate = sortedExtras.find((extraFinding) => !consumed.has(extraFinding.issue) && extraFinding.ddlSchema === missingFinding.ddlSchema && extraFinding.tableName === missingFinding.tableName && missingFinding.node.contentEquals(extraFinding.node, {\n\t\t\t\tcolumnPresence: \"matching\",\n\t\t\t\tbodies: \"verbatim\"\n\t\t\t}));\n\t\t\tif (candidate === void 0) continue;\n\t\t\trename(missingFinding, candidate);\n\t\t}\n\t\treturn {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t}\n\t/**\n\t* Check-constraint rename post-pass: a `not-found` and a `not-expected`\n\t* check on the same table whose wire-name content hashes match but whose\n\t* prefixes differ is a prefix-only rename, and collapses into one\n\t* `ALTER TABLE … RENAME CONSTRAINT`.\n\t*\n\t* This is the index pass's hash-pairing phase and nothing else. There is\n\t* deliberately no content-pairing phase: a live check body is whatever\n\t* Postgres reprinted, so it never byte-matches the authored text, and\n\t* pairing an exact-named live check by content would bless whatever\n\t* predicate is actually live. Adoption of an old exact-named check stays\n\t* drop + add.\n\t*\n\t* Runs only when the policy allows `widening` (rename's class). Without it\n\t* the pass no-ops and the pair degrades to the slice-1 behavior: an add,\n\t* plus a drop when `destructive` is allowed too.\n\t*/\n\tpairCheckRenames(options, issues) {\n\t\tconst consumed = /* @__PURE__ */ new Set();\n\t\tconst calls = [];\n\t\tif (!options.policy.allowedOperationClasses.includes(\"widening\")) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst missing = [];\n\t\tconst extra = [];\n\t\tfor (const issue of issues) {\n\t\t\tconst node = issueNode(issue);\n\t\t\tif (node === void 0 || !SqlCheckConstraintIR.is(node)) continue;\n\t\t\tconst ddlSchema = issue.path[1];\n\t\t\tconst tableName = issue.path[2];\n\t\t\tif (ddlSchema === void 0 || tableName === void 0) continue;\n\t\t\tif (issueOutcome(issue) === \"not-found\") missing.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t\telse if (issueOutcome(issue) === \"not-expected\") extra.push({\n\t\t\t\tissue,\n\t\t\t\tnode,\n\t\t\t\tddlSchema,\n\t\t\t\ttableName\n\t\t\t});\n\t\t}\n\t\tif (missing.length === 0 || extra.length === 0) return {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t\tconst byName = (a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0;\n\t\tconst emissionSchema = (ddlSchema) => resolveNamespaceIdForDdlSchema(options.contract, ddlSchema) === UNBOUND_NAMESPACE_ID ? UNBOUND_NAMESPACE_ID : ddlSchema;\n\t\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\t\tfinding.ddlSchema,\n\t\t\tfinding.tableName,\n\t\t\thash\n\t\t]);\n\t\tconst sortedMissing = [...missing].sort(byName);\n\t\tconst extrasByHash = /* @__PURE__ */ new Map();\n\t\tfor (const finding of extra) {\n\t\t\tconst parsed = parseWireName(finding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst key = pairingKey(finding, parsed.hash);\n\t\t\tconst group = extrasByHash.get(key) ?? [];\n\t\t\tgroup.push(finding);\n\t\t\textrasByHash.set(key, group);\n\t\t}\n\t\tfor (const group of extrasByHash.values()) group.sort(byName);\n\t\tfor (const missingFinding of sortedMissing) {\n\t\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\t\tif (parsed === void 0) continue;\n\t\t\tconst candidate = extrasByHash.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\t\tif (candidate === void 0) continue;\n\t\t\tconsumed.add(missingFinding.issue);\n\t\t\tconsumed.add(candidate.issue);\n\t\t\tcalls.push(new RenameCheckConstraintCall(emissionSchema(missingFinding.ddlSchema), missingFinding.tableName, candidate.node.name, missingFinding.node.name));\n\t\t}\n\t\treturn {\n\t\t\tcalls,\n\t\t\tconsumed\n\t\t};\n\t}\n\t/**\n\t* Maps the RLS policy findings of the one combined tree diff\n\t* (`buildPostgresPlanDiff`, already ownership-filtered) into\n\t* `CREATE POLICY` / `DROP POLICY` / `ALTER POLICY … RENAME TO` ops — a\n\t* `not-equal` finding (an exact-named policy whose content drifted)\n\t* becomes drop + create, or a disallowed-call conflict when the policy\n\t* forbids the destructive drop. It\n\t* does not re-diff — it consumes exactly the policy-node subset of the\n\t* shared diff's issues. Enablement is NOT decided here: `ENABLE`/`DISABLE\n\t* ROW LEVEL SECURITY` derive from the table's marker-driven `rlsEnabled`\n\t* attribute diff on the relational side.\n\t*\n\t* Rename post-pass (the index pass's structure): hash pairing pairs a\n\t* `not-found` and a `not-expected` policy on the SAME table whose\n\t* wire-name content hashes match but prefixes differ (prefix-only rename);\n\t* content pairing then pairs remaining wire-named-missing policies against remaining\n\t* extras of any name shape by verbatim content (the node-owned `contentEquals` —\n\t* exact→wire adoption). Multi-candidate groups pair deterministically\n\t* by sorted name; leftovers proceed as create/drop; an exact-named\n\t* missing policy never content-pairs.\n\t*\n\t* The pairing runs only when the policy allows `widening` (rename's\n\t* class). Without it (db-init's additive-only set), pairing degrades\n\t* deliberately to the additive half: the new name is CREATEd and the old\n\t* policy survives live until a widening/destructive-allowed plan runs —\n\t* emitting an ungated widening rename would only fail at the runner's\n\t* class re-enforcement.\n\t*/\n\tplanPostgresSchemaDiff(options, filteredDiffIssues) {\n\t\tconst allowsDestructive = options.policy.allowedOperationClasses.includes(\"destructive\");\n\t\tconst allowsWidening = options.policy.allowedOperationClasses.includes(\"widening\");\n\t\tconst missing = [];\n\t\tconst extra = [];\n\t\tconst changed = [];\n\t\tfor (const issue of filteredDiffIssues) if (issueOutcome(issue) === \"not-equal\") {\n\t\t\tconst expected = issue.expected;\n\t\t\tPostgresPolicySchemaNode.assert(expected);\n\t\t\tchanged.push({\n\t\t\t\tnode: expected,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, expected.namespaceId)\n\t\t\t});\n\t\t} else if (issueOutcome(issue) === \"not-found\") {\n\t\t\tconst expected = issue.expected;\n\t\t\tPostgresPolicySchemaNode.assert(expected);\n\t\t\tmissing.push({\n\t\t\t\tnode: expected,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, expected.namespaceId)\n\t\t\t});\n\t\t} else if (issueOutcome(issue) === \"not-expected\") {\n\t\t\tconst actual = issue.actual;\n\t\t\tPostgresPolicySchemaNode.assert(actual);\n\t\t\textra.push({\n\t\t\t\tnode: actual,\n\t\t\t\tschemaForTable: resolveDdlSchemaForNamespaceStorage(options.contract.storage, actual.namespaceId)\n\t\t\t});\n\t\t}\n\t\tconst calls = [];\n\t\tconst conflicts = [];\n\t\tconst suppressions = [];\n\t\tconst renamedExtras = /* @__PURE__ */ new Set();\n\t\tconst renamedMissing = /* @__PURE__ */ new Set();\n\t\tconst pairingKey = (finding, hash) => JSON.stringify([\n\t\t\tfinding.schemaForTable,\n\t\t\tfinding.node.tableName,\n\t\t\thash\n\t\t]);\n\t\tif (allowsWidening) {\n\t\t\tconst extrasByGroup = /* @__PURE__ */ new Map();\n\t\t\tfor (const finding of extra) {\n\t\t\t\tconst parsed = parseWireName(finding.node.name);\n\t\t\t\tif (parsed === void 0) continue;\n\t\t\t\tconst key = pairingKey(finding, parsed.hash);\n\t\t\t\tconst group = extrasByGroup.get(key) ?? [];\n\t\t\t\tgroup.push(finding);\n\t\t\t\textrasByGroup.set(key, group);\n\t\t\t}\n\t\t\tfor (const group of extrasByGroup.values()) group.sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tconst sortedMissing = [...missing].sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tfor (const missingFinding of sortedMissing) {\n\t\t\t\tconst parsed = parseWireName(missingFinding.node.name);\n\t\t\t\tif (parsed === void 0) continue;\n\t\t\t\tconst candidate = extrasByGroup.get(pairingKey(missingFinding, parsed.hash))?.shift();\n\t\t\t\tif (candidate === void 0) continue;\n\t\t\t\trenamedExtras.add(candidate);\n\t\t\t\trenamedMissing.add(missingFinding);\n\t\t\t\tcalls.push(new RenamePostgresRlsPolicyCall(missingFinding.schemaForTable, missingFinding.node.tableName, candidate.node.name, missingFinding.node.name));\n\t\t\t}\n\t\t\tconst sortedExtras = [...extra].sort((a, b) => a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0);\n\t\t\tfor (const missingFinding of sortedMissing) {\n\t\t\t\tif (renamedMissing.has(missingFinding)) continue;\n\t\t\t\tif (missingFinding.node.prefix === void 0) continue;\n\t\t\t\tconst candidate = sortedExtras.find((extraFinding) => !renamedExtras.has(extraFinding) && extraFinding.schemaForTable === missingFinding.schemaForTable && extraFinding.node.tableName === missingFinding.node.tableName && missingFinding.node.contentEquals(extraFinding.node));\n\t\t\t\tif (candidate === void 0) continue;\n\t\t\t\trenamedExtras.add(candidate);\n\t\t\t\trenamedMissing.add(missingFinding);\n\t\t\t\tcalls.push(new RenamePostgresRlsPolicyCall(missingFinding.schemaForTable, missingFinding.node.tableName, candidate.node.name, missingFinding.node.name));\n\t\t\t}\n\t\t}\n\t\tfor (const finding of changed) {\n\t\t\tconst replacement = {\n\t\t\t\tdrop: new DropPostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, finding.node.name),\n\t\t\t\tcreate: new CreatePostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, policyNodeToContractPolicy(finding.node))\n\t\t\t};\n\t\t\tconst graded = gradePolicyReplacement(replacement, options.contract, options.policy.allowedOperationClasses);\n\t\t\tif (graded.disposition === \"suppress\") {\n\t\t\t\tsuppressions.push(graded.record);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (graded.disposition === \"conflict\") {\n\t\t\t\tconflicts.push(graded.conflict);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tcalls.push(replacement.drop);\n\t\t\tcalls.push(replacement.create);\n\t\t}\n\t\tfor (const finding of missing) {\n\t\t\tif (renamedMissing.has(finding)) continue;\n\t\t\tcalls.push(new CreatePostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, policyNodeToContractPolicy(finding.node)));\n\t\t}\n\t\tif (allowsDestructive) for (const finding of extra) {\n\t\t\tif (renamedExtras.has(finding)) continue;\n\t\t\tcalls.push(new DropPostgresRlsPolicyCall(finding.schemaForTable, finding.node.tableName, finding.node.name));\n\t\t}\n\t\treturn {\n\t\t\tcalls,\n\t\t\tconflicts,\n\t\t\tsuppressions\n\t\t};\n\t}\n\tensureAdditivePolicy(policy) {\n\t\tif (!policy.allowedOperationClasses.includes(\"additive\")) return plannerFailure([{\n\t\t\tkind: \"unsupportedOperation\",\n\t\t\tsummary: \"Migration planner requires additive operations be allowed\",\n\t\t\twhy: \"The planner requires the \\\"additive\\\" operation class to be allowed in the policy.\"\n\t\t}]);\n\t\treturn null;\n\t}\n};\n/**\n* A diff issue whose node is an RLS policy — the structural half of the one\n* combined tree diff, routed to `planPostgresSchemaDiff` instead of\n* `planIssues`.\n*/\nfunction isPolicyDiffIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && PostgresPolicySchemaNode.is(node);\n}\n/**\n* Drops a `not-expected` issue when it is a whole extra storage entity (a table\n* or a native enum) that some space in the composition owns. Each such node\n* yields its own storage coordinate (see {@link postgresNodeStorageCoordinate}),\n* so `declaresEntity` answers over the whole composition on one uniform\n* coordinate: a positive answer means a sibling owns this entity here — leave\n* it; a negative answer means a genuine orphan — drop it. A node with no storage\n* coordinate (a namespace, or a deeper column/constraint drift on an owned\n* table) is this space's own and is always kept. No oracle ⇒ keep everything.\n*/\nfunction retainUnownedExtras(issues, ownership, contract) {\n\tif (ownership === void 0) return issues;\n\treturn issues.filter((issue) => {\n\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\tconst node = issueNode(issue);\n\t\tif (node === void 0) return true;\n\t\tconst coordinate = postgresNodeStorageCoordinate(node);\n\t\tif (coordinate === void 0) return true;\n\t\tconst ddlSchemaName = issueSchemaName(issue);\n\t\tif (ddlSchemaName === void 0) return true;\n\t\tconst namespaceId = resolveNamespaceIdForDdlSchema(contract, ddlSchemaName);\n\t\treturn !ownership.declaresEntity({\n\t\t\tnamespaceId,\n\t\t\t...coordinate\n\t\t});\n\t});\n}\n/**\n* Returns the one namespace node the relational strategy layer probes for\n* live-table existence and reads codec-hook context off — the namespace\n* matching the planner's resolved schema name, or the first namespace when\n* none matches. `undefined` when the tree has no namespaces, so the strategy\n* context uses its empty-schema default.\n*\n* The relational strategies key tables by bare name, so they can only probe one\n* namespace at a time; probing across every namespace at once is future work.\n*\n* Returns the real `PostgresNamespaceSchemaNode` reference rather than a\n* projection: `storageTypePlanCallStrategy` hands this same value to codec\n* `planTypeOperations` hooks as `schema`, and hooks read the Postgres-specific\n* `nativeEnums` field off it (via `PostgresNamespaceSchemaNode.is`) to decide\n* whether a native enum type already exists — a projection that only copies\n* `tables` would silently drop that signal. `StrategyContext.schema`'s\n* declared type (`SqlSchemaIR`, shared with SQLite's flat shape) doesn't\n* capture this, so the return is `blindCast` the same way `namespaceSchemaNodes`\n* in the family's relational walk already treats a namespace node as a\n* structurally-`SqlSchemaIR`-shaped value.\n*/\nfunction relationalNamespaceNode(schema, schemaName) {\n\tconst namespaceNodes = Object.values(schema.namespaces);\n\tconst namespaceNode = namespaceNodes.find((node) => node.schemaName === schemaName) ?? namespaceNodes[0];\n\tif (namespaceNode === void 0) return void 0;\n\treturn blindCast(namespaceNode);\n}\n/**\n* Grades a {@link PolicyReplacement} as one unit against the table's\n* control policy, BEFORE the pair becomes calls or a conflict. This runs\n* ahead of `partitionCallsByControlPolicy`, which later re-grades the\n* surviving calls per-call — a no-op here, since only managed units\n* survive this grading.\n*\n* A replacement is deliberately STRICTER than the shared\n* `callAllowedUnderControlPolicy` rule: `tolerated` permits whole-object\n* creation, but a replacement's create is the second half of a repair of\n* an existing object, not a new object — so ANY non-managed control\n* (external, observed, tolerated) suppresses the whole unit. Drift on an\n* object the plan does not manage is reported, never repaired; the\n* suppression subject names the drifted policy (`rlsPolicy`) so the\n* report says which policy drifted, matching the conflict path's\n* `location.rlsPolicy`.\n*/\nfunction gradePolicyReplacement(replacement, contract, allowedOperationClasses) {\n\tconst subject = resolvePostgresCallControlPolicySubject(replacement.drop, contract);\n\tconst controlPolicy = controlPolicyForCall(subject, contract.defaultControlPolicy);\n\tif (controlPolicy !== \"managed\") return {\n\t\tdisposition: \"suppress\",\n\t\trecord: {\n\t\t\tsubject: subject === void 0 ? void 0 : {\n\t\t\t\t...subject,\n\t\t\t\trlsPolicy: replacement.drop.policyName\n\t\t\t},\n\t\t\tpolicy: controlPolicy,\n\t\t\tfactoryName: void 0,\n\t\t\tcreatesNewObject: false\n\t\t}\n\t};\n\tif (!allowedOperationClasses.includes(\"destructive\")) return {\n\t\tdisposition: \"conflict\",\n\t\tconflict: conflictForDisallowedCall(replacement.drop, allowedOperationClasses)\n\t};\n\treturn { disposition: \"plan\" };\n}\n/**\n* Rebuilds the `PostgresRlsPolicy` contract entity `CreatePostgresRlsPolicyCall`\n* carries (its `renderTypeScript`/`createRlsPolicy` paths serialize the whole\n* entity, `namespaceId` included). This reconstructs rather than looking the\n* original up in the contract on purpose: the diff node's `namespaceId` is the\n* *resolved DDL schema* (set when the expected tree was built), which is the\n* value the emitted op must carry; the contract-stored entity holds the raw,\n* pre-resolution coordinate, so a lookup would change the migration output.\n*/\nfunction policyNodeToContractPolicy(node) {\n\treturn new PostgresRlsPolicy({\n\t\tnaming: namingOf(node.name, node.prefix),\n\t\ttableName: node.tableName,\n\t\tnamespaceId: node.namespaceId,\n\t\toperation: node.operation,\n\t\troles: [...node.roles],\n\t\tusing: node.using,\n\t\twithCheck: node.withCheck,\n\t\tpermissive: node.permissive\n\t});\n}\n//#endregion\nexport { createPostgresMigrationPlanner as t };\n\n//# sourceMappingURL=planner-CqeT-P2q.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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;CACA,OAAO,EAAE,aAAa,OAAO;AAC9B;;;;;;;;;;AAUA,SAAS,2BAA2B,MAAM;CACzC,OAAO,IAAI,kBAAkB;EAC5B,QAAQ,SAAS,KAAK,MAAM,KAAK,MAAM;EACvC,WAAW,KAAK;EAChB,aAAa,KAAK;EAClB,WAAW,KAAK;EAChB,OAAO,CAAC,GAAG,KAAK,KAAK;EACrB,OAAO,KAAK;EACZ,WAAW,KAAK;EAChB,YAAY,KAAK;CAClB,CAAC;AACF"}
@@ -1,9 +1,9 @@
1
- import { n as postgresError } from "./errors-DKjQzNaN-DFcF1thx.mjs";
2
- import { n as isPgEnumParams } from "./codecs-BmPCJWqb-DveZGJvm.mjs";
3
- import { i as quoteQualifiedName, r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-DuzN3JZg-DiXy4Vah.mjs";
1
+ import { s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
2
+ import { n as isPgEnumParams } from "./codecs-CxWg7WrX-DtVAuuXA.mjs";
3
+ import { i as quoteQualifiedName, r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-6j9YTLpr-BCyCBPBg.mjs";
4
4
  import { t as resolveColumnTypeMetadata } from "./planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs";
5
5
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
6
- //#region ../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-Chxh-LEQ.mjs
6
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-CsfmnnKR.mjs
7
7
  /**
8
8
  * Pattern for safe PostgreSQL type names.
9
9
  * Allows letters, digits, underscores, spaces (for "double precision", "character varying"),
@@ -99,4 +99,4 @@ function renderArrayLiteralDefault(elements) {
99
99
  //#endregion
100
100
  export { buildColumnTypeSql as n, renderDefaultLiteral as r, buildColumnDefaultSql as t };
101
101
 
102
- //# sourceMappingURL=planner-ddl-builders-Chxh-LEQ-DXvwOeeA.mjs.map
102
+ //# sourceMappingURL=planner-ddl-builders-CsfmnnKR-CNn0fLyx.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-ddl-builders-Chxh-LEQ-DXvwOeeA.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-Chxh-LEQ.mjs"],"sourcesContent":["import { n as postgresError } from \"./errors-DKjQzNaN.mjs\";\nimport { n as isPgEnumParams } from \"./codecs-BmPCJWqb.mjs\";\nimport { i as quoteQualifiedName, r as quoteIdentifier, t as escapeLiteral } from \"./sql-utils-DuzN3JZg.mjs\";\nimport { t as resolveColumnTypeMetadata } from \"./planner-type-resolution-Bt2f_q-F.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\n//#region src/core/migrations/planner-ddl-builders.ts\n/**\n* Pattern for safe PostgreSQL type names.\n* Allows letters, digits, underscores, spaces (for \"double precision\", \"character varying\"),\n* and trailing [] for array types.\n*/\nconst SAFE_NATIVE_TYPE_PATTERN = /^[a-zA-Z][a-zA-Z0-9_ ]*(\\[\\])?$/;\nfunction assertSafeNativeType(nativeType) {\n\tif (!SAFE_NATIVE_TYPE_PATTERN.test(nativeType)) throw postgresError(\"CONTRACT.NATIVE_TYPE_INVALID\", `Unsafe native type name in contract: \"${nativeType}\". Native type names must match /^[a-zA-Z][a-zA-Z0-9_ ]*(\\\\[\\\\])?\\$/`, { meta: { nativeType } });\n}\n/**\n* Sanity check against accidental SQL injection from malformed contract files.\n* Rejects semicolons, SQL comment tokens, and dollar-quoting.\n* Not a comprehensive security boundary — the contract is developer-authored.\n*/\nfunction assertSafeDefaultExpression(expression) {\n\tif (expression.includes(\";\") || /--|\\/\\*|\\$\\$|\\bSELECT\\b/i.test(expression)) throw postgresError(\"CONTRACT.DEFAULT_INVALID\", `Unsafe default expression in contract: \"${expression}\". Default expressions must not contain semicolons, SQL comment tokens, dollar-quoting, or subqueries.`, { meta: { expression } });\n}\n/**\n* Renders the SQL type for a column in DDL context.\n*\n* @param allowPseudoTypes - When true (default), autoincrement integer columns\n* produce SERIAL/BIGSERIAL/SMALLSERIAL pseudo-types. Set to false for contexts\n* like ALTER COLUMN TYPE where pseudo-types are invalid.\n*/\nfunction buildColumnTypeSql(column, codecHooks, storageTypes = {}, allowPseudoTypes = true) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tif (allowPseudoTypes) {\n\t\tconst columnDefault = column.default;\n\t\tif (columnDefault?.kind === \"function\" && columnDefault.expression === \"autoincrement()\") {\n\t\t\tif (resolved.nativeType === \"int4\" || resolved.nativeType === \"integer\") return \"SERIAL\";\n\t\t\tif (resolved.nativeType === \"int8\" || resolved.nativeType === \"bigint\") return \"BIGSERIAL\";\n\t\t\tif (resolved.nativeType === \"int2\" || resolved.nativeType === \"smallint\") return \"SMALLSERIAL\";\n\t\t}\n\t}\n\tif (isPgEnumParams(resolved.typeParams)) {\n\t\tconst quoted = quoteQualifiedName(resolved.nativeType);\n\t\treturn column.many ? `${quoted}[]` : quoted;\n\t}\n\tconst expanded = expandParameterizedTypeSql(resolved, codecHooks);\n\tif (expanded !== null) return column.many ? `${expanded}[]` : expanded;\n\tif (column.typeRef) {\n\t\tconst base = quoteQualifiedName(resolved.nativeType);\n\t\treturn column.many ? `${base}[]` : base;\n\t}\n\tassertSafeNativeType(resolved.nativeType);\n\treturn column.many ? `${resolved.nativeType}[]` : resolved.nativeType;\n}\nfunction expandParameterizedTypeSql(column, codecHooks) {\n\tif (!column.typeParams || Object.keys(column.typeParams).length === 0) return null;\n\tif (!column.codecId) throw postgresError(\"CONTRACT.CODEC_DESCRIPTOR_MISSING\", `Column declares typeParams for nativeType \"${column.nativeType}\" but has no codecId. Ensure the column is associated with a codec.`, { meta: { nativeType: column.nativeType } });\n\tconst hooks = codecHooks.get(column.codecId);\n\tif (!hooks?.expandNativeType) {\n\t\tif (hooks?.planTypeOperations) return null;\n\t\tthrow postgresError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Column declares typeParams for nativeType \"${column.nativeType}\" but no expandNativeType hook is registered for codecId \"${column.codecId}\". Ensure the extension providing this codec is included in extensions.`, { meta: {\n\t\t\tcodecId: column.codecId,\n\t\t\tnativeType: column.nativeType\n\t\t} });\n\t}\n\tconst expanded = hooks.expandNativeType({\n\t\tnativeType: column.nativeType,\n\t\tcodecId: column.codecId,\n\t\t...ifDefined(\"typeParams\", column.typeParams)\n\t});\n\treturn expanded !== column.nativeType ? expanded : null;\n}\n/** Autoincrement columns use SERIAL types, so this returns empty for them. */\nfunction buildColumnDefaultSql(columnDefault, column) {\n\tif (!columnDefault) return \"\";\n\tswitch (columnDefault.kind) {\n\t\tcase \"literal\": return `DEFAULT ${renderDefaultLiteral(columnDefault.value, column)}`;\n\t\tcase \"function\":\n\t\t\tif (columnDefault.expression === \"autoincrement()\") return \"\";\n\t\t\tassertSafeDefaultExpression(columnDefault.expression);\n\t\t\treturn `DEFAULT (${columnDefault.expression})`;\n\t\tcase \"sequence\": return `DEFAULT nextval('${escapeLiteral(quoteIdentifier(columnDefault.name))}'::regclass)`;\n\t}\n}\nfunction renderDefaultLiteral(value, column) {\n\tconst isJsonColumn = column?.nativeType === \"json\" || column?.nativeType === \"jsonb\";\n\tif (column?.many && Array.isArray(value)) return renderArrayLiteralDefault(value);\n\tif (value instanceof Date) return `'${escapeLiteral(value.toISOString())}'`;\n\tif (typeof value === \"string\") return `'${escapeLiteral(value)}'`;\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n\tif (value === null) return \"NULL\";\n\tconst json = JSON.stringify(value);\n\tif (isJsonColumn) return `'${escapeLiteral(json)}'::${column.nativeType}`;\n\treturn `'${escapeLiteral(json)}'`;\n}\nfunction renderArrayLiteralDefault(elements) {\n\tif (elements.length === 0) return \"'{}'\";\n\treturn `ARRAY[${elements.map((el) => renderDefaultLiteral(el)).join(\", \")}]`;\n}\n//#endregion\nexport { buildColumnTypeSql as n, renderDefaultLiteral as r, buildColumnDefaultSql as t };\n\n//# sourceMappingURL=planner-ddl-builders-Chxh-LEQ.mjs.map"],"mappings":";;;;;;;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D,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW,OAAO,OAAO,KAAK;CAChF,IAAI,UAAU,MAAM,OAAO;CAC3B,MAAM,OAAO,KAAK,UAAU,KAAK;CACjC,IAAI,cAAc,OAAO,IAAI,cAAc,IAAI,EAAE,KAAK,OAAO;CAC7D,OAAO,IAAI,cAAc,IAAI,EAAE;AAChC;AACA,SAAS,0BAA0B,UAAU;CAC5C,IAAI,SAAS,WAAW,GAAG,OAAO;CAClC,OAAO,SAAS,SAAS,KAAK,OAAO,qBAAqB,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;AAC3E"}
1
+ {"version":3,"file":"planner-ddl-builders-CsfmnnKR-CNn0fLyx.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-CsfmnnKR.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { n as isPgEnumParams } from \"./codecs-CxWg7WrX.mjs\";\nimport { i as quoteQualifiedName, r as quoteIdentifier, t as escapeLiteral } from \"./sql-utils-6j9YTLpr.mjs\";\nimport { t as resolveColumnTypeMetadata } from \"./planner-type-resolution-Bt2f_q-F.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\n//#region src/core/migrations/planner-ddl-builders.ts\n/**\n* Pattern for safe PostgreSQL type names.\n* Allows letters, digits, underscores, spaces (for \"double precision\", \"character varying\"),\n* and trailing [] for array types.\n*/\nconst SAFE_NATIVE_TYPE_PATTERN = /^[a-zA-Z][a-zA-Z0-9_ ]*(\\[\\])?$/;\nfunction assertSafeNativeType(nativeType) {\n\tif (!SAFE_NATIVE_TYPE_PATTERN.test(nativeType)) throw postgresError(\"CONTRACT.NATIVE_TYPE_INVALID\", `Unsafe native type name in contract: \"${nativeType}\". Native type names must match /^[a-zA-Z][a-zA-Z0-9_ ]*(\\\\[\\\\])?\\$/`, { meta: { nativeType } });\n}\n/**\n* Sanity check against accidental SQL injection from malformed contract files.\n* Rejects semicolons, SQL comment tokens, and dollar-quoting.\n* Not a comprehensive security boundary — the contract is developer-authored.\n*/\nfunction assertSafeDefaultExpression(expression) {\n\tif (expression.includes(\";\") || /--|\\/\\*|\\$\\$|\\bSELECT\\b/i.test(expression)) throw postgresError(\"CONTRACT.DEFAULT_INVALID\", `Unsafe default expression in contract: \"${expression}\". Default expressions must not contain semicolons, SQL comment tokens, dollar-quoting, or subqueries.`, { meta: { expression } });\n}\n/**\n* Renders the SQL type for a column in DDL context.\n*\n* @param allowPseudoTypes - When true (default), autoincrement integer columns\n* produce SERIAL/BIGSERIAL/SMALLSERIAL pseudo-types. Set to false for contexts\n* like ALTER COLUMN TYPE where pseudo-types are invalid.\n*/\nfunction buildColumnTypeSql(column, codecHooks, storageTypes = {}, allowPseudoTypes = true) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tif (allowPseudoTypes) {\n\t\tconst columnDefault = column.default;\n\t\tif (columnDefault?.kind === \"function\" && columnDefault.expression === \"autoincrement()\") {\n\t\t\tif (resolved.nativeType === \"int4\" || resolved.nativeType === \"integer\") return \"SERIAL\";\n\t\t\tif (resolved.nativeType === \"int8\" || resolved.nativeType === \"bigint\") return \"BIGSERIAL\";\n\t\t\tif (resolved.nativeType === \"int2\" || resolved.nativeType === \"smallint\") return \"SMALLSERIAL\";\n\t\t}\n\t}\n\tif (isPgEnumParams(resolved.typeParams)) {\n\t\tconst quoted = quoteQualifiedName(resolved.nativeType);\n\t\treturn column.many ? `${quoted}[]` : quoted;\n\t}\n\tconst expanded = expandParameterizedTypeSql(resolved, codecHooks);\n\tif (expanded !== null) return column.many ? `${expanded}[]` : expanded;\n\tif (column.typeRef) {\n\t\tconst base = quoteQualifiedName(resolved.nativeType);\n\t\treturn column.many ? `${base}[]` : base;\n\t}\n\tassertSafeNativeType(resolved.nativeType);\n\treturn column.many ? `${resolved.nativeType}[]` : resolved.nativeType;\n}\nfunction expandParameterizedTypeSql(column, codecHooks) {\n\tif (!column.typeParams || Object.keys(column.typeParams).length === 0) return null;\n\tif (!column.codecId) throw postgresError(\"CONTRACT.CODEC_DESCRIPTOR_MISSING\", `Column declares typeParams for nativeType \"${column.nativeType}\" but has no codecId. Ensure the column is associated with a codec.`, { meta: { nativeType: column.nativeType } });\n\tconst hooks = codecHooks.get(column.codecId);\n\tif (!hooks?.expandNativeType) {\n\t\tif (hooks?.planTypeOperations) return null;\n\t\tthrow postgresError(\"CONTRACT.PACK_CONTRIBUTION_INVALID\", `Column declares typeParams for nativeType \"${column.nativeType}\" but no expandNativeType hook is registered for codecId \"${column.codecId}\". Ensure the extension providing this codec is included in extensions.`, { meta: {\n\t\t\tcodecId: column.codecId,\n\t\t\tnativeType: column.nativeType\n\t\t} });\n\t}\n\tconst expanded = hooks.expandNativeType({\n\t\tnativeType: column.nativeType,\n\t\tcodecId: column.codecId,\n\t\t...ifDefined(\"typeParams\", column.typeParams)\n\t});\n\treturn expanded !== column.nativeType ? expanded : null;\n}\n/** Autoincrement columns use SERIAL types, so this returns empty for them. */\nfunction buildColumnDefaultSql(columnDefault, column) {\n\tif (!columnDefault) return \"\";\n\tswitch (columnDefault.kind) {\n\t\tcase \"literal\": return `DEFAULT ${renderDefaultLiteral(columnDefault.value, column)}`;\n\t\tcase \"function\":\n\t\t\tif (columnDefault.expression === \"autoincrement()\") return \"\";\n\t\t\tassertSafeDefaultExpression(columnDefault.expression);\n\t\t\treturn `DEFAULT (${columnDefault.expression})`;\n\t\tcase \"sequence\": return `DEFAULT nextval('${escapeLiteral(quoteIdentifier(columnDefault.name))}'::regclass)`;\n\t}\n}\nfunction renderDefaultLiteral(value, column) {\n\tconst isJsonColumn = column?.nativeType === \"json\" || column?.nativeType === \"jsonb\";\n\tif (column?.many && Array.isArray(value)) return renderArrayLiteralDefault(value);\n\tif (value instanceof Date) return `'${escapeLiteral(value.toISOString())}'`;\n\tif (typeof value === \"string\") return `'${escapeLiteral(value)}'`;\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n\tif (value === null) return \"NULL\";\n\tconst json = JSON.stringify(value);\n\tif (isJsonColumn) return `'${escapeLiteral(json)}'::${column.nativeType}`;\n\treturn `'${escapeLiteral(json)}'`;\n}\nfunction renderArrayLiteralDefault(elements) {\n\tif (elements.length === 0) return \"'{}'\";\n\treturn `ARRAY[${elements.map((el) => renderDefaultLiteral(el)).join(\", \")}]`;\n}\n//#endregion\nexport { buildColumnTypeSql as n, renderDefaultLiteral as r, buildColumnDefaultSql as t };\n\n//# sourceMappingURL=planner-ddl-builders-CsfmnnKR.mjs.map"],"mappings":";;;;;;;;;;;AAWA,MAAM,2BAA2B;AACjC,SAAS,qBAAqB,YAAY;CACzC,IAAI,CAAC,yBAAyB,KAAK,UAAU,GAAG,MAAM,cAAc,gCAAgC,yCAAyC,WAAW,uEAAuE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACxP;;;;;;AAMA,SAAS,4BAA4B,YAAY;CAChD,IAAI,WAAW,SAAS,GAAG,KAAK,2BAA2B,KAAK,UAAU,GAAG,MAAM,cAAc,4BAA4B,2CAA2C,WAAW,yGAAyG,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACrT;;;;;;;;AAQA,SAAS,mBAAmB,QAAQ,YAAY,eAAe,CAAC,GAAG,mBAAmB,MAAM;CAC3F,MAAM,WAAW,0BAA0B,QAAQ,YAAY;CAC/D,IAAI,kBAAkB;EACrB,MAAM,gBAAgB,OAAO;EAC7B,IAAI,eAAe,SAAS,cAAc,cAAc,eAAe,mBAAmB;GACzF,IAAI,SAAS,eAAe,UAAU,SAAS,eAAe,WAAW,OAAO;GAChF,IAAI,SAAS,eAAe,UAAU,SAAS,eAAe,UAAU,OAAO;GAC/E,IAAI,SAAS,eAAe,UAAU,SAAS,eAAe,YAAY,OAAO;EAClF;CACD;CACA,IAAI,eAAe,SAAS,UAAU,GAAG;EACxC,MAAM,SAAS,mBAAmB,SAAS,UAAU;EACrD,OAAO,OAAO,OAAO,GAAG,OAAO,MAAM;CACtC;CACA,MAAM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oBAAoB,cAAc,gBAAgB,cAAc,IAAI,CAAC,EAAE;CAChG;AACD;AACA,SAAS,qBAAqB,OAAO,QAAQ;CAC5C,MAAM,eAAe,QAAQ,eAAe,UAAU,QAAQ,eAAe;CAC7E,IAAI,QAAQ,QAAQ,MAAM,QAAQ,KAAK,GAAG,OAAO,0BAA0B,KAAK;CAChF,IAAI,iBAAiB,MAAM,OAAO,IAAI,cAAc,MAAM,YAAY,CAAC,EAAE;CACzE,IAAI,OAAO,UAAU,UAAU,OAAO,IAAI,cAAc,KAAK,EAAE;CAC/D,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW,OAAO,OAAO,KAAK;CAChF,IAAI,UAAU,MAAM,OAAO;CAC3B,MAAM,OAAO,KAAK,UAAU,KAAK;CACjC,IAAI,cAAc,OAAO,IAAI,cAAc,IAAI,EAAE,KAAK,OAAO;CAC7D,OAAO,IAAI,cAAc,IAAI,EAAE;AAChC;AACA,SAAS,0BAA0B,UAAU;CAC5C,IAAI,SAAS,WAAW,GAAG,OAAO;CAClC,OAAO,SAAS,SAAS,KAAK,OAAO,qBAAqB,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;AAC3E"}
@@ -1,7 +1,7 @@
1
- import { t as PostgresMigration } from "./postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs";
2
- import { t as renderOps } from "./render-ops-DOsRP0Po-BKn_c_Ia.mjs";
1
+ import { t as PostgresMigration } from "./postgres-migration-DHvU3Jkt-Eah72PD4.mjs";
2
+ import { t as renderOps } from "./render-ops-D2vJApKB-B281fzmn.mjs";
3
3
  import { t as renderCallsToTypeScript } from "./render-typescript-Dqp1Spgn-B128r1qw.mjs";
4
- //#region ../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-D5m8nK6s.mjs
4
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-Dsri3SjC.mjs
5
5
  var TypeScriptRenderablePostgresMigration = class extends PostgresMigration {
6
6
  #calls;
7
7
  #meta;
@@ -44,4 +44,4 @@ var TypeScriptRenderablePostgresMigration = class extends PostgresMigration {
44
44
  //#endregion
45
45
  export { TypeScriptRenderablePostgresMigration as t };
46
46
 
47
- //# sourceMappingURL=planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs.map
47
+ //# sourceMappingURL=planner-produced-postgres-migration-Dsri3SjC-DZynrNO-.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs","names":["#calls","#meta","#spaceId","#snapshotsImportPath","#lowerer","#operationsCache"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-D5m8nK6s.mjs"],"sourcesContent":["import { t as PostgresMigration } from \"./postgres-migration-Dbq3RGfZ.mjs\";\nimport { t as renderOps } from \"./render-ops-DOsRP0Po.mjs\";\nimport { t as renderCallsToTypeScript } from \"./render-typescript-Dqp1Spgn.mjs\";\n//#region src/core/migrations/planner-produced-postgres-migration.ts\nvar TypeScriptRenderablePostgresMigration = class extends PostgresMigration {\n\t#calls;\n\t#meta;\n\t#spaceId;\n\t#snapshotsImportPath;\n\t#lowerer;\n\t#operationsCache;\n\tconstructor(calls, meta, spaceId, snapshotsImportPath, lowerer) {\n\t\tsuper();\n\t\tthis.#calls = calls;\n\t\tthis.#meta = meta;\n\t\tthis.#spaceId = spaceId;\n\t\tthis.#snapshotsImportPath = snapshotsImportPath;\n\t\tthis.#lowerer = lowerer;\n\t}\n\tget operations() {\n\t\tthis.#operationsCache ??= renderOps(this.#calls, this.#lowerer);\n\t\treturn this.#operationsCache;\n\t}\n\tdescribe() {\n\t\treturn this.#meta;\n\t}\n\t/**\n\t* Contract space this planner-produced plan applies to. Threaded\n\t* from the planner options so the runner keys the marker row by\n\t* the right space when executing the plan.\n\t*/\n\tget spaceId() {\n\t\treturn this.#spaceId;\n\t}\n\trenderTypeScript(resolveImportSpecifier) {\n\t\treturn renderCallsToTypeScript(this.#calls, {\n\t\t\tfrom: this.#meta.from,\n\t\t\tto: this.#meta.to,\n\t\t\tsnapshotsImportPath: this.#snapshotsImportPath,\n\t\t\tresolveImportSpecifier\n\t\t});\n\t}\n};\n//#endregion\nexport { TypeScriptRenderablePostgresMigration as t };\n\n//# sourceMappingURL=planner-produced-postgres-migration-D5m8nK6s.mjs.map"],"mappings":";;;;AAIA,IAAI,wCAAwC,cAAc,kBAAkB;CAC3E;CACA;CACA;CACA;CACA;CACA;CACA,YAAY,OAAO,MAAM,SAAS,qBAAqB,SAAS;EAC/D,MAAM;EACN,KAAKA,SAAS;EACd,KAAKC,QAAQ;EACb,KAAKC,WAAW;EAChB,KAAKC,uBAAuB;EAC5B,KAAKC,WAAW;CACjB;CACA,IAAI,aAAa;EAChB,KAAKC,qBAAqB,UAAU,KAAKL,QAAQ,KAAKI,QAAQ;EAC9D,OAAO,KAAKC;CACb;CACA,WAAW;EACV,OAAO,KAAKJ;CACb;;;;;;CAMA,IAAI,UAAU;EACb,OAAO,KAAKC;CACb;CACA,iBAAiB,wBAAwB;EACxC,OAAO,wBAAwB,KAAKF,QAAQ;GAC3C,MAAM,KAAKC,MAAM;GACjB,IAAI,KAAKA,MAAM;GACf,qBAAqB,KAAKE;GAC1B;EACD,CAAC;CACF;AACD"}
1
+ {"version":3,"file":"planner-produced-postgres-migration-Dsri3SjC-DZynrNO-.mjs","names":["#calls","#meta","#spaceId","#snapshotsImportPath","#lowerer","#operationsCache"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-Dsri3SjC.mjs"],"sourcesContent":["import { t as PostgresMigration } from \"./postgres-migration-DHvU3Jkt.mjs\";\nimport { t as renderOps } from \"./render-ops-D2vJApKB.mjs\";\nimport { t as renderCallsToTypeScript } from \"./render-typescript-Dqp1Spgn.mjs\";\n//#region src/core/migrations/planner-produced-postgres-migration.ts\nvar TypeScriptRenderablePostgresMigration = class extends PostgresMigration {\n\t#calls;\n\t#meta;\n\t#spaceId;\n\t#snapshotsImportPath;\n\t#lowerer;\n\t#operationsCache;\n\tconstructor(calls, meta, spaceId, snapshotsImportPath, lowerer) {\n\t\tsuper();\n\t\tthis.#calls = calls;\n\t\tthis.#meta = meta;\n\t\tthis.#spaceId = spaceId;\n\t\tthis.#snapshotsImportPath = snapshotsImportPath;\n\t\tthis.#lowerer = lowerer;\n\t}\n\tget operations() {\n\t\tthis.#operationsCache ??= renderOps(this.#calls, this.#lowerer);\n\t\treturn this.#operationsCache;\n\t}\n\tdescribe() {\n\t\treturn this.#meta;\n\t}\n\t/**\n\t* Contract space this planner-produced plan applies to. Threaded\n\t* from the planner options so the runner keys the marker row by\n\t* the right space when executing the plan.\n\t*/\n\tget spaceId() {\n\t\treturn this.#spaceId;\n\t}\n\trenderTypeScript(resolveImportSpecifier) {\n\t\treturn renderCallsToTypeScript(this.#calls, {\n\t\t\tfrom: this.#meta.from,\n\t\t\tto: this.#meta.to,\n\t\t\tsnapshotsImportPath: this.#snapshotsImportPath,\n\t\t\tresolveImportSpecifier\n\t\t});\n\t}\n};\n//#endregion\nexport { TypeScriptRenderablePostgresMigration as t };\n\n//# sourceMappingURL=planner-produced-postgres-migration-Dsri3SjC.mjs.map"],"mappings":";;;;AAIA,IAAI,wCAAwC,cAAc,kBAAkB;CAC3E;CACA;CACA;CACA;CACA;CACA;CACA,YAAY,OAAO,MAAM,SAAS,qBAAqB,SAAS;EAC/D,MAAM;EACN,KAAKA,SAAS;EACd,KAAKC,QAAQ;EACb,KAAKC,WAAW;EAChB,KAAKC,uBAAuB;EAC5B,KAAKC,WAAW;CACjB;CACA,IAAI,aAAa;EAChB,KAAKC,qBAAqB,UAAU,KAAKL,QAAQ,KAAKI,QAAQ;EAC9D,OAAO,KAAKC;CACb;CACA,WAAW;EACV,OAAO,KAAKJ;CACb;;;;;;CAMA,IAAI,UAAU;EACb,OAAO,KAAKC;CACb;CACA,iBAAiB,wBAAwB;EACxC,OAAO,wBAAwB,KAAKF,QAAQ;GAC3C,MAAM,KAAKC,MAAM;GACjB,IAAI,KAAKA,MAAM;GACf,qBAAqB,KAAKE;GAC1B;EACD,CAAC;CACF;AACD"}
@@ -1,7 +1,7 @@
1
- import { r as quoteIdentifier } from "./sql-utils-DuzN3JZg-DiXy4Vah.mjs";
2
- import { h as postgresCreateNamespace } from "./postgres-schema-CF0yHESb-D7n2X21R.mjs";
1
+ import { r as quoteIdentifier } from "./sql-utils-6j9YTLpr-BCyCBPBg.mjs";
2
+ import { h as postgresCreateNamespace } from "./postgres-schema-B3t7Zr52-CMlY9aGw.mjs";
3
3
  import { t as resolveColumnTypeMetadata } from "./planner-type-resolution-Bt2f_q-F-C4T6YTae.mjs";
4
- //#region ../../../3-targets/3-targets/postgres/dist/planner-sql-checks-ftgzvIO9.mjs
4
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-sql-checks-Bcngv5YZ.mjs
5
5
  /**
6
6
  * String-keyed entry points the migration ops use to render
7
7
  * schema-qualified DDL and catalog checks. The `schema` argument is
@@ -149,4 +149,4 @@ function buildExpectedFormatType(column, codecHooks, storageTypes = {}) {
149
149
  //#endregion
150
150
  export { qualifyTableName as n, buildExpectedFormatType as t };
151
151
 
152
- //# sourceMappingURL=planner-sql-checks-ftgzvIO9-BTtBg2Vz.mjs.map
152
+ //# sourceMappingURL=planner-sql-checks-Bcngv5YZ-Dnp05hSM.mjs.map