@prisma/orm-target-postgres 8.0.0-rc.1-dev.44 → 8.0.0-rc.1-dev.46

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 (96) hide show
  1. package/dist/{adapter-CaAPJalb-B2QNfZbf.mjs → adapter-B0xsc80z-sYcF0RVF.mjs} +28 -10
  2. package/dist/adapter-B0xsc80z-sYcF0RVF.mjs.map +1 -0
  3. package/dist/{adapter-CiyYJ6sy.d.mts → adapter-CPesdzv0.d.mts} +6 -2
  4. package/dist/{adapter-CiyYJ6sy.d.mts.map → adapter-CPesdzv0.d.mts.map} +1 -1
  5. package/dist/adapter.d.mts +1 -1
  6. package/dist/adapter.mjs +4 -4
  7. package/dist/adapter__adapter.d.mts +1 -1
  8. package/dist/adapter__adapter.mjs +1 -1
  9. package/dist/adapter__control.mjs +3 -3
  10. package/dist/adapter__control.mjs.map +1 -1
  11. package/dist/adapter__runtime.mjs +4 -4
  12. package/dist/adapter__runtime.mjs.map +1 -1
  13. package/dist/adapter__sql-renderer.mjs +1 -1
  14. package/dist/{authoring-bh6W1Fe5-D__Gfc6K.mjs → authoring-BOpdZa2N-ClrLFiXw.mjs} +4 -4
  15. package/dist/{authoring-bh6W1Fe5-D__Gfc6K.mjs.map → authoring-BOpdZa2N-ClrLFiXw.mjs.map} +1 -1
  16. package/dist/{check-expressions-drXwak3W-DqFpQtdc.mjs → check-expressions-5vhxWaFy-CBcjFeur.mjs} +3 -3
  17. package/dist/{check-expressions-drXwak3W-DqFpQtdc.mjs.map → check-expressions-5vhxWaFy-CBcjFeur.mjs.map} +1 -1
  18. package/dist/{codecs-C9-AwMlR.mjs → codecs-B1HgsJZ2.mjs} +2 -2
  19. package/dist/{codecs-C9-AwMlR.mjs.map → codecs-B1HgsJZ2.mjs.map} +1 -1
  20. package/dist/{codecs-dXnwOH7P-CIr-fArt.mjs → codecs-BmPCJWqb-DveZGJvm.mjs} +3 -3
  21. package/dist/{codecs-dXnwOH7P-CIr-fArt.mjs.map → codecs-BmPCJWqb-DveZGJvm.mjs.map} +1 -1
  22. package/dist/{contract-free-DOV_X620.mjs → contract-free-aQ4nT-_R.mjs} +3 -3
  23. package/dist/{contract-free-DOV_X620.mjs.map → contract-free-aQ4nT-_R.mjs.map} +1 -1
  24. package/dist/{control-DdSC-9L3.mjs → control-Drq2rquV.mjs} +8 -8
  25. package/dist/{control-DdSC-9L3.mjs.map → control-Drq2rquV.mjs.map} +1 -1
  26. package/dist/{control-adapter-CDXxUXH4--2IlV_vH.mjs → control-adapter-DFr4gS-r-DM3KcZdQ.mjs} +7 -7
  27. package/dist/{control-adapter-CDXxUXH4--2IlV_vH.mjs.map → control-adapter-DFr4gS-r-DM3KcZdQ.mjs.map} +1 -1
  28. package/dist/{control-policy-Cb-V9Wyh--ztBA5LG.mjs → control-policy-B53lnBCT-B9K9Cj1x.mjs} +6 -6
  29. package/dist/{control-policy-Cb-V9Wyh--ztBA5LG.mjs.map → control-policy-B53lnBCT-B9K9Cj1x.mjs.map} +1 -1
  30. package/dist/{ddl-DfzxUAlg-DvJZAdQx.mjs → ddl-CNQJds-C-WfZ3y4y8.mjs} +3 -3
  31. package/dist/{ddl-DfzxUAlg-DvJZAdQx.mjs.map → ddl-CNQJds-C-WfZ3y4y8.mjs.map} +1 -1
  32. package/dist/{descriptor-meta-DzQbQY6O-PYvgDC2L.mjs → descriptor-meta-KVX21fsl-DBDoB4eg.mjs} +4 -4
  33. package/dist/{descriptor-meta-DzQbQY6O-PYvgDC2L.mjs.map → descriptor-meta-KVX21fsl-DBDoB4eg.mjs.map} +1 -1
  34. package/dist/{descriptor-meta-ChnNOqso-Cc2MT-p1.mjs → descriptor-meta-rilAH3ep-dAmiVLpe.mjs} +6 -6
  35. package/dist/{descriptor-meta-ChnNOqso-Cc2MT-p1.mjs.map → descriptor-meta-rilAH3ep-dAmiVLpe.mjs.map} +1 -1
  36. package/dist/{diff-database-schema-Cgc6yPAr-Dtc6WYDZ.mjs → diff-database-schema-DKq76rCk-uehceHYz.mjs} +6 -6
  37. package/dist/{diff-database-schema-Cgc6yPAr-Dtc6WYDZ.mjs.map → diff-database-schema-DKq76rCk-uehceHYz.mjs.map} +1 -1
  38. package/dist/{errors-DCcVX4j1.d.mts → errors-CU4xIwwk.d.mts} +2 -2
  39. package/dist/{errors-DCcVX4j1.d.mts.map → errors-CU4xIwwk.d.mts.map} +1 -1
  40. package/dist/{errors-kYxOQjdD-D4T3rbVp.mjs → errors-DKjQzNaN-DFcF1thx.mjs} +4 -4
  41. package/dist/errors-DKjQzNaN-DFcF1thx.mjs.map +1 -0
  42. package/dist/migration-PTHAY9Cv.mjs.map +1 -1
  43. package/dist/{op-factory-call-BuAJIO_9-D4AoU_gQ.mjs → op-factory-call-H6zeDGLe-_1pAftJk.mjs} +7 -7
  44. package/dist/{op-factory-call-BuAJIO_9-D4AoU_gQ.mjs.map → op-factory-call-H6zeDGLe-_1pAftJk.mjs.map} +1 -1
  45. package/dist/{planner-DxwDv2Uf-BOSfEcQ1.mjs → planner-D0uogzvT-1WyGIC5p.mjs} +8 -8
  46. package/dist/{planner-DxwDv2Uf-BOSfEcQ1.mjs.map → planner-D0uogzvT-1WyGIC5p.mjs.map} +1 -1
  47. package/dist/{planner-ddl-builders-ConHfdcu-DwAriSzj.mjs → planner-ddl-builders-Chxh-LEQ-DXvwOeeA.mjs} +5 -5
  48. package/dist/{planner-ddl-builders-ConHfdcu-DwAriSzj.mjs.map → planner-ddl-builders-Chxh-LEQ-DXvwOeeA.mjs.map} +1 -1
  49. package/dist/{planner-produced-postgres-migration-C3rG2s2Q-B0Gg6xz7.mjs → planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs} +5 -5
  50. package/dist/{planner-produced-postgres-migration-C3rG2s2Q-B0Gg6xz7.mjs.map → planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs.map} +1 -1
  51. package/dist/{planner-sql-checks-DKialyGJ-BlU4hEEw.mjs → planner-sql-checks-ftgzvIO9-BTtBg2Vz.mjs} +4 -4
  52. package/dist/{planner-sql-checks-DKialyGJ-BlU4hEEw.mjs.map → planner-sql-checks-ftgzvIO9-BTtBg2Vz.mjs.map} +1 -1
  53. package/dist/{postgres-contract-view-B_0-lbVi-C4lFy3bt.mjs → postgres-contract-view-B8ykf2cO-T2LvWVFZ.mjs} +4 -4
  54. package/dist/{postgres-contract-view-B_0-lbVi-C4lFy3bt.mjs.map → postgres-contract-view-B8ykf2cO-T2LvWVFZ.mjs.map} +1 -1
  55. package/dist/{postgres-migration-umkQroaU-71tHIp16.mjs → postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs} +6 -6
  56. package/dist/{postgres-migration-umkQroaU-71tHIp16.mjs.map → postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs.map} +1 -1
  57. package/dist/{postgres-schema-CFOxDfUX-DTZtjh5X.mjs → postgres-schema-CF0yHESb-D7n2X21R.mjs} +3 -3
  58. package/dist/{postgres-schema-CFOxDfUX-DTZtjh5X.mjs.map → postgres-schema-CF0yHESb-D7n2X21R.mjs.map} +1 -1
  59. package/dist/{render-ops-DxzTxSsv-Bz85uUHk.mjs → render-ops-DOsRP0Po-BKn_c_Ia.mjs} +3 -3
  60. package/dist/{render-ops-DxzTxSsv-Bz85uUHk.mjs.map → render-ops-DOsRP0Po-BKn_c_Ia.mjs.map} +1 -1
  61. package/dist/{render-typescript-Cw3lFO28-Cx0lXWmv.mjs → render-typescript-Dqp1Spgn-B128r1qw.mjs} +3 -3
  62. package/dist/render-typescript-Dqp1Spgn-B128r1qw.mjs.map +1 -0
  63. package/dist/{resolve-ddl-schema-BIy8VDVK-Cb6hoVTS.mjs → resolve-ddl-schema-CoaeNP35-C-UZldpj.mjs} +3 -3
  64. package/dist/{resolve-ddl-schema-BIy8VDVK-Cb6hoVTS.mjs.map → resolve-ddl-schema-CoaeNP35-C-UZldpj.mjs.map} +1 -1
  65. package/dist/{sql-renderer-CZE98PJj-CHL66h-G.mjs → sql-renderer-ComgusFq-BBlqM1fw.mjs} +9 -17
  66. package/dist/sql-renderer-ComgusFq-BBlqM1fw.mjs.map +1 -0
  67. package/dist/{sql-utils-BnBlQxyh-DaX9Nb7Z.mjs → sql-utils-DuzN3JZg-DiXy4Vah.mjs} +3 -3
  68. package/dist/{sql-utils-BnBlQxyh-DaX9Nb7Z.mjs.map → sql-utils-DuzN3JZg-DiXy4Vah.mjs.map} +1 -1
  69. package/dist/target.d.mts +1 -1
  70. package/dist/target.mjs +21 -21
  71. package/dist/target__codecs.mjs +2 -2
  72. package/dist/target__contract-free.mjs +3 -3
  73. package/dist/target__control.mjs +1 -1
  74. package/dist/target__diff-database-schema.mjs +1 -1
  75. package/dist/target__errors.d.mts +1 -1
  76. package/dist/target__errors.mjs +1 -1
  77. package/dist/target__issue-planner.mjs +1 -1
  78. package/dist/target__migration.mjs +2 -2
  79. package/dist/target__op-factory-call.mjs +1 -1
  80. package/dist/target__pack.mjs +1 -1
  81. package/dist/target__planner-ddl-builders.mjs +1 -1
  82. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  83. package/dist/target__planner-sql-checks.mjs +1 -1
  84. package/dist/target__planner.mjs +2 -2
  85. package/dist/target__render-ops.mjs +1 -1
  86. package/dist/target__render-typescript.mjs +1 -1
  87. package/dist/target__runtime.mjs +1 -1
  88. package/dist/target__runtime.mjs.map +1 -1
  89. package/dist/target__schema-ir-annotations.mjs +1 -1
  90. package/dist/target__sql-utils.mjs +1 -1
  91. package/dist/target__types.mjs +2 -2
  92. package/package.json +9 -9
  93. package/dist/adapter-CaAPJalb-B2QNfZbf.mjs.map +0 -1
  94. package/dist/errors-kYxOQjdD-D4T3rbVp.mjs.map +0 -1
  95. package/dist/render-typescript-Cw3lFO28-Cx0lXWmv.mjs.map +0 -1
  96. package/dist/sql-renderer-CZE98PJj-CHL66h-G.mjs.map +0 -1
@@ -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-CFOxDfUX-DTZtjh5X.mjs";
2
+ import { d as isPostgresSchema, i as PostgresRlsPolicy } from "./postgres-schema-CF0yHESb-D7n2X21R.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-BIy8VDVK-Cb6hoVTS.mjs";
5
- import { A as RenameIndexCall, T as DropPostgresRlsPolicyCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, p as CreatePostgresRlsPolicyCall } from "./op-factory-call-BuAJIO_9-D4AoU_gQ.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-Cb-V9Wyh--ztBA5LG.mjs";
7
- import { t as buildPostgresPlanDiff } from "./diff-database-schema-Cgc6yPAr-Dtc6WYDZ.mjs";
8
- import { t as TypeScriptRenderablePostgresMigration } from "./planner-produced-postgres-migration-C3rG2s2Q-B0Gg6xz7.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";
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-DxwDv2Uf.mjs
16
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-D0uogzvT.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-DxwDv2Uf-BOSfEcQ1.mjs.map
671
+ //# sourceMappingURL=planner-D0uogzvT-1WyGIC5p.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-DxwDv2Uf-BOSfEcQ1.mjs","names":["#lowerer"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-DxwDv2Uf.mjs"],"sourcesContent":["import { t as DEFAULT_NAMESPACE_ID } from \"./namespace-ids-xtp_ZY86.mjs\";\nimport { _ as PostgresRlsPolicy, r as isPostgresSchema } from \"./postgres-schema-CFOxDfUX.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-BIy8VDVK.mjs\";\nimport { t as buildPostgresPlanDiff } from \"./diff-database-schema-Cgc6yPAr.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-Cb-V9Wyh.mjs\";\nimport { A as RenameIndexCall, T as DropPostgresRlsPolicyCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, p as CreatePostgresRlsPolicyCall } from \"./op-factory-call-BuAJIO_9.mjs\";\nimport { t as TypeScriptRenderablePostgresMigration } from \"./planner-produced-postgres-migration-C3rG2s2Q.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-DxwDv2Uf.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,sBA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AAwB,QAAQ,YAAY;CACpD,MAAM,iBAAiB,OAAO,OAAO,OAAO,UAAU;CACtD,MAAM,gBAAgB,eAAe,MAAM,SAAS,KAAK,eAAe,UAAU,KAAK,eAAe;CACtG,IAAI,kBAAkB,KAAK,GAAG,OAAO,KAAK;CAC1C,OAAO,UAAU,aAAa;AAC/B;;;;;;;;;;;;;;;;;;AAkBA,SAAS,uBAAuB,aAAa,UAAU,yBAAyB;CAC/E,MAAM,UAAU,wCAAwC,YAAY,MAAM,QAAQ;CAClF,MAAM,gBAAgB,qBAAqB,SAAS,SAAS,oBAAoB;CACjF,IAAI,kBAAkB,WAAW,OAAO;EACvC,aAAa;EACb,QAAQ;GACP,SAAS,YAAY,KAAK,IAAI,KAAK,IAAI;IACtC,GAAG;IACH,WAAW,YAAY,KAAK;GAC7B;GACA,QAAQ;GACR,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-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,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KAAK,GAAG,OAAO,KAAK;CAC1C,OAAO,UAAU,aAAa;AAC/B;;;;;;;;;;;;;;;;;;AAkBA,SAAS,uBAAuB,aAAa,UAAU,yBAAyB;CAC/E,MAAM,UAAU,wCAAwC,YAAY,MAAM,QAAQ;CAClF,MAAM,gBAAgB,qBAAqB,SAAS,SAAS,oBAAoB;CACjF,IAAI,kBAAkB,WAAW,OAAO;EACvC,aAAa;EACb,QAAQ;GACP,SAAS,YAAY,KAAK,IAAI,KAAK,IAAI;IACtC,GAAG;IACH,WAAW,YAAY,KAAK;GAC7B;GACA,QAAQ;GACR,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,9 +1,9 @@
1
- import { n as postgresError } from "./errors-kYxOQjdD-D4T3rbVp.mjs";
2
- import { n as isPgEnumParams } from "./codecs-dXnwOH7P-CIr-fArt.mjs";
3
- import { i as quoteQualifiedName, r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-BnBlQxyh-DaX9Nb7Z.mjs";
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";
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-ConHfdcu.mjs
6
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-Chxh-LEQ.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-ConHfdcu-DwAriSzj.mjs.map
102
+ //# sourceMappingURL=planner-ddl-builders-Chxh-LEQ-DXvwOeeA.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-ddl-builders-ConHfdcu-DwAriSzj.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-ddl-builders-ConHfdcu.mjs"],"sourcesContent":["import { n as postgresError } from \"./errors-kYxOQjdD.mjs\";\nimport { n as isPgEnumParams } from \"./codecs-dXnwOH7P.mjs\";\nimport { i as quoteQualifiedName, r as quoteIdentifier, t as escapeLiteral } from \"./sql-utils-BnBlQxyh.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-ConHfdcu.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,e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BAAqB,cAAc,OAAO,MAAM;EAClF,KAAK;GACJ,IAAI,cAAc,eAAe,mBAAmB,OAAO;GAC3D,4BAA4B,cAAc,UAAU;GACpD,OAAO,YAAY,cAAc,WAAW;EAC7C,KAAK,YAAY,OAAO,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
+ {"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":";;;;;;;;;;;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;;;;;;;;A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AAI,EAAE;AAC3E"}
@@ -1,7 +1,7 @@
1
- import { t as PostgresMigration } from "./postgres-migration-umkQroaU-71tHIp16.mjs";
2
- import { t as renderOps } from "./render-ops-DxzTxSsv-Bz85uUHk.mjs";
3
- import { t as renderCallsToTypeScript } from "./render-typescript-Cw3lFO28-Cx0lXWmv.mjs";
4
- //#region ../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-C3rG2s2Q.mjs
1
+ import { t as PostgresMigration } from "./postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs";
2
+ import { t as renderOps } from "./render-ops-DOsRP0Po-BKn_c_Ia.mjs";
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
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-C3rG2s2Q-B0Gg6xz7.mjs.map
47
+ //# sourceMappingURL=planner-produced-postgres-migration-D5m8nK6s-CbZ4hlbv.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-produced-postgres-migration-C3rG2s2Q-B0Gg6xz7.mjs","names":["#calls","#meta","#spaceId","#snapshotsImportPath","#lowerer","#operationsCache"],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-produced-postgres-migration-C3rG2s2Q.mjs"],"sourcesContent":["import { t as PostgresMigration } from \"./postgres-migration-umkQroaU.mjs\";\nimport { t as renderOps } from \"./render-ops-DxzTxSsv.mjs\";\nimport { t as renderCallsToTypeScript } from \"./render-typescript-Cw3lFO28.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-C3rG2s2Q.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-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,7 +1,7 @@
1
- import { r as quoteIdentifier } from "./sql-utils-BnBlQxyh-DaX9Nb7Z.mjs";
2
- import { h as postgresCreateNamespace } from "./postgres-schema-CFOxDfUX-DTZtjh5X.mjs";
1
+ import { r as quoteIdentifier } from "./sql-utils-DuzN3JZg-DiXy4Vah.mjs";
2
+ import { h as postgresCreateNamespace } from "./postgres-schema-CF0yHESb-D7n2X21R.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-DKialyGJ.mjs
4
+ //#region ../../../3-targets/3-targets/postgres/dist/planner-sql-checks-ftgzvIO9.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-DKialyGJ-BlU4hEEw.mjs.map
152
+ //# sourceMappingURL=planner-sql-checks-ftgzvIO9-BTtBg2Vz.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner-sql-checks-DKialyGJ-BlU4hEEw.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-sql-checks-DKialyGJ.mjs"],"sourcesContent":["import { i as postgresCreateNamespace } from \"./postgres-schema-CFOxDfUX.mjs\";\nimport { r as quoteIdentifier } from \"./sql-utils-BnBlQxyh.mjs\";\nimport { t as resolveColumnTypeMetadata } from \"./planner-type-resolution-Bt2f_q-F.mjs\";\n//#region src/core/migrations/planner-sql-checks.ts\n/**\n* String-keyed entry points the migration ops use to render\n* schema-qualified DDL and catalog checks. The `schema` argument is\n* interpreted as a namespace coordinate: the framework `__unbound__`\n* sentinel resolves to the late-bound `PostgresUnboundSchema` singleton\n* (which elides the qualifier so `search_path` decides at runtime); any\n* other id materialises a `PostgresSchema(id)` whose qualifier is the\n* named schema. Helpers route through these `Namespace` concretions so\n* the unbound branch lives in the polymorphic override, not the call\n* site.\n*/\nfunction qualifyTableName(schema, table) {\n\treturn postgresCreateNamespace({\n\t\tid: schema,\n\t\tentries: { table: {} }\n\t}).qualifyTable(table);\n}\nconst FORMAT_TYPE_DISPLAY = /* @__PURE__ */ new Map([\n\t[\"int2\", \"smallint\"],\n\t[\"int4\", \"integer\"],\n\t[\"int8\", \"bigint\"],\n\t[\"float4\", \"real\"],\n\t[\"float8\", \"double precision\"],\n\t[\"bool\", \"boolean\"],\n\t[\"timestamp\", \"timestamp without time zone\"],\n\t[\"timestamptz\", \"timestamp with time zone\"],\n\t[\"time\", \"time without time zone\"],\n\t[\"timetz\", \"time with time zone\"]\n]);\nconst UNQUOTED_POSTGRES_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_$]*$/;\nconst POSTGRES_RESERVED_IDENTIFIER_WORDS = /* @__PURE__ */ new Set([\n\t\"all\",\n\t\"analyse\",\n\t\"analyze\",\n\t\"and\",\n\t\"any\",\n\t\"array\",\n\t\"as\",\n\t\"asc\",\n\t\"asymmetric\",\n\t\"authorization\",\n\t\"between\",\n\t\"binary\",\n\t\"both\",\n\t\"case\",\n\t\"cast\",\n\t\"check\",\n\t\"collate\",\n\t\"column\",\n\t\"constraint\",\n\t\"create\",\n\t\"current_catalog\",\n\t\"current_date\",\n\t\"current_role\",\n\t\"current_time\",\n\t\"current_timestamp\",\n\t\"current_user\",\n\t\"default\",\n\t\"deferrable\",\n\t\"desc\",\n\t\"distinct\",\n\t\"do\",\n\t\"else\",\n\t\"end\",\n\t\"except\",\n\t\"false\",\n\t\"fetch\",\n\t\"for\",\n\t\"foreign\",\n\t\"freeze\",\n\t\"from\",\n\t\"full\",\n\t\"grant\",\n\t\"group\",\n\t\"having\",\n\t\"ilike\",\n\t\"in\",\n\t\"initially\",\n\t\"inner\",\n\t\"intersect\",\n\t\"into\",\n\t\"is\",\n\t\"isnull\",\n\t\"join\",\n\t\"lateral\",\n\t\"leading\",\n\t\"left\",\n\t\"like\",\n\t\"limit\",\n\t\"localtime\",\n\t\"localtimestamp\",\n\t\"natural\",\n\t\"not\",\n\t\"notnull\",\n\t\"null\",\n\t\"offset\",\n\t\"on\",\n\t\"only\",\n\t\"or\",\n\t\"order\",\n\t\"outer\",\n\t\"overlaps\",\n\t\"placing\",\n\t\"primary\",\n\t\"references\",\n\t\"right\",\n\t\"select\",\n\t\"session_user\",\n\t\"similar\",\n\t\"some\",\n\t\"symmetric\",\n\t\"table\",\n\t\"then\",\n\t\"to\",\n\t\"trailing\",\n\t\"true\",\n\t\"union\",\n\t\"unique\",\n\t\"user\",\n\t\"using\",\n\t\"variadic\",\n\t\"verbose\",\n\t\"when\",\n\t\"where\",\n\t\"window\",\n\t\"with\"\n]);\nfunction formatUserDefinedTypeName(identifier) {\n\tif (UNQUOTED_POSTGRES_IDENTIFIER_PATTERN.test(identifier) && !POSTGRES_RESERVED_IDENTIFIER_WORDS.has(identifier)) return identifier;\n\treturn quoteIdentifier(identifier);\n}\nfunction buildExpectedFormatType(column, codecHooks, storageTypes = {}) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tif (resolved.typeParams && resolved.codecId) {\n\t\tconst hooks = codecHooks.get(resolved.codecId);\n\t\tif (hooks?.expandNativeType) return hooks.expandNativeType({\n\t\t\tnativeType: resolved.nativeType,\n\t\t\tcodecId: resolved.codecId,\n\t\t\ttypeParams: resolved.typeParams\n\t\t});\n\t}\n\tif (column.typeRef) return formatUserDefinedTypeName(resolved.nativeType);\n\treturn FORMAT_TYPE_DISPLAY.get(resolved.nativeType) ?? resolved.nativeType;\n}\n//#endregion\nexport { qualifyTableName as n, buildExpectedFormatType as t };\n\n//# sourceMappingURL=planner-sql-checks-DKialyGJ.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,iBAAiB,QAAQ,OAAO;CACxC,OAAO,wBAAwB;EAC9B,IAAI;EACJ,SAAS,EAAE,OAAO,CAAC,EAAE;CACtB,CAAC,CAAC,CAAC,aAAa,KAAK;AACtB;AACA,MAAM,sCAAsC,IAAI,IAAI;CACnD,CAAC,QAAQ,UAAU;CACnB,CAAC,QAAQ,SAAS;CAClB,CAAC,QAAQ,QAAQ;CACjB,CAAC,UAAU,MAAM;CACjB,CAAC,UAAU,kBAAkB;CAC7B,CAAC,QAAQ,SAAS;CAClB,CAAC,aAAa,6BAA6B;CAC3C,CAAC,eAAe,0BAA0B;CAC1C,CAAC,QAAQ,wBAAwB;CACjC,CAAC,UAAU,qBAAqB;AACjC,CAAC;AACD,MAAM,uCAAuC;AAC7C,MAAM,qDAAqD,IAAI,IAAI;CAClE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,SAAS,0BAA0B,YAAY;CAC9C,IAAI,qCAAqC,KAAK,UAAU,KAAK,CAAC,mCAAmC,IAAI,UAAU,GAAG,OAAO;CACzH,OAAO,gBAAgB,UAAU;AAClC;AACA,SAAS,wBAAwB,QAAQ,YAAY,eAAe,CAAC,GAAG;CACvE,MAAM,WAAW,0BAA0B,QAAQ,YAAY;CAC/D,IAAI,SAAS,cAAc,SAAS,SAAS;EAC5C,MAAM,QAAQ,WAAW,IAAI,SAAS,OAAO;EAC7C,IAAI,OAAO,kBAAkB,OAAO,MAAM,iBAAiB;GAC1D,YAAY,SAAS;GACrB,SAAS,SAAS;GAClB,YAAY,SAAS;EACtB,CAAC;CACF;CACA,IAAI,OAAO,SAAS,OAAO,0BAA0B,SAAS,UAAU;CACxE,OAAO,oBAAoB,IAAI,SAAS,UAAU,KAAK,SAAS;AACjE"}
1
+ {"version":3,"file":"planner-sql-checks-ftgzvIO9-BTtBg2Vz.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/planner-sql-checks-ftgzvIO9.mjs"],"sourcesContent":["import { i as postgresCreateNamespace } from \"./postgres-schema-CF0yHESb.mjs\";\nimport { r as quoteIdentifier } from \"./sql-utils-DuzN3JZg.mjs\";\nimport { t as resolveColumnTypeMetadata } from \"./planner-type-resolution-Bt2f_q-F.mjs\";\n//#region src/core/migrations/planner-sql-checks.ts\n/**\n* String-keyed entry points the migration ops use to render\n* schema-qualified DDL and catalog checks. The `schema` argument is\n* interpreted as a namespace coordinate: the framework `__unbound__`\n* sentinel resolves to the late-bound `PostgresUnboundSchema` singleton\n* (which elides the qualifier so `search_path` decides at runtime); any\n* other id materialises a `PostgresSchema(id)` whose qualifier is the\n* named schema. Helpers route through these `Namespace` concretions so\n* the unbound branch lives in the polymorphic override, not the call\n* site.\n*/\nfunction qualifyTableName(schema, table) {\n\treturn postgresCreateNamespace({\n\t\tid: schema,\n\t\tentries: { table: {} }\n\t}).qualifyTable(table);\n}\nconst FORMAT_TYPE_DISPLAY = /* @__PURE__ */ new Map([\n\t[\"int2\", \"smallint\"],\n\t[\"int4\", \"integer\"],\n\t[\"int8\", \"bigint\"],\n\t[\"float4\", \"real\"],\n\t[\"float8\", \"double precision\"],\n\t[\"bool\", \"boolean\"],\n\t[\"timestamp\", \"timestamp without time zone\"],\n\t[\"timestamptz\", \"timestamp with time zone\"],\n\t[\"time\", \"time without time zone\"],\n\t[\"timetz\", \"time with time zone\"]\n]);\nconst UNQUOTED_POSTGRES_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_$]*$/;\nconst POSTGRES_RESERVED_IDENTIFIER_WORDS = /* @__PURE__ */ new Set([\n\t\"all\",\n\t\"analyse\",\n\t\"analyze\",\n\t\"and\",\n\t\"any\",\n\t\"array\",\n\t\"as\",\n\t\"asc\",\n\t\"asymmetric\",\n\t\"authorization\",\n\t\"between\",\n\t\"binary\",\n\t\"both\",\n\t\"case\",\n\t\"cast\",\n\t\"check\",\n\t\"collate\",\n\t\"column\",\n\t\"constraint\",\n\t\"create\",\n\t\"current_catalog\",\n\t\"current_date\",\n\t\"current_role\",\n\t\"current_time\",\n\t\"current_timestamp\",\n\t\"current_user\",\n\t\"default\",\n\t\"deferrable\",\n\t\"desc\",\n\t\"distinct\",\n\t\"do\",\n\t\"else\",\n\t\"end\",\n\t\"except\",\n\t\"false\",\n\t\"fetch\",\n\t\"for\",\n\t\"foreign\",\n\t\"freeze\",\n\t\"from\",\n\t\"full\",\n\t\"grant\",\n\t\"group\",\n\t\"having\",\n\t\"ilike\",\n\t\"in\",\n\t\"initially\",\n\t\"inner\",\n\t\"intersect\",\n\t\"into\",\n\t\"is\",\n\t\"isnull\",\n\t\"join\",\n\t\"lateral\",\n\t\"leading\",\n\t\"left\",\n\t\"like\",\n\t\"limit\",\n\t\"localtime\",\n\t\"localtimestamp\",\n\t\"natural\",\n\t\"not\",\n\t\"notnull\",\n\t\"null\",\n\t\"offset\",\n\t\"on\",\n\t\"only\",\n\t\"or\",\n\t\"order\",\n\t\"outer\",\n\t\"overlaps\",\n\t\"placing\",\n\t\"primary\",\n\t\"references\",\n\t\"right\",\n\t\"select\",\n\t\"session_user\",\n\t\"similar\",\n\t\"some\",\n\t\"symmetric\",\n\t\"table\",\n\t\"then\",\n\t\"to\",\n\t\"trailing\",\n\t\"true\",\n\t\"union\",\n\t\"unique\",\n\t\"user\",\n\t\"using\",\n\t\"variadic\",\n\t\"verbose\",\n\t\"when\",\n\t\"where\",\n\t\"window\",\n\t\"with\"\n]);\nfunction formatUserDefinedTypeName(identifier) {\n\tif (UNQUOTED_POSTGRES_IDENTIFIER_PATTERN.test(identifier) && !POSTGRES_RESERVED_IDENTIFIER_WORDS.has(identifier)) return identifier;\n\treturn quoteIdentifier(identifier);\n}\nfunction buildExpectedFormatType(column, codecHooks, storageTypes = {}) {\n\tconst resolved = resolveColumnTypeMetadata(column, storageTypes);\n\tif (resolved.typeParams && resolved.codecId) {\n\t\tconst hooks = codecHooks.get(resolved.codecId);\n\t\tif (hooks?.expandNativeType) return hooks.expandNativeType({\n\t\t\tnativeType: resolved.nativeType,\n\t\t\tcodecId: resolved.codecId,\n\t\t\ttypeParams: resolved.typeParams\n\t\t});\n\t}\n\tif (column.typeRef) return formatUserDefinedTypeName(resolved.nativeType);\n\treturn FORMAT_TYPE_DISPLAY.get(resolved.nativeType) ?? resolved.nativeType;\n}\n//#endregion\nexport { qualifyTableName as n, buildExpectedFormatType as t };\n\n//# sourceMappingURL=planner-sql-checks-ftgzvIO9.mjs.map"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,iBAAiB,QAAQ,OAAO;CACxC,OAAO,wBAAwB;EAC9B,IAAI;EACJ,SAAS,EAAE,OAAO,CAAC,EAAE;CACtB,CAAC,CAAC,CAAC,aAAa,KAAK;AACtB;AACA,MAAM,sCAAsC,IAAI,IAAI;CACnD,CAAC,QAAQ,UAAU;CACnB,CAAC,QAAQ,SAAS;CAClB,CAAC,QAAQ,QAAQ;CACjB,CAAC,UAAU,MAAM;CACjB,CAAC,UAAU,kBAAkB;CAC7B,CAAC,QAAQ,SAAS;CAClB,CAAC,aAAa,6BAA6B;CAC3C,CAAC,eAAe,0BAA0B;CAC1C,CAAC,QAAQ,wBAAwB;CACjC,CAAC,UAAU,qBAAqB;AACjC,CAAC;AACD,MAAM,uCAAuC;AAC7C,MAAM,qDAAqD,IAAI,IAAI;CAClE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AACD,SAAS,0BAA0B,YAAY;CAC9C,IAAI,qCAAqC,KAAK,UAAU,KAAK,CAAC,mCAAmC,IAAI,UAAU,GAAG,OAAO;CACzH,OAAO,gBAAgB,UAAU;AAClC;AACA,SAAS,wBAAwB,QAAQ,YAAY,eAAe,CAAC,GAAG;CACvE,MAAM,WAAW,0BAA0B,QAAQ,YAAY;CAC/D,IAAI,SAAS,cAAc,SAAS,SAAS;EAC5C,MAAM,QAAQ,WAAW,IAAI,SAAS,OAAO;EAC7C,IAAI,OAAO,kBAAkB,OAAO,MAAM,iBAAiB;GAC1D,YAAY,SAAS;GACrB,SAAS,SAAS;GAClB,YAAY,SAAS;EACtB,CAAC;CACF;CACA,IAAI,OAAO,SAAS,OAAO,0BAA0B,SAAS,UAAU;CACxE,OAAO,oBAAoB,IAAI,SAAS,UAAU,KAAK,SAAS;AACjE"}
@@ -1,6 +1,6 @@
1
1
  import { g as PG_INT_CODEC_ID, x as PG_TEXT_CODEC_ID } from "./codec-ids-C5Rkltkw-DMf87l9s.mjs";
2
- import { _ as roleEntityKind, c as PostgresSchema, f as nativeEnumEntityKind, g as rlsEnablementEntityKind, p as policyEntityKind } from "./postgres-schema-CFOxDfUX-DTZtjh5X.mjs";
3
- import { t as postgresAuthoringEntityTypes } from "./authoring-bh6W1Fe5-D__Gfc6K.mjs";
2
+ import { _ as roleEntityKind, c as PostgresSchema, f as nativeEnumEntityKind, g as rlsEnablementEntityKind, p as policyEntityKind } from "./postgres-schema-CF0yHESb-D7n2X21R.mjs";
3
+ import { t as postgresAuthoringEntityTypes } from "./authoring-BOpdZa2N-ClrLFiXw.mjs";
4
4
  import { blindCast } from "@prisma/orm-framework/utils/casts";
5
5
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
6
6
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
@@ -9,7 +9,7 @@ import { createPreserveEmptyPredicate } from "@prisma/orm-framework/contract/has
9
9
  import { SqlContractSerializerBase } from "@prisma/orm-family-sql/family/ir";
10
10
  import { isAuthoringEntityTypeDescriptor } from "@prisma/orm-framework/components/authoring";
11
11
  import { sqlContractCanonicalizationHooks } from "@prisma/orm-family-sql/contract/canonicalization-hooks";
12
- //#region ../../../3-targets/3-targets/postgres/dist/postgres-contract-view-B_0-lbVi.mjs
12
+ //#region ../../../3-targets/3-targets/postgres/dist/postgres-contract-view-B8ykf2cO.mjs
13
13
  const POSTGRES_AUTHORING_CTX = {
14
14
  family: "sql",
15
15
  target: "postgres",
@@ -141,4 +141,4 @@ const PostgresContractView = {
141
141
  //#endregion
142
142
  export { PostgresContractView as n, PostgresContractSerializer as t };
143
143
 
144
- //# sourceMappingURL=postgres-contract-view-B_0-lbVi-C4lFy3bt.mjs.map
144
+ //# sourceMappingURL=postgres-contract-view-B8ykf2cO-T2LvWVFZ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"postgres-contract-view-B_0-lbVi-C4lFy3bt.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-contract-view-B_0-lbVi.mjs"],"sourcesContent":["import { g as PG_INT_CODEC_ID, x as PG_TEXT_CODEC_ID } from \"./codec-ids-C5Rkltkw.mjs\";\nimport { a as nativeEnumEntityKind, c as roleEntityKind, o as policyEntityKind, s as rlsEnablementEntityKind, t as PostgresSchema } from \"./postgres-schema-CFOxDfUX.mjs\";\nimport { t as postgresAuthoringEntityTypes } from \"./authoring-bh6W1Fe5.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { buildSqlSchemaQualifiedView } from \"@internal/sql-contract/contract-view\";\nimport { createPreserveEmptyPredicate } from \"@internal/contract/hashing-utils\";\nimport { SqlContractSerializerBase } from \"@internal/family-sql/ir\";\nimport { isAuthoringEntityTypeDescriptor } from \"@internal/framework-components/authoring\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\n//#region src/core/postgres-contract-serializer.ts\nconst POSTGRES_AUTHORING_CTX = {\n\tfamily: \"sql\",\n\ttarget: \"postgres\",\n\tenumInferenceCodecs: {\n\t\ttext: PG_TEXT_CODEC_ID,\n\t\tint: PG_INT_CODEC_ID\n\t}\n};\nfunction isAuthoringEntityTypeFactoryOutput(output) {\n\treturn typeof output === \"object\" && output !== null && \"factory\" in output && typeof output.factory === \"function\";\n}\n/**\n* Walks a pack's entity-type namespace tree and emits hydration factories\n* keyed by the descriptor's `discriminator`. Used for `storage.types`\n* (codec-triple hydration). Namespace entries hydration dispatches by\n* entries key, not discriminator — handled by `hydrateNamespaceEntities`.\n*/\nfunction collectStorageTypesHydrators(namespace) {\n\tconst registry = /* @__PURE__ */ new Map();\n\tconst walk = (node) => {\n\t\tfor (const value of Object.values(node)) {\n\t\t\tif (isAuthoringEntityTypeDescriptor(value)) {\n\t\t\t\tif (isAuthoringEntityTypeFactoryOutput(value.output)) {\n\t\t\t\t\tconst { factory } = value.output;\n\t\t\t\t\tregistry.set(value.discriminator, (raw) => factory(raw, POSTGRES_AUTHORING_CTX));\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (typeof value === \"object\" && value !== null) walk(value);\n\t\t}\n\t};\n\twalk(namespace);\n\treturn registry;\n}\n/**\n* The canonicalization walk drops a field whose value equals its type's\n* default, which for a required field of an entity kind means the emitted\n* contract fails that kind's own schema on the next read (a RESTRICTIVE\n* policy's `permissive: false` is the live case). The set of fields that must\n* survive is therefore the required keys of the registered entity kinds —\n* read off the schemas rather than listed by hand, so a kind that gains a\n* required field is covered the day it gains one.\n*/\nfunction requiredEntityFieldsSurviveDefaults(kinds) {\n\treturn createPreserveEmptyPredicate(kinds.flatMap((kind) => requiredKeysOf(kind.schema).map((key) => [\n\t\t\"storage\",\n\t\t\"namespaces\",\n\t\t\"*\",\n\t\t\"entries\",\n\t\tkind.kind,\n\t\t\"*\",\n\t\tkey\n\t])));\n}\nfunction isSchemaPropList(value) {\n\treturn Array.isArray(value) && value.every((prop) => prop !== null && (typeof prop === \"object\" || typeof prop === \"function\") && \"kind\" in prop && \"key\" in prop);\n}\nfunction requiredKeysOf(schema) {\n\tconst props = \"props\" in schema ? schema.props : void 0;\n\tif (!isSchemaPropList(props)) throw new InternalError(\"entity-kind schema does not expose arktype object props; the required-field preserve set cannot be derived\");\n\treturn props.flatMap((prop) => prop.kind === \"required\" && typeof prop.key === \"string\" ? [prop.key] : []);\n}\nvar PostgresContractSerializer = class extends SqlContractSerializerBase {\n\tshouldPreserveEmpty;\n\tconstructor(extraPackEntityKinds = []) {\n\t\tconst storageTypesHydrators = collectStorageTypesHydrators(postgresAuthoringEntityTypes);\n\t\tconst entityKinds = [\n\t\t\tpolicyEntityKind,\n\t\t\troleEntityKind,\n\t\t\trlsEnablementEntityKind,\n\t\t\tnativeEnumEntityKind,\n\t\t\t...extraPackEntityKinds\n\t\t];\n\t\tsuper(storageTypesHydrators, entityKinds);\n\t\tconst preserveRequired = requiredEntityFieldsSurviveDefaults(entityKinds);\n\t\tthis.shouldPreserveEmpty = (path) => preserveRequired(path) || sqlContractCanonicalizationHooks.shouldPreserveEmpty(path);\n\t}\n\thydrateSqlNamespaceEntry(nsId, raw) {\n\t\tconst { id, entries } = blindCast(super.hydrateSqlNamespaceEntry(nsId, raw));\n\t\tconst allSlotsEmpty = Object.values(entries).every((slot) => slot === void 0 || Object.keys(slot).length === 0);\n\t\tif (id === UNBOUND_NAMESPACE_ID && allSlotsEmpty) return PostgresSchema.unbound;\n\t\tconst valueSetSlot = entries[\"valueSet\"];\n\t\tconst hasValueSets = valueSetSlot !== void 0 && Object.keys(valueSetSlot).length > 0;\n\t\treturn new PostgresSchema({\n\t\t\tid,\n\t\t\tentries: {\n\t\t\t\t...entries,\n\t\t\t\ttable: entries[\"table\"] ?? {},\n\t\t\t\t...hasValueSets ? { valueSet: valueSetSlot } : {}\n\t\t\t}\n\t\t});\n\t}\n\tserializeContract(contract) {\n\t\tconst { storage, ...rest } = contract;\n\t\tconst namespacesJson = {};\n\t\tfor (const [nsId, ns] of Object.entries(storage.namespaces)) {\n\t\t\tconst isUnboundSlot = ns.id === UNBOUND_NAMESPACE_ID;\n\t\t\tnamespacesJson[nsId] = {\n\t\t\t\tid: ns.id,\n\t\t\t\tkind: isUnboundSlot ? \"postgres-unbound-schema\" : \"postgres-schema\",\n\t\t\t\tentries: this.serializeNamespaceEntries(ns.entries)\n\t\t\t};\n\t\t}\n\t\tconst storageOut = {\n\t\t\tstorageHash: String(storage.storageHash),\n\t\t\tnamespaces: namespacesJson\n\t\t};\n\t\tif (storage.types !== void 0) {\n\t\t\tconst typesOut = {};\n\t\t\tfor (const [name, entry] of Object.entries(storage.types)) typesOut[name] = this.serializeJsonObject(entry);\n\t\t\tstorageOut[\"types\"] = typesOut;\n\t\t}\n\t\treturn blindCast({\n\t\t\t...rest,\n\t\t\tstorage: storageOut\n\t\t});\n\t}\n};\n//#endregion\n//#region src/core/postgres-contract-view.ts\nconst PostgresContractView = {\n\t/** Wrap an already-deserialized Postgres contract in a schema-qualified view. */\n\tfrom(contract) {\n\t\treturn buildSqlSchemaQualifiedView(contract);\n\t},\n\t/** Deserialize a Postgres contract JSON envelope and wrap it in a view. */\n\tfromJson(json) {\n\t\treturn buildSqlSchemaQualifiedView(new PostgresContractSerializer().deserializeContract(json));\n\t}\n};\n//#endregion\nexport { PostgresContractSerializer as n, PostgresContractView as t };\n\n//# sourceMappingURL=postgres-contract-view-B_0-lbVi.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,yBAAyB;CAC9B,QAAQ;CACR,QAAQ;CACR,qBAAqB;EACpB,MAAM;EACN,KAAK;CACN;AACD;AACA,SAAS,mCAAmC,QAAQ;CACnD,OAAO,OAAO,WAAW,YAAY,WAAW,QAAQ,aAAa,UAAU,OAAO,OAAO,YAAY;AAC1G;;;;;;;AAOA,SAAS,6BAA6B,WAAW;CAChD,MAAM,2BAA2B,IAAI,IAAI;CACzC,MAAM,QAAQ,SAAS;EACtB,KAAK,MAAM,SAAS,OAAO,OAAO,IAAI,GAAG;GACxC,IAAI,gCAAgC,KAAK,GAAG;IAC3C,IAAI,mCAAmC,MAAM,MAAM,GAAG;KACrD,MAAM,EAAE,YAAY,MAAM;KAC1B,SAAS,IAAI,MAAM,gBAAgB,QAAQ,QAAQ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s"],"sourcesContent":["import { g as PG_INT_CODEC_ID, x as PG_TEXT_CODEC_ID } from \"./codec-ids-C5Rkltkw.mjs\";\nimport { a as nativeEnumEntityKind, c as roleEntityKind, o as policyEntityKind, s as rlsEnablementEntityKind, t as PostgresSchema } from \"./postgres-schema-CF0yHESb.mjs\";\nimport { t as postgresAuthoringEntityTypes } from \"./authoring-BOpdZa2N.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { buildSqlSchemaQualifiedView } from \"@internal/sql-contract/contract-view\";\nimport { createPreserveEmptyPredicate } from \"@internal/contract/hashing-utils\";\nimport { SqlContractSerializerBase } from \"@internal/family-sql/ir\";\nimport { isAuthoringEntityTypeDescriptor } from \"@internal/framework-components/authoring\";\nimport { sqlContractCanonicalizationHooks } from \"@internal/sql-contract/canonicalization-hooks\";\n//#region src/core/postgres-contract-serializer.ts\nconst POSTGRES_AUTHORING_CTX = {\n\tfamily: \"sql\",\n\ttarget: \"postgres\",\n\tenumInferenceCodecs: {\n\t\ttext: PG_TEXT_CODEC_ID,\n\t\tint: PG_INT_CODEC_ID\n\t}\n};\nfunction isAuthoringEntityTypeFactoryOutput(output) {\n\treturn typeof output === \"object\" && output !== null && \"factory\" in output && typeof output.factory === \"function\";\n}\n/**\n* Walks a pack's entity-type namespace tree and emits hydration factories\n* keyed by the descriptor's `discriminator`. Used for `storage.types`\n* (codec-triple hydration). Namespace entries hydration dispatches by\n* entries key, not discriminator — handled by `hydrateNamespaceEntities`.\n*/\nfunction collectStorageTypesHydrators(namespace) {\n\tconst registry = /* @__PURE__ */ new Map();\n\tconst walk = (node) => {\n\t\tfor (const value of Object.values(node)) {\n\t\t\tif (isAuthoringEntityTypeDescriptor(value)) {\n\t\t\t\tif (isAuthoringEntityTypeFactoryOutput(value.output)) {\n\t\t\t\t\tconst { factory } = value.output;\n\t\t\t\t\tregistry.set(value.discriminator, (raw) => factory(raw, POSTGRES_AUTHORING_CTX));\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (typeof value === \"object\" && value !== null) walk(value);\n\t\t}\n\t};\n\twalk(namespace);\n\treturn registry;\n}\n/**\n* The canonicalization walk drops a field whose value equals its type's\n* default, which for a required field of an entity kind means the emitted\n* contract fails that kind's own schema on the next read (a RESTRICTIVE\n* policy's `permissive: false` is the live case). The set of fields that must\n* survive is therefore the required keys of the registered entity kinds —\n* read off the schemas rather than listed by hand, so a kind that gains a\n* required field is covered the day it gains one.\n*/\nfunction requiredEntityFieldsSurviveDefaults(kinds) {\n\treturn createPreserveEmptyPredicate(kinds.flatMap((kind) => requiredKeysOf(kind.schema).map((key) => [\n\t\t\"storage\",\n\t\t\"namespaces\",\n\t\t\"*\",\n\t\t\"entries\",\n\t\tkind.kind,\n\t\t\"*\",\n\t\tkey\n\t])));\n}\nfunction isSchemaPropList(value) {\n\treturn Array.isArray(value) && value.every((prop) => prop !== null && (typeof prop === \"object\" || typeof prop === \"function\") && \"kind\" in prop && \"key\" in prop);\n}\nfunction requiredKeysOf(schema) {\n\tconst props = \"props\" in schema ? schema.props : void 0;\n\tif (!isSchemaPropList(props)) throw new InternalError(\"entity-kind schema does not expose arktype object props; the required-field preserve set cannot be derived\");\n\treturn props.flatMap((prop) => prop.kind === \"required\" && typeof prop.key === \"string\" ? [prop.key] : []);\n}\nvar PostgresContractSerializer = class extends SqlContractSerializerBase {\n\tshouldPreserveEmpty;\n\tconstructor(extraPackEntityKinds = []) {\n\t\tconst storageTypesHydrators = collectStorageTypesHydrators(postgresAuthoringEntityTypes);\n\t\tconst entityKinds = [\n\t\t\tpolicyEntityKind,\n\t\t\troleEntityKind,\n\t\t\trlsEnablementEntityKind,\n\t\t\tnativeEnumEntityKind,\n\t\t\t...extraPackEntityKinds\n\t\t];\n\t\tsuper(storageTypesHydrators, entityKinds);\n\t\tconst preserveRequired = requiredEntityFieldsSurviveDefaults(entityKinds);\n\t\tthis.shouldPreserveEmpty = (path) => preserveRequired(path) || sqlContractCanonicalizationHooks.shouldPreserveEmpty(path);\n\t}\n\thydrateSqlNamespaceEntry(nsId, raw) {\n\t\tconst { id, entries } = blindCast(super.hydrateSqlNamespaceEntry(nsId, raw));\n\t\tconst allSlotsEmpty = Object.values(entries).every((slot) => slot === void 0 || Object.keys(slot).length === 0);\n\t\tif (id === UNBOUND_NAMESPACE_ID && allSlotsEmpty) return PostgresSchema.unbound;\n\t\tconst valueSetSlot = entries[\"valueSet\"];\n\t\tconst hasValueSets = valueSetSlot !== void 0 && Object.keys(valueSetSlot).length > 0;\n\t\treturn new PostgresSchema({\n\t\t\tid,\n\t\t\tentries: {\n\t\t\t\t...entries,\n\t\t\t\ttable: entries[\"table\"] ?? {},\n\t\t\t\t...hasValueSets ? { valueSet: valueSetSlot } : {}\n\t\t\t}\n\t\t});\n\t}\n\tserializeContract(contract) {\n\t\tconst { storage, ...rest } = contract;\n\t\tconst namespacesJson = {};\n\t\tfor (const [nsId, ns] of Object.entries(storage.namespaces)) {\n\t\t\tconst isUnboundSlot = ns.id === UNBOUND_NAMESPACE_ID;\n\t\t\tnamespacesJson[nsId] = {\n\t\t\t\tid: ns.id,\n\t\t\t\tkind: isUnboundSlot ? \"postgres-unbound-schema\" : \"postgres-schema\",\n\t\t\t\tentries: this.serializeNamespaceEntries(ns.entries)\n\t\t\t};\n\t\t}\n\t\tconst storageOut = {\n\t\t\tstorageHash: String(storage.storageHash),\n\t\t\tnamespaces: namespacesJson\n\t\t};\n\t\tif (storage.types !== void 0) {\n\t\t\tconst typesOut = {};\n\t\t\tfor (const [name, entry] of Object.entries(storage.types)) typesOut[name] = this.serializeJsonObject(entry);\n\t\t\tstorageOut[\"types\"] = typesOut;\n\t\t}\n\t\treturn blindCast({\n\t\t\t...rest,\n\t\t\tstorage: storageOut\n\t\t});\n\t}\n};\n//#endregion\n//#region src/core/postgres-contract-view.ts\nconst PostgresContractView = {\n\t/** Wrap an already-deserialized Postgres contract in a schema-qualified view. */\n\tfrom(contract) {\n\t\treturn buildSqlSchemaQualifiedView(contract);\n\t},\n\t/** Deserialize a Postgres contract JSON envelope and wrap it in a view. */\n\tfromJson(json) {\n\t\treturn buildSqlSchemaQualifiedView(new PostgresContractSerializer().deserializeContract(json));\n\t}\n};\n//#endregion\nexport { PostgresContractSerializer as n, PostgresContractView as t };\n\n//# sourceMappingURL=postgres-contract-view-B8ykf2cO.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,yBAAyB;CAC9B,QAAQ;CACR,QAAQ;CACR,qBAAqB;EACpB,MAAM;EACN,KAAK;CACN;AACD;AACA,SAAS,mCAAmC,QAAQ;CACnD,OAAO,OAAO,WAAW,YAAY,WAAW,QAAQ,aAAa,UAAU,OAAO,OAAO,YAAY;AAC1G;;;;;;;AAOA,SAAS,6BAA6B,WAAW;CAChD,MAAM,2BAA2B,IAAI,IAAI;CACzC,MAAM,QAAQ,SAAS;EACtB,KAAK,MAAM,SAAS,OAAO,OAAO,IAAI,GAAG;GACxC,IAAI,gCAAgC,KAAK,GAAG;IAC3C,IAAI,mCAAmC,MAAM,MAAM,GAAG;KACrD,MAAM,EAAE,YAAY,MAAM;KAC1B,SAAS,IAAI,MAAM,gBAAgB,QAAQ,QAAQ,KAAK,sBAAsB,CAAC;IAChF;IACA;GACD;GACA,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,KAAK,KAAK;EAC5D;CACD;CACA,KAAK,SAAS;CACd,OAAO;AACR;;;;;;;;;;AAUA,SAAS,oCAAoC,OAAO;CACnD,OAAO,6BAA6B,MAAM,SAAS,SAAS,eAAe,KAAK,MAAM,CAAC,CAAC,KAAK,QAAQ;EACpG;EACA;EACA;EACA;EACA,KAAK;EACL;EACA;CACD,CAAC,CAAC,CAAC;AACJ;AACA,SAAS,iBAAiB,OAAO;CAChC,OAAO,MAAM,QAAQ,KAAK,KAAK,MAAM,OAAO,SAAS,SAAS,SAAS,OAAO,SAAS,YAAY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,MAAM,OAAO,OAAO,QAAQ,QAAQ,UAAU,GAAG;GAC5D,MAAM,gBAAgB,GAAG,OAAO;GAChC,eAAe,QAAQ;IACtB,IAAI,GAAG;IACP,MAAM,gBAAgB,4BAA4B;IAClD,SAAS,KAAK,0BAA0B,GAAG,OAAO;GACnD;EACD;EACA,MAAM,aAAa;GAClB,aAAa,OAAO,QAAQ,WAAW;GACvC,YAAY;EACb;EACA,IAAI,QAAQ,UAAU,KAAK,GAAG;GAC7B,MAAM,WAAW,CAAC;GAClB,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,QAAQ,KAAK,GAAG,SAAS,QAAQ,KAAK,oBAAoB,KAAK;GAC1G,WAAW,WAAW;EACvB;EACA,OAAO,UAAU;GAChB,GAAG;GACH,SAAS;EACV,CAAC;CACF;AACD;AAGA,MAAM,uBAAuB;;CAE5B,KAAK,UAAU;EACd,OAAO,4BAA4B,QAAQ;CAC5C;;CAEA,SAAS,MAAM;EACd,OAAO,4BAA4B,IAAI,2BAA2B,CAAC,CAAC,oBAAoB,IAAI,CAAC;CAC9F;AACD"}
@@ -1,12 +1,12 @@
1
- import { t as errorPostgresMigrationStackMissing } from "./errors-kYxOQjdD-D4T3rbVp.mjs";
2
- import { i as PostgresRlsPolicy } from "./postgres-schema-CFOxDfUX-DTZtjh5X.mjs";
3
- import { A as RenameIndexCall, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, I as installExtension, M as SetDefaultCall, N as SetNotNullCall, S as DropIndexCall, T as DropPostgresRlsPolicyCall, _ as DisableRowLevelSecurityCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, h as CreateTableCall, i as AddNativeEnumValueCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, p as CreatePostgresRlsPolicyCall, r as AddForeignKeyCall, s as AddPrimaryKeyCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall } from "./op-factory-call-BuAJIO_9-D4AoU_gQ.mjs";
4
- import { n as PostgresContractView } from "./postgres-contract-view-B_0-lbVi-C4lFy3bt.mjs";
1
+ import { t as errorPostgresMigrationStackMissing } from "./errors-DKjQzNaN-DFcF1thx.mjs";
2
+ import { i as PostgresRlsPolicy } from "./postgres-schema-CF0yHESb-D7n2X21R.mjs";
3
+ import { A as RenameIndexCall, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, I as installExtension, M as SetDefaultCall, N as SetNotNullCall, S as DropIndexCall, T as DropPostgresRlsPolicyCall, _ as DisableRowLevelSecurityCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, h as CreateTableCall, i as AddNativeEnumValueCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, p as CreatePostgresRlsPolicyCall, r as AddForeignKeyCall, s as AddPrimaryKeyCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall } from "./op-factory-call-H6zeDGLe-_1pAftJk.mjs";
4
+ import { n as PostgresContractView } from "./postgres-contract-view-B8ykf2cO-T2LvWVFZ.mjs";
5
5
  import { t as dataTransform } from "./data-transform-ChZzy2dP-CxVCat_8.mjs";
6
6
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
7
7
  import { Migration } from "@prisma/orm-family-sql/family/migration";
8
8
  import { MigrationContractViews } from "@prisma/orm-toolchain/migration-tools/migration";
9
- //#region ../../../3-targets/3-targets/postgres/dist/postgres-migration-umkQroaU.mjs
9
+ //#region ../../../3-targets/3-targets/postgres/dist/postgres-migration-Dbq3RGfZ.mjs
10
10
  /**
11
11
  * Target-owned base class for Postgres migrations.
12
12
  *
@@ -202,4 +202,4 @@ var PostgresMigration = class extends Migration {
202
202
  //#endregion
203
203
  export { PostgresMigration as t };
204
204
 
205
- //# sourceMappingURL=postgres-migration-umkQroaU-71tHIp16.mjs.map
205
+ //# sourceMappingURL=postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"postgres-migration-umkQroaU-71tHIp16.mjs","names":["#endView","#startView"],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-migration-umkQroaU.mjs"],"sourcesContent":["import { t as errorPostgresMigrationStackMissing } from \"./errors-kYxOQjdD.mjs\";\nimport { _ as PostgresRlsPolicy } from \"./postgres-schema-CFOxDfUX.mjs\";\nimport { A as RenameIndexCall, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, L as installExtension, M as SetDefaultCall, N as SetNotNullCall, S as DropIndexCall, T as DropPostgresRlsPolicyCall, _ as DisableRowLevelSecurityCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, h as CreateTableCall, i as AddNativeEnumValueCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, p as CreatePostgresRlsPolicyCall, r as AddForeignKeyCall, s as AddPrimaryKeyCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall } from \"./op-factory-call-BuAJIO_9.mjs\";\nimport { t as PostgresContractView } from \"./postgres-contract-view-B_0-lbVi.mjs\";\nimport { t as dataTransform } from \"./data-transform-ChZzy2dP.mjs\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { Migration } from \"@internal/family-sql/migration\";\nimport { MigrationContractViews } from \"@internal/migration-tools/migration\";\n//#region src/core/migrations/postgres-migration.ts\n/**\n* Target-owned base class for Postgres migrations.\n*\n* Fixes the `SqlMigration` generic to `PostgresPlanTargetDetails` and the\n* abstract `targetId` to the Postgres target-id string literal, so both\n* user-authored migrations and renderer-generated scaffolds (the output of\n* `renderCallsToTypeScript`) can extend `PostgresMigration` directly without\n* redeclaring target-local identity.\n*\n* Mirrors `MongoMigration` in `@internal/family-mongo`: the renderer\n* emits `extends Migration` against a facade re-export of this class\n* from `@internal/postgres/migration`, keeping the authoring surface\n* target-scoped rather than family-scoped.\n*\n* The constructor materializes a single Postgres `SqlControlAdapter` from\n* `stack.adapter.create(stack)` and stores it; the protected `dataTransform`\n* instance method forwards to the free `dataTransform` factory with that\n* stored adapter, so user migrations can write `this.dataTransform(...)`\n* without threading the adapter through every call.\n*\n* Every method requires an explicit `schema`. Postgres migrations name their\n* schema deliberately — there is no default and no `search_path`-relative\n* option. A migration that left the schema unspecified would resolve against\n* whatever `search_path` the connection happened to carry, and that ambiguity\n* is an antipattern in a migration. (The unbound/unspecified namespace concept\n* remains for SQLite, which has no schemas, and for Mongo's connection `db`.)\n*/\nvar PostgresMigration = class extends Migration {\n\ttargetId = \"postgres\";\n\t/**\n\t* Materialized Postgres control adapter, created once per migration\n\t* instance from the injected stack. `undefined` only when the migration\n\t* was instantiated without a stack (test fixtures); `controlAdapterFor`\n\t* throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING in that case to surface the misuse.\n\t*/\n\tcontrolAdapter;\n\t#endView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\t#startView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\tconstructor(stack) {\n\t\tsuper(stack);\n\t\tthis.controlAdapter = stack?.adapter ? stack.adapter.create(stack) : void 0;\n\t}\n\t/**\n\t* Returns the materialized control adapter, or throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING naming\n\t* `operation` when the migration was constructed without a `ControlStack`.\n\t* Single home for the null-check that every DDL/DML method shares.\n\t*/\n\tcontrolAdapterFor(operation) {\n\t\tif (!this.controlAdapter) throw errorPostgresMigrationStackMissing(operation);\n\t\treturn this.controlAdapter;\n\t}\n\t/**\n\t* The typed, schema-qualified Postgres view over this migration's end-state\n\t* contract — `this.endContract.namespace.<schema>.table.<name>`, etc. Throws\n\t* if no `endContractJson` was provided.\n\t*/\n\tget endContract() {\n\t\treturn this.#endView.endContract;\n\t}\n\t/**\n\t* The typed Postgres view over this migration's start-state contract, or\n\t* `null` for a baseline migration (no `startContractJson`).\n\t*/\n\tget startContract() {\n\t\treturn this.#startView.startContract;\n\t}\n\t/**\n\t* Instance-method wrapper around the free `dataTransform` factory that\n\t* supplies the stored control adapter. Authors call this from inside\n\t* `get operations()`; the adapter argument is hidden from the call site.\n\t*/\n\tdataTransform(contract, name, options) {\n\t\treturn dataTransform(contract, name, options, this.controlAdapterFor(\"dataTransform\"));\n\t}\n\t/**\n\t* Emit a `CREATE TABLE` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateTable(options) {\n\t\treturn new CreateTableCall(options.schema, options.table, options.columns, options.constraints).toOp(this.controlAdapterFor(\"createTable\"));\n\t}\n\t/**\n\t* Emit a `CREATE SCHEMA` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateSchema(options) {\n\t\treturn new CreateSchemaCall(options.schema).toOp(this.controlAdapterFor(\"createSchema\"));\n\t}\n\t/**\n\t* Emit a `CREATE TYPE ... AS ENUM (...)` migration operation for a managed\n\t* native enum. Builds a typed DDL node and lowers it through the stored\n\t* control adapter (members render in declaration order). Throws if no adapter\n\t* is present.\n\t*/\n\tcreateNativeEnumType(options) {\n\t\treturn new CreateNativeEnumTypeCall(options.schema, options.typeName, options.members).toOp(this.controlAdapterFor(\"createNativeEnumType\"));\n\t}\n\t/**\n\t* Emit a `DROP TYPE` migration operation for a managed native enum, lowered\n\t* through the stored control adapter. Throws if no adapter is present.\n\t*/\n\tdropNativeEnumType(options) {\n\t\treturn new DropNativeEnumTypeCall(options.schema, options.typeName).toOp(this.controlAdapterFor(\"dropNativeEnumType\"));\n\t}\n\t/**\n\t* Emit an `ALTER TYPE ... ADD VALUE` migration operation appending one\n\t* member to a managed native enum, lowered through the stored control\n\t* adapter. Throws if no adapter is present. Every appended value is its\n\t* own operation — call this once per value to append more than one.\n\t*/\n\taddNativeEnumValue(options) {\n\t\treturn new AddNativeEnumValueCall(options.schema, options.typeName, options.value).toOp(this.controlAdapterFor(\"addNativeEnumValue\"));\n\t}\n\taddColumn(options) {\n\t\treturn new AddColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"addColumn\"));\n\t}\n\taddPrimaryKey(options) {\n\t\treturn new AddPrimaryKeyCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addPrimaryKey\"));\n\t}\n\taddUnique(options) {\n\t\treturn new AddUniqueCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addUnique\"));\n\t}\n\taddForeignKey(options) {\n\t\treturn new AddForeignKeyCall(options.schema, options.table, options.foreignKey).toOp(this.controlAdapterFor(\"addForeignKey\"));\n\t}\n\taddCheckConstraint(options) {\n\t\treturn new AddCheckConstraintCall(options.schema, options.table, options.constraint, options.expression).toOp(this.controlAdapterFor(\"addCheckConstraint\"));\n\t}\n\trenameCheckConstraint(options) {\n\t\treturn new RenameCheckConstraintCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.from, options.to).toOp(this.controlAdapterFor(\"renameCheckConstraint\"));\n\t}\n\tdropCheckConstraint(options) {\n\t\treturn new DropCheckConstraintCall(options.schema, options.table, options.constraint).toOp(this.controlAdapterFor(\"dropCheckConstraint\"));\n\t}\n\tdropConstraint(options) {\n\t\treturn new DropConstraintCall(options.schema, options.table, options.constraint, options.kind ?? \"unique\").toOp(this.controlAdapterFor(\"dropConstraint\"));\n\t}\n\tdropTable(options) {\n\t\treturn new DropTableCall(options.schema, options.table).toOp(this.controlAdapterFor(\"dropTable\"));\n\t}\n\tdropColumn(options) {\n\t\treturn new DropColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropColumn\"));\n\t}\n\talterColumnType(options) {\n\t\treturn new AlterColumnTypeCall(options.schema, options.table, options.column, options.options).toOp(this.controlAdapterFor(\"alterColumnType\"));\n\t}\n\tsetNotNull(options) {\n\t\treturn new SetNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"setNotNull\"));\n\t}\n\tdropNotNull(options) {\n\t\treturn new DropNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropNotNull\"));\n\t}\n\tsetDefault(options) {\n\t\treturn new SetDefaultCall(options.schema, options.table, options.column, options.defaultSql, options.operationClass).toOp(this.controlAdapterFor(\"setDefault\"));\n\t}\n\tdropDefault(options) {\n\t\treturn new DropDefaultCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropDefault\"));\n\t}\n\tcreateIndex(options) {\n\t\treturn new CreateIndexCall(options.schema, options.table, options.index, options.columns !== void 0 ? { columns: options.columns } : { expression: options.expression }, options.extras).toOp(this.controlAdapterFor(\"createIndex\"));\n\t}\n\trenameIndex(options) {\n\t\treturn new RenameIndexCall(options.schema, options.table, options.from, options.to).toOp(this.controlAdapterFor(\"renameIndex\"));\n\t}\n\tdropIndex(options) {\n\t\treturn new DropIndexCall(options.schema, options.table, options.index).toOp(this.controlAdapterFor(\"dropIndex\"));\n\t}\n\tinstallExtension(options) {\n\t\treturn installExtension(options, this.controlAdapterFor(\"installExtension\"));\n\t}\n\tenableRowLevelSecurity(options) {\n\t\treturn new EnableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"enableRowLevelSecurity\"));\n\t}\n\tdisableRowLevelSecurity(options) {\n\t\treturn new DisableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"disableRowLevelSecurity\"));\n\t}\n\tcreateRlsPolicy(options) {\n\t\treturn new CreatePostgresRlsPolicyCall(options.schema, options.table, new PostgresRlsPolicy({\n\t\t\t...options.policy,\n\t\t\tusing: options.policy.using,\n\t\t\twithCheck: options.policy.withCheck\n\t\t})).toOp(this.controlAdapterFor(\"createRlsPolicy\"));\n\t}\n\tdropRlsPolicy(options) {\n\t\treturn new DropPostgresRlsPolicyCall(options.schema, options.table, options.policy).toOp(this.controlAdapterFor(\"dropRlsPolicy\"));\n\t}\n\trenameRlsPolicy(options) {\n\t\treturn new RenamePostgresRlsPolicyCall(options.schema, options.table, options.from, options.to).toOp(this.controlAdapterFor(\"renameRlsPolicy\"));\n\t}\n};\n//#endregion\nexport { PostgresMigration as t };\n\n//# sourceMappingURL=postgres-migration-umkQroaU.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAI,oBAAoB,cAAc,UAAU;CAC/C,WAAW;;;;;;;CAOX;CACA,WAAW,IAAI,uBAAuB,MAAM,sBAAsB,SAAS,qBAAqB,SAAS,IAAI,CAAC;CAC9G,aAAa,IAAI,uBAAuB,MAAM,sBAAsB,SAAS,qBAAqB,SAAS,IAAI,CAAC;CAChH,YAAY,OAAO;EAClB,MAAM,KAAK;EACX,KAAK,iBAAiB,OAAO,UAAU,MAAM,QAAQ,OAAO,KAAK,IAAI,KAAK;CAC3E;;;;;;CAMA,kBAAkB,WAAW;EAC5B,IAAI,CAAC,KAAK,gBAAgB,MAAM,mCAAmC,SAAS;EAC5E,OAAO,KAAK;CACb;;;;;;CAMA,IAAI,cAAc;EACjB,OAAO,KAAKA,SAAS;CACtB;;;;;CAKA,IAAI,gBAAgB;EACnB,OAAO,KAAKC,WAAW;CACxB;;;;;;CAMA,cAAc,UAAU,MAAM,SAAS;EACtC,OAAO,cAAc,UAAU,MAAM,SAAS,KAAK,kBAAkB,eAAe,CAAC;CACtF;;;;;;CAMA,YAAY,SAAS;EACpB,OAAO,IAAI,gBAAgB,QAAQ,QAAQ,QAAQ,OAAO,QAAQ,SAAS,QAAQ,WAAW,CAAC,CAAC,K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QAAQ;GACX,OAAO,QAAQ,OAAO;GACtB,WAAW,QAAQ,OAAO;EAC3B,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,kBAAkB,iBAAiB,CAAC;CACnD;CACA,cAAc,SAAS;EACtB,OAAO,IAAI,0BAA0B,QAAQ,QAAQ,QAAQ,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,KAAK,kBAAkB,eAAe,CAAC;CACjI;CACA,gBAAgB,SAAS;EACxB,OAAO,IAAI,4BAA4B,QAAQ,QAAQ,QAAQ,OAAO,QAAQ,MAAM,QAAQ,EAAE,CAAC,CAAC,KAAK,KAAK,kBAAkB,iBAAiB,CAAC;CAC/I;AACD"}
1
+ {"version":3,"file":"postgres-migration-Dbq3RGfZ-aMnwfEAb.mjs","names":["#endView","#startView"],"sources":["../../../../3-targets/3-targets/postgres/dist/postgres-migration-Dbq3RGfZ.mjs"],"sourcesContent":["import { t as errorPostgresMigrationStackMissing } from \"./errors-DKjQzNaN.mjs\";\nimport { _ as PostgresRlsPolicy } from \"./postgres-schema-CF0yHESb.mjs\";\nimport { A as RenameIndexCall, C as DropNativeEnumTypeCall, D as EnableRowLevelSecurityCall, E as DropTableCall, L as installExtension, M as SetDefaultCall, N as SetNotNullCall, S as DropIndexCall, T as DropPostgresRlsPolicyCall, _ as DisableRowLevelSecurityCall, b as DropConstraintCall, c as AddUniqueCall, d as CreateIndexCall, f as CreateNativeEnumTypeCall, h as CreateTableCall, i as AddNativeEnumValueCall, j as RenamePostgresRlsPolicyCall, k as RenameCheckConstraintCall, l as AlterColumnTypeCall, m as CreateSchemaCall, n as AddColumnCall, p as CreatePostgresRlsPolicyCall, r as AddForeignKeyCall, s as AddPrimaryKeyCall, t as AddCheckConstraintCall, v as DropCheckConstraintCall, w as DropNotNullCall, x as DropDefaultCall, y as DropColumnCall } from \"./op-factory-call-H6zeDGLe.mjs\";\nimport { t as PostgresContractView } from \"./postgres-contract-view-B8ykf2cO.mjs\";\nimport { t as dataTransform } from \"./data-transform-ChZzy2dP.mjs\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { Migration } from \"@internal/family-sql/migration\";\nimport { MigrationContractViews } from \"@internal/migration-tools/migration\";\n//#region src/core/migrations/postgres-migration.ts\n/**\n* Target-owned base class for Postgres migrations.\n*\n* Fixes the `SqlMigration` generic to `PostgresPlanTargetDetails` and the\n* abstract `targetId` to the Postgres target-id string literal, so both\n* user-authored migrations and renderer-generated scaffolds (the output of\n* `renderCallsToTypeScript`) can extend `PostgresMigration` directly without\n* redeclaring target-local identity.\n*\n* Mirrors `MongoMigration` in `@internal/family-mongo`: the renderer\n* emits `extends Migration` against a facade re-export of this class\n* from `@internal/postgres/migration`, keeping the authoring surface\n* target-scoped rather than family-scoped.\n*\n* The constructor materializes a single Postgres `SqlControlAdapter` from\n* `stack.adapter.create(stack)` and stores it; the protected `dataTransform`\n* instance method forwards to the free `dataTransform` factory with that\n* stored adapter, so user migrations can write `this.dataTransform(...)`\n* without threading the adapter through every call.\n*\n* Every method requires an explicit `schema`. Postgres migrations name their\n* schema deliberately — there is no default and no `search_path`-relative\n* option. A migration that left the schema unspecified would resolve against\n* whatever `search_path` the connection happened to carry, and that ambiguity\n* is an antipattern in a migration. (The unbound/unspecified namespace concept\n* remains for SQLite, which has no schemas, and for Mongo's connection `db`.)\n*/\nvar PostgresMigration = class extends Migration {\n\ttargetId = \"postgres\";\n\t/**\n\t* Materialized Postgres control adapter, created once per migration\n\t* instance from the injected stack. `undefined` only when the migration\n\t* was instantiated without a stack (test fixtures); `controlAdapterFor`\n\t* throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING in that case to surface the misuse.\n\t*/\n\tcontrolAdapter;\n\t#endView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\t#startView = new MigrationContractViews(this, \"PostgresMigration\", (json) => PostgresContractView.fromJson(json));\n\tconstructor(stack) {\n\t\tsuper(stack);\n\t\tthis.controlAdapter = stack?.adapter ? stack.adapter.create(stack) : void 0;\n\t}\n\t/**\n\t* Returns the materialized control adapter, or throws a MIGRATION.POSTGRES_CONTROL_STACK_MISSING naming\n\t* `operation` when the migration was constructed without a `ControlStack`.\n\t* Single home for the null-check that every DDL/DML method shares.\n\t*/\n\tcontrolAdapterFor(operation) {\n\t\tif (!this.controlAdapter) throw errorPostgresMigrationStackMissing(operation);\n\t\treturn this.controlAdapter;\n\t}\n\t/**\n\t* The typed, schema-qualified Postgres view over this migration's end-state\n\t* contract — `this.endContract.namespace.<schema>.table.<name>`, etc. Throws\n\t* if no `endContractJson` was provided.\n\t*/\n\tget endContract() {\n\t\treturn this.#endView.endContract;\n\t}\n\t/**\n\t* The typed Postgres view over this migration's start-state contract, or\n\t* `null` for a baseline migration (no `startContractJson`).\n\t*/\n\tget startContract() {\n\t\treturn this.#startView.startContract;\n\t}\n\t/**\n\t* Instance-method wrapper around the free `dataTransform` factory that\n\t* supplies the stored control adapter. Authors call this from inside\n\t* `get operations()`; the adapter argument is hidden from the call site.\n\t*/\n\tdataTransform(contract, name, options) {\n\t\treturn dataTransform(contract, name, options, this.controlAdapterFor(\"dataTransform\"));\n\t}\n\t/**\n\t* Emit a `CREATE TABLE` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateTable(options) {\n\t\treturn new CreateTableCall(options.schema, options.table, options.columns, options.constraints).toOp(this.controlAdapterFor(\"createTable\"));\n\t}\n\t/**\n\t* Emit a `CREATE SCHEMA` migration operation. Builds a typed DDL node from\n\t* the supplied options and lowers it through the stored control adapter.\n\t* Throws if no adapter is present (i.e. migration instantiated without a stack).\n\t*/\n\tcreateSchema(options) {\n\t\treturn new CreateSchemaCall(options.schema).toOp(this.controlAdapterFor(\"createSchema\"));\n\t}\n\t/**\n\t* Emit a `CREATE TYPE ... AS ENUM (...)` migration operation for a managed\n\t* native enum. Builds a typed DDL node and lowers it through the stored\n\t* control adapter (members render in declaration order). Throws if no adapter\n\t* is present.\n\t*/\n\tcreateNativeEnumType(options) {\n\t\treturn new CreateNativeEnumTypeCall(options.schema, options.typeName, options.members).toOp(this.controlAdapterFor(\"createNativeEnumType\"));\n\t}\n\t/**\n\t* Emit a `DROP TYPE` migration operation for a managed native enum, lowered\n\t* through the stored control adapter. Throws if no adapter is present.\n\t*/\n\tdropNativeEnumType(options) {\n\t\treturn new DropNativeEnumTypeCall(options.schema, options.typeName).toOp(this.controlAdapterFor(\"dropNativeEnumType\"));\n\t}\n\t/**\n\t* Emit an `ALTER TYPE ... ADD VALUE` migration operation appending one\n\t* member to a managed native enum, lowered through the stored control\n\t* adapter. Throws if no adapter is present. Every appended value is its\n\t* own operation — call this once per value to append more than one.\n\t*/\n\taddNativeEnumValue(options) {\n\t\treturn new AddNativeEnumValueCall(options.schema, options.typeName, options.value).toOp(this.controlAdapterFor(\"addNativeEnumValue\"));\n\t}\n\taddColumn(options) {\n\t\treturn new AddColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"addColumn\"));\n\t}\n\taddPrimaryKey(options) {\n\t\treturn new AddPrimaryKeyCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addPrimaryKey\"));\n\t}\n\taddUnique(options) {\n\t\treturn new AddUniqueCall(options.schema, options.table, options.constraint, options.columns).toOp(this.controlAdapterFor(\"addUnique\"));\n\t}\n\taddForeignKey(options) {\n\t\treturn new AddForeignKeyCall(options.schema, options.table, options.foreignKey).toOp(this.controlAdapterFor(\"addForeignKey\"));\n\t}\n\taddCheckConstraint(options) {\n\t\treturn new AddCheckConstraintCall(options.schema, options.table, options.constraint, options.expression).toOp(this.controlAdapterFor(\"addCheckConstraint\"));\n\t}\n\trenameCheckConstraint(options) {\n\t\treturn new RenameCheckConstraintCall(options.schema ?? UNBOUND_NAMESPACE_ID, options.table, options.from, options.to).toOp(this.controlAdapterFor(\"renameCheckConstraint\"));\n\t}\n\tdropCheckConstraint(options) {\n\t\treturn new DropCheckConstraintCall(options.schema, options.table, options.constraint).toOp(this.controlAdapterFor(\"dropCheckConstraint\"));\n\t}\n\tdropConstraint(options) {\n\t\treturn new DropConstraintCall(options.schema, options.table, options.constraint, options.kind ?? \"unique\").toOp(this.controlAdapterFor(\"dropConstraint\"));\n\t}\n\tdropTable(options) {\n\t\treturn new DropTableCall(options.schema, options.table).toOp(this.controlAdapterFor(\"dropTable\"));\n\t}\n\tdropColumn(options) {\n\t\treturn new DropColumnCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropColumn\"));\n\t}\n\talterColumnType(options) {\n\t\treturn new AlterColumnTypeCall(options.schema, options.table, options.column, options.options).toOp(this.controlAdapterFor(\"alterColumnType\"));\n\t}\n\tsetNotNull(options) {\n\t\treturn new SetNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"setNotNull\"));\n\t}\n\tdropNotNull(options) {\n\t\treturn new DropNotNullCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropNotNull\"));\n\t}\n\tsetDefault(options) {\n\t\treturn new SetDefaultCall(options.schema, options.table, options.column, options.defaultSql, options.operationClass).toOp(this.controlAdapterFor(\"setDefault\"));\n\t}\n\tdropDefault(options) {\n\t\treturn new DropDefaultCall(options.schema, options.table, options.column).toOp(this.controlAdapterFor(\"dropDefault\"));\n\t}\n\tcreateIndex(options) {\n\t\treturn new CreateIndexCall(options.schema, options.table, options.index, options.columns !== void 0 ? { columns: options.columns } : { expression: options.expression }, options.extras).toOp(this.controlAdapterFor(\"createIndex\"));\n\t}\n\trenameIndex(options) {\n\t\treturn new RenameIndexCall(options.schema, options.table, options.from, options.to).toOp(this.controlAdapterFor(\"renameIndex\"));\n\t}\n\tdropIndex(options) {\n\t\treturn new DropIndexCall(options.schema, options.table, options.index).toOp(this.controlAdapterFor(\"dropIndex\"));\n\t}\n\tinstallExtension(options) {\n\t\treturn installExtension(options, this.controlAdapterFor(\"installExtension\"));\n\t}\n\tenableRowLevelSecurity(options) {\n\t\treturn new EnableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"enableRowLevelSecurity\"));\n\t}\n\tdisableRowLevelSecurity(options) {\n\t\treturn new DisableRowLevelSecurityCall(options.schema, options.table).toOp(this.controlAdapterFor(\"disableRowLevelSecurity\"));\n\t}\n\tcreateRlsPolicy(options) {\n\t\treturn new CreatePostgresRlsPolicyCall(options.schema, options.table, new PostgresRlsPolicy({\n\t\t\t...options.policy,\n\t\t\tusing: options.policy.using,\n\t\t\twithCheck: options.policy.withCheck\n\t\t})).toOp(this.controlAdapterFor(\"createRlsPolicy\"));\n\t}\n\tdropRlsPolicy(options) {\n\t\treturn new DropPostgresRlsPolicyCall(options.schema, options.table, options.policy).toOp(this.controlAdapterFor(\"dropRlsPolicy\"));\n\t}\n\trenameRlsPolicy(options) {\n\t\treturn new RenamePostgresRlsPolicyCall(options.schema, options.table, options.from, options.to).toOp(this.controlAdapterFor(\"renameRlsPolicy\"));\n\t}\n};\n//#endregion\nexport { PostgresMigration as t };\n\n//# sourceMappingURL=postgres-migration-Dbq3RGfZ.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,IAAI,oBAAoB,cAAc,UAAU;CAC/C,WAAW;;;;;;;CAOX;CACA,WAAW,IAAI,uBAAuB,MAAM,sBAAsB,SAAS,qBAAqB,SAAS,IAAI,CAAC;CAC9G,aAAa,IAAI,uBAAuB,MAAM,sBAAsB,SAAS,qBAAqB,SAAS,IAAI,CAAC;CAChH,YAAY,OAAO;EAClB,MAAM,KAAK;EACX,KAAK,iBAAiB,OAAO,UAAU,MAAM,QAAQ,OAAO,KAAK,IAAI,KAAK;CAC3E;;;;;;CAMA,kBAAkB,WAAW;EAC5B,IAAI,CAAC,KAAK,gBAAgB,MAAM,mCAAmC,SAAS;EAC5E,OAAO,KAAK;CACb;;;;;;CAMA,IAAI,cAAc;EACjB,OAAO,KAAKA,SAAS;CACtB;;;;;CAKA,I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