@prisma/orm-target-postgres 8.0.0-rc.14-dev.20 → 8.0.0-rc.14-dev.22
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.
- package/dist/{adapter-zLXT8Yxm-BX8ynGWu.mjs → adapter-CBoNuaSX-Lqzxy-Qt.mjs} +3 -3
- package/dist/{adapter-zLXT8Yxm-BX8ynGWu.mjs.map → adapter-CBoNuaSX-Lqzxy-Qt.mjs.map} +1 -1
- package/dist/{adapter-DmDLDsVW.d.mts → adapter-PLCU5rSG.d.mts} +3 -3
- package/dist/{adapter-DmDLDsVW.d.mts.map → adapter-PLCU5rSG.d.mts.map} +1 -1
- package/dist/adapter.d.mts +2 -2
- package/dist/adapter.mjs +2 -2
- package/dist/adapter__adapter.d.mts +1 -1
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__control.d.mts +1 -1
- package/dist/adapter__control.mjs +2 -2
- package/dist/adapter__control.mjs.map +1 -1
- package/dist/adapter__runtime.mjs +1 -1
- package/dist/adapter__runtime.mjs.map +1 -1
- package/dist/{contract-free-C0GQe4X_.mjs → contract-free-DeK6m1dy.mjs} +2 -2
- package/dist/{contract-free-C0GQe4X_.mjs.map → contract-free-DeK6m1dy.mjs.map} +1 -1
- package/dist/{contract-free-DFF0Xo-V.d.mts → contract-free-DlLLhKi4.d.mts} +2 -2
- package/dist/{contract-free-DFF0Xo-V.d.mts.map → contract-free-DlLLhKi4.d.mts.map} +1 -1
- package/dist/{control-9MzjJLOE.mjs → control-DAG9MxtD.mjs} +4 -4
- package/dist/{control-9MzjJLOE.mjs.map → control-DAG9MxtD.mjs.map} +1 -1
- package/dist/{control-CoZVI8XA.d.mts → control-RTK8NJRT.d.mts} +3 -3
- package/dist/{control-CoZVI8XA.d.mts.map → control-RTK8NJRT.d.mts.map} +1 -1
- package/dist/{control-adapter-DlHDFQw4-Awa40s5_.mjs → control-adapter-Rzj1Wx4j-om2RNriu.mjs} +12 -12
- package/dist/control-adapter-Rzj1Wx4j-om2RNriu.mjs.map +1 -0
- package/dist/{control-policy-B_b8ZqDi-zNYBao6-.mjs → control-policy-B8bHo3Q9-AAOwDoBr.mjs} +3 -3
- package/dist/{control-policy-B_b8ZqDi-zNYBao6-.mjs.map → control-policy-B8bHo3Q9-AAOwDoBr.mjs.map} +1 -1
- package/dist/ddl-B-WjvCal.d.mts +1 -0
- package/dist/{ddl-C6M0Hkbe-BSSauy2X.mjs → ddl-BQFDVert-CcDdETee.mjs} +17 -5
- package/dist/ddl-BQFDVert-CcDdETee.mjs.map +1 -0
- package/dist/{diff-database-schema-Cd6igMdS-CD3R7EC4.mjs → diff-database-schema-CjI2n0dA-Ct7kmfx1.mjs} +3 -3
- package/dist/{diff-database-schema-Cd6igMdS-CD3R7EC4.mjs.map → diff-database-schema-CjI2n0dA-Ct7kmfx1.mjs.map} +1 -1
- package/dist/{issue-planner-WWpJ3gOQ.d.mts → issue-planner-BdnqkLvV.d.mts} +2 -2
- package/dist/{issue-planner-WWpJ3gOQ.d.mts.map → issue-planner-BdnqkLvV.d.mts.map} +1 -1
- package/dist/{migration-DwqTcQ5d.d.mts → migration-D7F66l-1.d.mts} +3 -3
- package/dist/{migration-DwqTcQ5d.d.mts.map → migration-D7F66l-1.d.mts.map} +1 -1
- package/dist/migration-PTHAY9Cv.mjs.map +1 -1
- package/dist/{nodes-DAvDJLvJ-BBdvFXNa.mjs → nodes-Bm2a7z6e-BXTXyzZv.mjs} +3 -6
- package/dist/nodes-Bm2a7z6e-BXTXyzZv.mjs.map +1 -0
- package/dist/{nodes-BU-V-aZA-RqwPH68u.d.mts → nodes-C1fPapnK-j0AK7Gcj.d.mts} +21 -19
- package/dist/{nodes-BU-V-aZA-RqwPH68u.d.mts.map → nodes-C1fPapnK-j0AK7Gcj.d.mts.map} +1 -1
- package/dist/{op-factory-call-CmhDgfov-BjHdIpND.d.mts → op-factory-call-CaEALaar-Nh0fSxQY.d.mts} +3 -12
- package/dist/op-factory-call-CaEALaar-Nh0fSxQY.d.mts.map +1 -0
- package/dist/op-factory-call-DVz_g8zS.d.mts +1 -0
- package/dist/{op-factory-call-DYkz28kP-4BmpSB4B.mjs → op-factory-call-lH-yj1Bq-B1g2DpyX.mjs} +28 -17
- package/dist/op-factory-call-lH-yj1Bq-B1g2DpyX.mjs.map +1 -0
- package/dist/{planner-CbuWXI6E-CrlrOSd3.mjs → planner-BL0OunMk-D0tX0zP_.mjs} +7 -7
- package/dist/{planner-CbuWXI6E-CrlrOSd3.mjs.map → planner-BL0OunMk-D0tX0zP_.mjs.map} +1 -1
- package/dist/{planner-fD25Vk53.d.mts → planner-DECxo-qa.d.mts} +2 -2
- package/dist/{planner-fD25Vk53.d.mts.map → planner-DECxo-qa.d.mts.map} +1 -1
- package/dist/planner-produced-postgres-migration-BMfo2BlI.d.mts +1 -0
- package/dist/{planner-produced-postgres-migration-C3-L3nmn-BnqXdB_l.mjs → planner-produced-postgres-migration-BvZAIBgr-CkxXgqCM.mjs} +3 -3
- package/dist/{planner-produced-postgres-migration-C3-L3nmn-BnqXdB_l.mjs.map → planner-produced-postgres-migration-BvZAIBgr-CkxXgqCM.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-CMGC3vS6-CGdYLZFB.d.mts → planner-produced-postgres-migration-DE2Ia9Ba-hYITaAdW.d.mts} +3 -3
- package/dist/planner-produced-postgres-migration-DE2Ia9Ba-hYITaAdW.d.mts.map +1 -0
- package/dist/{postgres-migration-vpMSrXLQ-CJ72Zey3.d.mts → postgres-migration-BCzAcFmN-Bz_I02Gc.d.mts} +3 -3
- package/dist/{postgres-migration-vpMSrXLQ-CJ72Zey3.d.mts.map → postgres-migration-BCzAcFmN-Bz_I02Gc.d.mts.map} +1 -1
- package/dist/{postgres-migration-4qSv6qtX-Cj41qUBf.mjs → postgres-migration-DDStmEAq-BwizaNeP.mjs} +5 -5
- package/dist/{postgres-migration-4qSv6qtX-Cj41qUBf.mjs.map → postgres-migration-DDStmEAq-BwizaNeP.mjs.map} +1 -1
- package/dist/target.d.mts +12 -12
- package/dist/target.mjs +10 -10
- package/dist/target__contract-free.d.mts +1 -1
- package/dist/target__contract-free.mjs +2 -2
- package/dist/target__control.mjs +2 -2
- package/dist/target__ddl.d.mts +3 -3
- package/dist/target__ddl.mjs +1 -1
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__issue-planner.d.mts +1 -1
- package/dist/target__issue-planner.mjs +1 -1
- package/dist/target__migration.d.mts +2 -2
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.d.mts +2 -2
- package/dist/target__op-factory-call.mjs +1 -1
- package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner.d.mts +1 -1
- package/dist/target__planner.mjs +2 -2
- package/package.json +9 -9
- package/dist/control-adapter-DlHDFQw4-Awa40s5_.mjs.map +0 -1
- package/dist/ddl-B4Rh8ntj.d.mts +0 -1
- package/dist/ddl-C6M0Hkbe-BSSauy2X.mjs.map +0 -1
- package/dist/nodes-DAvDJLvJ-BBdvFXNa.mjs.map +0 -1
- package/dist/op-factory-call-CmhDgfov-BjHdIpND.d.mts.map +0 -1
- package/dist/op-factory-call-DYkz28kP-4BmpSB4B.mjs.map +0 -1
- package/dist/op-factory-call-DbjizP4b.d.mts +0 -1
- package/dist/planner-produced-postgres-migration-CMGC3vS6-CGdYLZFB.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-DJFPEI7l.d.mts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-database-schema-Cd6igMdS-CD3R7EC4.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/diff-database-schema-Cd6igMdS.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-C8slJGZo.mjs\";\nimport { n as postgresResolveDefault } from \"./default-normalizer-Cb7nWBUa.mjs\";\nimport { a as postgresDiffSubjectGranularity, n as PostgresNativeEnumSchemaNode, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode, t as PostgresRoleSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { t as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-Bq4m2dD9.mjs\";\nimport { i as resolvePostgresNodeIssueControlPolicySubject } from \"./control-policy-B_b8ZqDi.mjs\";\nimport { n as normalizeSchemaNativeType, r as withLengthOneWhenBare } from \"./native-type-normalizer-CW6g9Fut.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { diffSchemas, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { buildDataTypeResolver, buildNativeTypeExpander, contractNamespaceToSchemaIR } from \"@internal/family-sql/control\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { classifyDiffSubjectGranularity } from \"@internal/family-sql/diff\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from \"@internal/sql-schema-ir/types\";\n//#region src/core/migrations/contract-to-postgres-database-schema-node.ts\n/** The database root's fixed sentinel id (`PostgresDatabaseSchemaNode#id`). */\nfunction databaseStep() {\n\treturn {\n\t\tnodeKind: PostgresSchemaNodeKind.database,\n\t\tid: \"database\"\n\t};\n}\nfunction tableDependsOn(namespaceId, tableName) {\n\treturn [\n\t\tdatabaseStep(),\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.namespace,\n\t\t\tid: namespaceId\n\t\t},\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t}\n\t];\n}\nfunction roleDependsOn(role) {\n\treturn [databaseStep(), {\n\t\tnodeKind: PostgresSchemaNodeKind.role,\n\t\tid: role\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the Postgres tree.\n* Dropping a covered column auto-drops the object, so the object's drop must\n* precede the column's; the graph derives that direction from these edges.\n*/\nfunction columnDependsOn(namespaceId, tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(namespaceId, tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction toPolicyNode(policy, namespaceId) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\ttableName: policy.tableName,\n\t\tnamespaceId,\n\t\toperation: policy.operation,\n\t\troles: [...policy.roles],\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: [tableDependsOn(namespaceId, policy.tableName), ...policy.roles.map(roleDependsOn)]\n\t});\n}\n/**\n* Projects a Postgres contract into the expected schema-diff tree: a\n* `PostgresDatabaseSchemaNode` root holding one `PostgresNamespaceSchemaNode`\n* per Postgres namespace, each holding its `PostgresTableSchemaNode`s with\n* their `PostgresPolicySchemaNode`s, plus the database roles on the root.\n*\n* Not a duplicate of the family's `contractToSchemaIR`: that builds a flat,\n* single `{ tables }` map (and throws on cross-namespace name collisions, with\n* no RLS/role concept) for SQLite's single-schema world. This is the\n* Postgres-specific *tree* shape — multi-schema, RLS-policy-aware, role-aware.\n* It reuses the family's per-namespace table conversion (`contractNamespaceToSchemaIR`)\n* for column/FK/index building and only adds the Postgres tree/policy/role shape.\n*\n* Tables are grouped by their owning namespace (resolved DDL schema name) so\n* the tree mirrors Postgres's object hierarchy. The DDL schema name is\n* resolved once per namespace.\n*\n* A policy that references a table absent from its namespace is a malformed\n* contract — the loop throws rather than fabricating a stub table.\n*/\nfunction contractToPostgresDatabaseSchemaNode(contract, options) {\n\tif (contract === null) return new PostgresDatabaseSchemaNode({\n\t\tnamespaces: {},\n\t\troles: [],\n\t\texistingSchemas: [],\n\t\tpgVersion: \"\"\n\t});\n\tconst namespaces = {};\n\tconst roles = [];\n\tconst ownedSchemas = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) {\n\t\tif (!isPostgresSchema(ns)) continue;\n\t\tfor (const role of Object.values(ns.role)) roles.push(new PostgresRoleSchemaNode({\n\t\t\tname: role.name,\n\t\t\tnamespaceId: role.namespaceId\n\t\t}));\n\t\tif (ns.id === UNBOUND_NAMESPACE_ID) {\n\t\t\tif (!Object.entries(ns.entries).some(([entriesKey, slot]) => entriesKey !== \"role\" && Object.keys(slot).length > 0)) continue;\n\t\t}\n\t\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, ns.id);\n\t\townedSchemas.push(ddlSchema);\n\t\tconst sqlTables = contractNamespaceToSchemaIR(contract.storage, ns.id, options).tables;\n\t\tconst policiesByTable = /* @__PURE__ */ new Map();\n\t\tfor (const policy of Object.values(ns.policy)) {\n\t\t\tconst list = policiesByTable.get(policy.tableName) ?? [];\n\t\t\tlist.push(toPolicyNode(policy, ddlSchema));\n\t\t\tpoliciesByTable.set(policy.tableName, list);\n\t\t}\n\t\tconst tables = {};\n\t\tfor (const tableName of Object.keys(ns.table)) {\n\t\t\tconst sqlTable = sqlTables[tableName];\n\t\t\tif (sqlTable === void 0) continue;\n\t\t\tconst foreignKeys = sqlTable.foreignKeys.map((fk) => {\n\t\t\t\tconst resolvedReferencedNamespace = resolveDdlSchemaForNamespaceStorage(contract.storage, fk.referencedSchema ?? UNBOUND_NAMESPACE_ID);\n\t\t\t\treturn new SqlForeignKeyIR({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\treferencedSchema: fk.referencedSchema ?? UNBOUND_NAMESPACE_ID,\n\t\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t\t\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t\t\t\tresolvedReferencedNamespace,\n\t\t\t\t\tdependsOn: [tableDependsOn(resolvedReferencedNamespace, fk.referencedTable), ...columnDependsOn(ddlSchema, tableName, fk.columns)]\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst uniques = sqlTable.uniques.map((u) => new SqlUniqueIR({\n\t\t\t\tcolumns: u.columns,\n\t\t\t\t...ifDefined(\"name\", u.name),\n\t\t\t\t...ifDefined(\"annotations\", u.annotations),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, u.columns)\n\t\t\t}));\n\t\t\tconst indexes = sqlTable.indexes.map((i) => {\n\t\t\t\tconst base = {\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: i.type,\n\t\t\t\t\toptions: i.options,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, i.columns ?? Object.keys(sqlTable.columns))\n\t\t\t\t};\n\t\t\t\treturn new SqlIndexIR(i.expression !== void 0 ? {\n\t\t\t\t\t...base,\n\t\t\t\t\texpression: i.expression\n\t\t\t\t} : {\n\t\t\t\t\t...base,\n\t\t\t\t\tcolumns: i.columns ?? []\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst primaryKey = sqlTable.primaryKey !== void 0 ? new PrimaryKey({\n\t\t\t\tcolumns: sqlTable.primaryKey.columns,\n\t\t\t\t...ifDefined(\"name\", sqlTable.primaryKey.name),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, sqlTable.primaryKey.columns)\n\t\t\t}) : void 0;\n\t\t\ttables[tableName] = new PostgresTableSchemaNode({\n\t\t\t\tname: sqlTable.name,\n\t\t\t\tcolumns: sqlTable.columns,\n\t\t\t\tforeignKeys,\n\t\t\t\tuniques,\n\t\t\t\tindexes,\n\t\t\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\t\t\t...ifDefined(\"annotations\", sqlTable.annotations),\n\t\t\t\t...ifDefined(\"checks\", sqlTable.checks),\n\t\t\t\tpolicies: policiesByTable.get(tableName) ?? [],\n\t\t\t\trlsEnabled: Object.hasOwn(ns.rls, tableName)\n\t\t\t});\n\t\t}\n\t\tfor (const [tableName, tablePolicies] of policiesByTable) {\n\t\t\tif (!(tableName in tables)) {\n\t\t\t\tconst policyName = tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyName}\" references table \"${tableName}\" not present in namespace \"${ddlSchema}\"`, { meta: {\n\t\t\t\t\tpolicyName,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-missing\"\n\t\t\t\t} });\n\t\t\t}\n\t\t\tif (!Object.hasOwn(ns.rls, tableName)) {\n\t\t\t\tconst policyLabel = tablePolicies[0]?.prefix ?? tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyLabel}\" targets table \"${tableName}\" in namespace \"${ddlSchema}\", which is not RLS-controlled. Mark the model with @@rls (entries.rls[\"${tableName}\"]) or remove the policy.`, { meta: {\n\t\t\t\t\tpolicyName: policyLabel,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-not-rls-controlled\"\n\t\t\t\t} });\n\t\t\t}\n\t\t}\n\t\tnamespaces[ddlSchema] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlSchema,\n\t\t\ttables,\n\t\t\tnativeEnums: Object.values(ns.entries.native_enum ?? {}).map((entity) => new PostgresNativeEnumSchemaNode({\n\t\t\t\ttypeName: entity.typeName,\n\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\tmembers: entity.members,\n\t\t\t\t...ifDefined(\"control\", entity.control)\n\t\t\t}))\n\t\t});\n\t}\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles,\n\t\texistingSchemas: ownedSchemas,\n\t\tpgVersion: \"\"\n\t});\n}\n//#endregion\n//#region src/core/migrations/native-type-expander.ts\n/**\n* The family's native type expander, which expands a column's type parameters through its codec's hook, with the type named as introspection reports it: under PostgreSQL's canonical name rather than an alias such as `char` or `int`, and with `character` and `bit` without a length as `character(1)` and `bit(1)`.\n*/\nfunction buildPostgresNativeTypeExpander(frameworkComponents) {\n\tconst expand = buildNativeTypeExpander(frameworkComponents);\n\treturn (input) => {\n\t\treturn withLengthOneWhenBare(normalizeSchemaNativeType(expand === void 0 ? input.nativeType : expand(input)));\n\t};\n}\n//#endregion\n//#region src/core/migrations/diff-database-schema.ts\n/**\n* Whether a diff issue's subject node is cluster-scoped — it carries its own\n* `namespaceId` field (only role and policy diff nodes do) and that\n* coordinate is the unbound sentinel, meaning the node is not owned by any\n* schema/namespace. A role node is always cluster-scoped (roles are\n* cluster-level objects); a policy node's `namespaceId` is always its\n* table's resolved DDL schema, never the sentinel. Namespace-ownership\n* scoping (which compares `issue.path[1]` against the set of DDL schemas\n* the contract owns) makes no sense for a cluster-scoped subject — its path\n* segment at that index is the object's own name, not a schema name — so\n* such an issue bypasses that scoping entirely.\n*/\nfunction isClusterScopedIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && nodeNamespaceId(node) === UNBOUND_NAMESPACE_ID;\n}\nfunction nodeNamespaceId(node) {\n\tif (!Object.hasOwn(node, \"namespaceId\")) return void 0;\n\treturn blindCast(node).namespaceId;\n}\nfunction ownedSchemaNames(expected) {\n\tconst policyNamespaces = Object.values(expected.namespaces).flatMap((ns) => Object.values(ns.tables).flatMap((t) => t.policies.map((p) => p.namespaceId)));\n\treturn /* @__PURE__ */ new Set([...policyNamespaces, ...expected.existingSchemas]);\n}\n/**\n* Drops contract namespaces that declare no tables from the verdict-diff\n* expected tree and the relational owned-schema set. The legacy relational\n* walk skipped a table-less namespace (e.g. an enums-only schema) before\n* pairing, so neither its DDL schema's absence nor that schema's live\n* relational contents ever reached the verdict — the pruned tree\n* reproduces that. The prune loses no expected policies: policies attach\n* to tables, so a table-less namespace carries none (the projection\n* throws on a policy referencing an absent table). Live policies in a\n* pruned schema remain governed via the full owned set (see\n* {@link diffPostgresSchema}).\n*/\nfunction pruneTableLessNamespaces(expected) {\n\tconst namespaces = Object.fromEntries(Object.entries(expected.namespaces).filter(([, ns]) => Object.keys(ns.tables).length > 0));\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...expected.roles],\n\t\texistingSchemas: expected.existingSchemas.filter((s) => namespaces[s] !== void 0),\n\t\tpgVersion: expected.pgVersion\n\t});\n}\n/**\n* Resolves a verdict-diff issue's subject's declared control policy directly\n* from the contract, by delegating to the same node-typed resolver\n* ({@link resolvePostgresNodeIssueControlPolicySubject}) the planner uses to\n* gate DDL calls. `undefined` when the issue resolves to no contract subject.\n*\n* A role issue resolves through that same resolver to `external`\n* unconditionally (see its role branch), regardless of the contract's own\n* default policy: a role is referenced by the contract but not owned, and\n* `external`'s existing semantics — a missing declared subject still fails,\n* every extra is suppressed — are exactly the wanted asymmetric grading for\n* a cluster object the framework does not own.\n*/\nfunction resolveControlPolicy(issue, contract) {\n\treturn resolvePostgresNodeIssueControlPolicySubject(blindCast(issue), contract)?.explicitNodeControlPolicy;\n}\n/**\n* The Postgres full-tree node diff for the family verify verdict: derive\n* the expected tree (resolved leaf values, expander threaded, FK schemas\n* resolved, table-less namespaces pruned), run the generic\n* differ over the trees as derived, and scope out `not-expected` findings under namespaces the\n* contract does not own. Ownership scoping bypasses cluster-scoped subjects\n* (roles today), mirroring the legacy decomposition: relational extras check\n* the PRUNED owned set (the legacy\n* per-namespace walk never visited a table-less namespace, so its live\n* relational contents are invisible), while `structural` extras (RLS\n* policies) check the FULL owned set (the legacy policy diff governed\n* every contract schema regardless of tables — RLS governance does not\n* shrink because a namespace declares no tables). The codec `verifyType`\n* hooks run once per contract namespace with tables against that\n* namespace's paired actual node (the hooks read namespace-scoped state\n* such as `nativeEnums`).\n*/\nfunction diffPostgresSchema(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.schema);\n\tconst actual = input.schema;\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\texpandNativeType: buildPostgresNativeTypeExpander(input.frameworkComponents),\n\t\tresolveDefault: postgresResolveDefault,\n\t\t...ifDefined(\"dataTypeOf\", buildDataTypeResolver(input.frameworkComponents))\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\tissues: diffSchemas(expected, actual).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t}),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, postgresContract),\n\t\tnamespacePairs: Object.values(expected.namespaces).map((ns) => ({ actual: actual.namespaces[ns.schemaName] }))\n\t};\n}\n/**\n* Adds an empty namespace node to the actual tree for every expected namespace\n* absent from it. The relational plan diff pairs on namespace: a contract\n* namespace whose live schema does not exist yet must surface each of its\n* tables as `not-found` (→ `CREATE TABLE`), NOT as a single namespace\n* `not-found` that subtree-coalescing would collapse (leaving `CREATE SCHEMA`\n* with no tables). Padding makes the namespaces pair, so only table/column/\n* policy drift surfaces; `CREATE SCHEMA` comes separately from the synthesized\n* namespace-presence stitch (`verifyPostgresNamespacePresence`), never from the\n* tree diff — matching the retired per-namespace-paired relational walk, which\n* paired a missing schema against an empty namespace node.\n*/\nfunction padActualNamespaces(expected, actual) {\n\tconst namespaces = { ...actual.namespaces };\n\tlet padded = false;\n\tfor (const schemaName of Object.keys(expected.namespaces)) if (namespaces[schemaName] === void 0) {\n\t\tnamespaces[schemaName] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName,\n\t\t\ttables: {}\n\t\t});\n\t\tpadded = true;\n\t}\n\tif (!padded) return actual;\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...actual.roles],\n\t\texistingSchemas: [...actual.existingSchemas],\n\t\tpgVersion: actual.pgVersion\n\t});\n}\n/**\n* The Postgres planner's diff input: the SAME tree-building\n* `diffPostgresSchema` uses (expander threaded, FK schemas resolved,\n* table-less namespaces pruned, cluster-scope-aware ownership filter) plus\n* actual namespace padding (so a missing\n* schema's tables surface as `not-found` instead of a swallowed namespace\n* `not-found`). One differ drives both verify and plan; this is the\n* plan-side derivation. The single issue list covers tables / columns /\n* constraints / indexes / defaults AND policies — the caller splits it\n* (relational → `mapNodeIssueToCall`; policy → RLS ops) and stitches in\n* `CREATE SCHEMA` separately.\n*/\nfunction buildPostgresPlanDiff(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.actualSchema);\n\tconst actual = input.actualSchema;\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\texpandNativeType: buildPostgresNativeTypeExpander(input.frameworkComponents),\n\t\tresolveDefault: postgresResolveDefault,\n\t\t...ifDefined(\"dataTypeOf\", buildDataTypeResolver(input.frameworkComponents))\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst paddedActual = padActualNamespaces(expected, actual);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\texpected,\n\t\tactual: paddedActual,\n\t\tissues: blindCast(diffSchemas(expected, paddedActual)).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t})\n\t};\n}\n//#endregion\nexport { contractToPostgresDatabaseSchemaNode as i, diffPostgresSchema as n, buildPostgresNativeTypeExpander as r, buildPostgresPlanDiff as t };\n\n//# sourceMappingURL=diff-database-schema-Cd6igMdS.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,SAAS,eAAe;CACvB,OAAO;EACN,UAAU,uBAAuB;EACjC,IAAI;CACL;AACD;AACA,SAAS,eAAe,aAAa,WAAW;CAC/C,OAAO;EACN,aAAa;EACb;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;EACA;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;CACD;AACD;AACA,SAAS,cAAc,MAAM;CAC5B,OAAO,CAAC,aAAa,GAAG;EACvB,UAAU,uBAAuB;EACjC,IAAI;CACL,CAAC;AACF;;;;;;;AAOA,SAAS,gBAAgB,aAAa,WAAW,SAAS;CACzD,OAAO,QAAQ,KAAK,WAAW,CAAC,GAAG,eAAe,aAAa,SAAS,GAAG;EAC1E,UAAU,yBAAyB;EACnC,IAAI,UAAU;CACf,CAAC,CAAC;AACH;AACA,SAAS,aAAa,QAAQ,aAAa;CAC1C,OAAO,IAAI,yBAAyB;EACnC,QAAQ,SAAS,OAAO,MAAM,OAAO,MAAM;EAC3C,WAAW,OAAO;EAClB;EACA,WAAW,OAAO;EAClB,OAA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,gBAAgB,KAAK,GAAG;EACjG,WAAW,cAAc,IAAI,4BAA4B;GACxD;GACA,QAAQ,CAAC;EACV,CAAC;EACD,SAAS;CACV;CACA,IAAI,CAAC,QAAQ,OAAO;CACpB,OAAO,IAAI,2BAA2B;EACrC;EACA,OAAO,CAAC,GAAG,OAAO,KAAK;EACvB,iBAAiB,CAAC,GAAG,OAAO,eAAe;EAC3C,WAAW,OAAO;CACnB,CAAC;AACF;;;;;;;;;;;;;AAaA,SAAS,sBAAsB,OAAO;CACrC,MAAM,mBAAmB,UAAU,MAAM,QAAQ;CACjD,2BAA2B,OAAO,MAAM,YAAY;CACpD,MAAM,SAAS,MAAM;CACrB,MAAM,eAAe,qCAAqC,kBAAkB;EAC3E,qBAAqB;EACrB,kBAAkB,gCAAgC,MAAM,mBAAmB;EAC3E,gBAAgB;EAChB,GAAG,UAAU,cAAc,sBAAsB,MAAM,mBAAmB,CAAC;CAC5E,CAAC;CACD,MAAM,WAAW,yBAAyB,YAAY;CACtD,MAAM,eAAe,oBAAoB,UAAU,MAAM;CACzD,MAAM,kBAAkB,iBAAiB,QAAQ;CACjD,MAAM,kBAAkB,iBAAiB,YAAY;CACrD,OAAO;EACN;EACA,QAAQ;EACR,QAAQ,UAAU,YAAY,UAAU,YAAY,CAAC,CAAC,CAAC,QAAQ,UAAU;GACxE,IAAI,aAAa,KAAK,MAAM,gBAAgB,OAAO;GACnD,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,MAAM,cAAc,+BAA+B,OAAO,8BAA8B;GACxF,MAAM,mBAAmB,MAAM,KAAK;GACpC,IAAI,qBAAqB,KAAK,GAAG,OAAO;GACxC,QAAQ,gBAAgB,eAAe,kBAAkB,gBAAA,CAAiB,IAAI,gBAAgB;EAC/F,CAAC;CACF;AACD"}
|
|
1
|
+
{"version":3,"file":"diff-database-schema-CjI2n0dA-Ct7kmfx1.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/diff-database-schema-CjI2n0dA.mjs"],"sourcesContent":["import { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { r as isPostgresSchema } from \"./postgres-schema-C8slJGZo.mjs\";\nimport { n as postgresResolveDefault } from \"./default-normalizer-Cb7nWBUa.mjs\";\nimport { a as postgresDiffSubjectGranularity, n as PostgresNativeEnumSchemaNode, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from \"./postgres-table-schema-node-BBkitBQh.mjs\";\nimport { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode, t as PostgresRoleSchemaNode } from \"./postgres-role-schema-node-B8Z5i5D-.mjs\";\nimport { t as resolveDdlSchemaForNamespaceStorage } from \"./resolve-ddl-schema-Bq4m2dD9.mjs\";\nimport { i as resolvePostgresNodeIssueControlPolicySubject } from \"./control-policy-B8bHo3Q9.mjs\";\nimport { n as normalizeSchemaNativeType, r as withLengthOneWhenBare } from \"./native-type-normalizer-CW6g9Fut.mjs\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { diffSchemas, issueOutcome } from \"@internal/framework-components/control\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { buildDataTypeResolver, buildNativeTypeExpander, contractNamespaceToSchemaIR } from \"@internal/family-sql/control\";\nimport { namingOf } from \"@internal/sql-schema-ir/naming\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { classifyDiffSubjectGranularity } from \"@internal/family-sql/diff\";\nimport { PrimaryKey, RelationalSchemaNodeKind, SqlForeignKeyIR, SqlIndexIR, SqlUniqueIR } from \"@internal/sql-schema-ir/types\";\n//#region src/core/migrations/contract-to-postgres-database-schema-node.ts\n/** The database root's fixed sentinel id (`PostgresDatabaseSchemaNode#id`). */\nfunction databaseStep() {\n\treturn {\n\t\tnodeKind: PostgresSchemaNodeKind.database,\n\t\tid: \"database\"\n\t};\n}\nfunction tableDependsOn(namespaceId, tableName) {\n\treturn [\n\t\tdatabaseStep(),\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.namespace,\n\t\t\tid: namespaceId\n\t\t},\n\t\t{\n\t\t\tnodeKind: PostgresSchemaNodeKind.table,\n\t\t\tid: tableName\n\t\t}\n\t];\n}\nfunction roleDependsOn(role) {\n\treturn [databaseStep(), {\n\t\tnodeKind: PostgresSchemaNodeKind.role,\n\t\tid: role\n\t}];\n}\n/**\n* The chains from a table-child object (foreign key, index, unique, primary\n* key) to each of the own columns it is built on, in the Postgres tree.\n* Dropping a covered column auto-drops the object, so the object's drop must\n* precede the column's; the graph derives that direction from these edges.\n*/\nfunction columnDependsOn(namespaceId, tableName, columns) {\n\treturn columns.map((column) => [...tableDependsOn(namespaceId, tableName), {\n\t\tnodeKind: RelationalSchemaNodeKind.column,\n\t\tid: `column:${column}`\n\t}]);\n}\nfunction toPolicyNode(policy, namespaceId) {\n\treturn new PostgresPolicySchemaNode({\n\t\tnaming: namingOf(policy.name, policy.prefix),\n\t\ttableName: policy.tableName,\n\t\tnamespaceId,\n\t\toperation: policy.operation,\n\t\troles: [...policy.roles],\n\t\tusing: policy.using,\n\t\twithCheck: policy.withCheck,\n\t\tpermissive: policy.permissive,\n\t\tdependsOn: [tableDependsOn(namespaceId, policy.tableName), ...policy.roles.map(roleDependsOn)]\n\t});\n}\n/**\n* Projects a Postgres contract into the expected schema-diff tree: a\n* `PostgresDatabaseSchemaNode` root holding one `PostgresNamespaceSchemaNode`\n* per Postgres namespace, each holding its `PostgresTableSchemaNode`s with\n* their `PostgresPolicySchemaNode`s, plus the database roles on the root.\n*\n* Not a duplicate of the family's `contractToSchemaIR`: that builds a flat,\n* single `{ tables }` map (and throws on cross-namespace name collisions, with\n* no RLS/role concept) for SQLite's single-schema world. This is the\n* Postgres-specific *tree* shape — multi-schema, RLS-policy-aware, role-aware.\n* It reuses the family's per-namespace table conversion (`contractNamespaceToSchemaIR`)\n* for column/FK/index building and only adds the Postgres tree/policy/role shape.\n*\n* Tables are grouped by their owning namespace (resolved DDL schema name) so\n* the tree mirrors Postgres's object hierarchy. The DDL schema name is\n* resolved once per namespace.\n*\n* A policy that references a table absent from its namespace is a malformed\n* contract — the loop throws rather than fabricating a stub table.\n*/\nfunction contractToPostgresDatabaseSchemaNode(contract, options) {\n\tif (contract === null) return new PostgresDatabaseSchemaNode({\n\t\tnamespaces: {},\n\t\troles: [],\n\t\texistingSchemas: [],\n\t\tpgVersion: \"\"\n\t});\n\tconst namespaces = {};\n\tconst roles = [];\n\tconst ownedSchemas = [];\n\tfor (const ns of Object.values(contract.storage.namespaces)) {\n\t\tif (!isPostgresSchema(ns)) continue;\n\t\tfor (const role of Object.values(ns.role)) roles.push(new PostgresRoleSchemaNode({\n\t\t\tname: role.name,\n\t\t\tnamespaceId: role.namespaceId\n\t\t}));\n\t\tif (ns.id === UNBOUND_NAMESPACE_ID) {\n\t\t\tif (!Object.entries(ns.entries).some(([entriesKey, slot]) => entriesKey !== \"role\" && Object.keys(slot).length > 0)) continue;\n\t\t}\n\t\tconst ddlSchema = resolveDdlSchemaForNamespaceStorage(contract.storage, ns.id);\n\t\townedSchemas.push(ddlSchema);\n\t\tconst sqlTables = contractNamespaceToSchemaIR(contract.storage, ns.id, options).tables;\n\t\tconst policiesByTable = /* @__PURE__ */ new Map();\n\t\tfor (const policy of Object.values(ns.policy)) {\n\t\t\tconst list = policiesByTable.get(policy.tableName) ?? [];\n\t\t\tlist.push(toPolicyNode(policy, ddlSchema));\n\t\t\tpoliciesByTable.set(policy.tableName, list);\n\t\t}\n\t\tconst tables = {};\n\t\tfor (const tableName of Object.keys(ns.table)) {\n\t\t\tconst sqlTable = sqlTables[tableName];\n\t\t\tif (sqlTable === void 0) continue;\n\t\t\tconst foreignKeys = sqlTable.foreignKeys.map((fk) => {\n\t\t\t\tconst resolvedReferencedNamespace = resolveDdlSchemaForNamespaceStorage(contract.storage, fk.referencedSchema ?? UNBOUND_NAMESPACE_ID);\n\t\t\t\treturn new SqlForeignKeyIR({\n\t\t\t\t\tcolumns: fk.columns,\n\t\t\t\t\treferencedTable: fk.referencedTable,\n\t\t\t\t\treferencedColumns: fk.referencedColumns,\n\t\t\t\t\treferencedSchema: fk.referencedSchema ?? UNBOUND_NAMESPACE_ID,\n\t\t\t\t\t...ifDefined(\"name\", fk.name),\n\t\t\t\t\t...ifDefined(\"onDelete\", fk.onDelete),\n\t\t\t\t\t...ifDefined(\"onUpdate\", fk.onUpdate),\n\t\t\t\t\t...ifDefined(\"annotations\", fk.annotations),\n\t\t\t\t\tresolvedReferencedNamespace,\n\t\t\t\t\tdependsOn: [tableDependsOn(resolvedReferencedNamespace, fk.referencedTable), ...columnDependsOn(ddlSchema, tableName, fk.columns)]\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst uniques = sqlTable.uniques.map((u) => new SqlUniqueIR({\n\t\t\t\tcolumns: u.columns,\n\t\t\t\t...ifDefined(\"name\", u.name),\n\t\t\t\t...ifDefined(\"annotations\", u.annotations),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, u.columns)\n\t\t\t}));\n\t\t\tconst indexes = sqlTable.indexes.map((i) => {\n\t\t\t\tconst base = {\n\t\t\t\t\tnaming: namingOf(i.name, i.prefix),\n\t\t\t\t\twhere: i.where,\n\t\t\t\t\tunique: i.unique,\n\t\t\t\t\tpartial: i.partial,\n\t\t\t\t\ttype: i.type,\n\t\t\t\t\toptions: i.options,\n\t\t\t\t\tannotations: i.annotations,\n\t\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, i.columns ?? Object.keys(sqlTable.columns))\n\t\t\t\t};\n\t\t\t\treturn new SqlIndexIR(i.expression !== void 0 ? {\n\t\t\t\t\t...base,\n\t\t\t\t\texpression: i.expression\n\t\t\t\t} : {\n\t\t\t\t\t...base,\n\t\t\t\t\tcolumns: i.columns ?? []\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst primaryKey = sqlTable.primaryKey !== void 0 ? new PrimaryKey({\n\t\t\t\tcolumns: sqlTable.primaryKey.columns,\n\t\t\t\t...ifDefined(\"name\", sqlTable.primaryKey.name),\n\t\t\t\tdependsOn: columnDependsOn(ddlSchema, tableName, sqlTable.primaryKey.columns)\n\t\t\t}) : void 0;\n\t\t\ttables[tableName] = new PostgresTableSchemaNode({\n\t\t\t\tname: sqlTable.name,\n\t\t\t\tcolumns: sqlTable.columns,\n\t\t\t\tforeignKeys,\n\t\t\t\tuniques,\n\t\t\t\tindexes,\n\t\t\t\t...ifDefined(\"primaryKey\", primaryKey),\n\t\t\t\t...ifDefined(\"annotations\", sqlTable.annotations),\n\t\t\t\t...ifDefined(\"checks\", sqlTable.checks),\n\t\t\t\tpolicies: policiesByTable.get(tableName) ?? [],\n\t\t\t\trlsEnabled: Object.hasOwn(ns.rls, tableName)\n\t\t\t});\n\t\t}\n\t\tfor (const [tableName, tablePolicies] of policiesByTable) {\n\t\t\tif (!(tableName in tables)) {\n\t\t\t\tconst policyName = tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyName}\" references table \"${tableName}\" not present in namespace \"${ddlSchema}\"`, { meta: {\n\t\t\t\t\tpolicyName,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-missing\"\n\t\t\t\t} });\n\t\t\t}\n\t\t\tif (!Object.hasOwn(ns.rls, tableName)) {\n\t\t\t\tconst policyLabel = tablePolicies[0]?.prefix ?? tablePolicies[0]?.name ?? \"(unknown)\";\n\t\t\t\tthrow postgresError(\"CONTRACT.POLICY_INVALID\", `contract-to-postgres-database-schema-node: policy \"${policyLabel}\" targets table \"${tableName}\" in namespace \"${ddlSchema}\", which is not RLS-controlled. Mark the model with @@rls (entries.rls[\"${tableName}\"]) or remove the policy.`, { meta: {\n\t\t\t\t\tpolicyName: policyLabel,\n\t\t\t\t\ttableName,\n\t\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\t\treason: \"table-not-rls-controlled\"\n\t\t\t\t} });\n\t\t\t}\n\t\t}\n\t\tnamespaces[ddlSchema] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName: ddlSchema,\n\t\t\ttables,\n\t\t\tnativeEnums: Object.values(ns.entries.native_enum ?? {}).map((entity) => new PostgresNativeEnumSchemaNode({\n\t\t\t\ttypeName: entity.typeName,\n\t\t\t\tnamespaceId: ddlSchema,\n\t\t\t\tmembers: entity.members,\n\t\t\t\t...ifDefined(\"control\", entity.control)\n\t\t\t}))\n\t\t});\n\t}\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles,\n\t\texistingSchemas: ownedSchemas,\n\t\tpgVersion: \"\"\n\t});\n}\n//#endregion\n//#region src/core/migrations/native-type-expander.ts\n/**\n* The family's native type expander, which expands a column's type parameters through its codec's hook, with the type named as introspection reports it: under PostgreSQL's canonical name rather than an alias such as `char` or `int`, and with `character` and `bit` without a length as `character(1)` and `bit(1)`.\n*/\nfunction buildPostgresNativeTypeExpander(frameworkComponents) {\n\tconst expand = buildNativeTypeExpander(frameworkComponents);\n\treturn (input) => {\n\t\treturn withLengthOneWhenBare(normalizeSchemaNativeType(expand === void 0 ? input.nativeType : expand(input)));\n\t};\n}\n//#endregion\n//#region src/core/migrations/diff-database-schema.ts\n/**\n* Whether a diff issue's subject node is cluster-scoped — it carries its own\n* `namespaceId` field (only role and policy diff nodes do) and that\n* coordinate is the unbound sentinel, meaning the node is not owned by any\n* schema/namespace. A role node is always cluster-scoped (roles are\n* cluster-level objects); a policy node's `namespaceId` is always its\n* table's resolved DDL schema, never the sentinel. Namespace-ownership\n* scoping (which compares `issue.path[1]` against the set of DDL schemas\n* the contract owns) makes no sense for a cluster-scoped subject — its path\n* segment at that index is the object's own name, not a schema name — so\n* such an issue bypasses that scoping entirely.\n*/\nfunction isClusterScopedIssue(issue) {\n\tconst node = issue.expected ?? issue.actual;\n\treturn node !== void 0 && nodeNamespaceId(node) === UNBOUND_NAMESPACE_ID;\n}\nfunction nodeNamespaceId(node) {\n\tif (!Object.hasOwn(node, \"namespaceId\")) return void 0;\n\treturn blindCast(node).namespaceId;\n}\nfunction ownedSchemaNames(expected) {\n\tconst policyNamespaces = Object.values(expected.namespaces).flatMap((ns) => Object.values(ns.tables).flatMap((t) => t.policies.map((p) => p.namespaceId)));\n\treturn /* @__PURE__ */ new Set([...policyNamespaces, ...expected.existingSchemas]);\n}\n/**\n* Drops contract namespaces that declare no tables from the verdict-diff\n* expected tree and the relational owned-schema set. The legacy relational\n* walk skipped a table-less namespace (e.g. an enums-only schema) before\n* pairing, so neither its DDL schema's absence nor that schema's live\n* relational contents ever reached the verdict — the pruned tree\n* reproduces that. The prune loses no expected policies: policies attach\n* to tables, so a table-less namespace carries none (the projection\n* throws on a policy referencing an absent table). Live policies in a\n* pruned schema remain governed via the full owned set (see\n* {@link diffPostgresSchema}).\n*/\nfunction pruneTableLessNamespaces(expected) {\n\tconst namespaces = Object.fromEntries(Object.entries(expected.namespaces).filter(([, ns]) => Object.keys(ns.tables).length > 0));\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...expected.roles],\n\t\texistingSchemas: expected.existingSchemas.filter((s) => namespaces[s] !== void 0),\n\t\tpgVersion: expected.pgVersion\n\t});\n}\n/**\n* Resolves a verdict-diff issue's subject's declared control policy directly\n* from the contract, by delegating to the same node-typed resolver\n* ({@link resolvePostgresNodeIssueControlPolicySubject}) the planner uses to\n* gate DDL calls. `undefined` when the issue resolves to no contract subject.\n*\n* A role issue resolves through that same resolver to `external`\n* unconditionally (see its role branch), regardless of the contract's own\n* default policy: a role is referenced by the contract but not owned, and\n* `external`'s existing semantics — a missing declared subject still fails,\n* every extra is suppressed — are exactly the wanted asymmetric grading for\n* a cluster object the framework does not own.\n*/\nfunction resolveControlPolicy(issue, contract) {\n\treturn resolvePostgresNodeIssueControlPolicySubject(blindCast(issue), contract)?.explicitNodeControlPolicy;\n}\n/**\n* The Postgres full-tree node diff for the family verify verdict: derive\n* the expected tree (resolved leaf values, expander threaded, FK schemas\n* resolved, table-less namespaces pruned), run the generic\n* differ over the trees as derived, and scope out `not-expected` findings under namespaces the\n* contract does not own. Ownership scoping bypasses cluster-scoped subjects\n* (roles today), mirroring the legacy decomposition: relational extras check\n* the PRUNED owned set (the legacy\n* per-namespace walk never visited a table-less namespace, so its live\n* relational contents are invisible), while `structural` extras (RLS\n* policies) check the FULL owned set (the legacy policy diff governed\n* every contract schema regardless of tables — RLS governance does not\n* shrink because a namespace declares no tables). The codec `verifyType`\n* hooks run once per contract namespace with tables against that\n* namespace's paired actual node (the hooks read namespace-scoped state\n* such as `nativeEnums`).\n*/\nfunction diffPostgresSchema(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.schema);\n\tconst actual = input.schema;\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\texpandNativeType: buildPostgresNativeTypeExpander(input.frameworkComponents),\n\t\tresolveDefault: postgresResolveDefault,\n\t\t...ifDefined(\"dataTypeOf\", buildDataTypeResolver(input.frameworkComponents))\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\tissues: diffSchemas(expected, actual).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t}),\n\t\tresolveControlPolicy: (issue) => resolveControlPolicy(issue, postgresContract),\n\t\tnamespacePairs: Object.values(expected.namespaces).map((ns) => ({ actual: actual.namespaces[ns.schemaName] }))\n\t};\n}\n/**\n* Adds an empty namespace node to the actual tree for every expected namespace\n* absent from it. The relational plan diff pairs on namespace: a contract\n* namespace whose live schema does not exist yet must surface each of its\n* tables as `not-found` (→ `CREATE TABLE`), NOT as a single namespace\n* `not-found` that subtree-coalescing would collapse (leaving `CREATE SCHEMA`\n* with no tables). Padding makes the namespaces pair, so only table/column/\n* policy drift surfaces; `CREATE SCHEMA` comes separately from the synthesized\n* namespace-presence stitch (`verifyPostgresNamespacePresence`), never from the\n* tree diff — matching the retired per-namespace-paired relational walk, which\n* paired a missing schema against an empty namespace node.\n*/\nfunction padActualNamespaces(expected, actual) {\n\tconst namespaces = { ...actual.namespaces };\n\tlet padded = false;\n\tfor (const schemaName of Object.keys(expected.namespaces)) if (namespaces[schemaName] === void 0) {\n\t\tnamespaces[schemaName] = new PostgresNamespaceSchemaNode({\n\t\t\tschemaName,\n\t\t\ttables: {}\n\t\t});\n\t\tpadded = true;\n\t}\n\tif (!padded) return actual;\n\treturn new PostgresDatabaseSchemaNode({\n\t\tnamespaces,\n\t\troles: [...actual.roles],\n\t\texistingSchemas: [...actual.existingSchemas],\n\t\tpgVersion: actual.pgVersion\n\t});\n}\n/**\n* The Postgres planner's diff input: the SAME tree-building\n* `diffPostgresSchema` uses (expander threaded, FK schemas resolved,\n* table-less namespaces pruned, cluster-scope-aware ownership filter) plus\n* actual namespace padding (so a missing\n* schema's tables surface as `not-found` instead of a swallowed namespace\n* `not-found`). One differ drives both verify and plan; this is the\n* plan-side derivation. The single issue list covers tables / columns /\n* constraints / indexes / defaults AND policies — the caller splits it\n* (relational → `mapNodeIssueToCall`; policy → RLS ops) and stitches in\n* `CREATE SCHEMA` separately.\n*/\nfunction buildPostgresPlanDiff(input) {\n\tconst postgresContract = blindCast(input.contract);\n\tPostgresDatabaseSchemaNode.assert(input.actualSchema);\n\tconst actual = input.actualSchema;\n\tconst fullExpected = contractToPostgresDatabaseSchemaNode(postgresContract, {\n\t\tannotationNamespace: \"pg\",\n\t\texpandNativeType: buildPostgresNativeTypeExpander(input.frameworkComponents),\n\t\tresolveDefault: postgresResolveDefault,\n\t\t...ifDefined(\"dataTypeOf\", buildDataTypeResolver(input.frameworkComponents))\n\t});\n\tconst expected = pruneTableLessNamespaces(fullExpected);\n\tconst paddedActual = padActualNamespaces(expected, actual);\n\tconst relationalOwned = ownedSchemaNames(expected);\n\tconst structuralOwned = ownedSchemaNames(fullExpected);\n\treturn {\n\t\texpected,\n\t\tactual: paddedActual,\n\t\tissues: blindCast(diffSchemas(expected, paddedActual)).filter((issue) => {\n\t\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\t\tif (isClusterScopedIssue(issue)) return true;\n\t\t\tconst granularity = classifyDiffSubjectGranularity(issue, postgresDiffSubjectGranularity);\n\t\t\tconst namespaceSegment = issue.path[1];\n\t\t\tif (namespaceSegment === void 0) return true;\n\t\t\treturn (granularity === \"structural\" ? structuralOwned : relationalOwned).has(namespaceSegment);\n\t\t})\n\t};\n}\n//#endregion\nexport { contractToPostgresDatabaseSchemaNode as i, diffPostgresSchema as n, buildPostgresNativeTypeExpander as r, buildPostgresPlanDiff as t };\n\n//# sourceMappingURL=diff-database-schema-CjI2n0dA.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,SAAS,eAAe;CACvB,OAAO;EACN,UAAU,uBAAuB;EACjC,IAAI;CACL;AACD;AACA,SAAS,eAAe,aAAa,WAAW;CAC/C,OAAO;EACN,aAAa;EACb;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;EACA;GACC,UAAU,uBAAuB;GACjC,IAAI;EACL;CACD;AACD;AACA,SAAS,cAAc,MAAM;CAC5B,OAAO,CAAC,aAAa,GAAG;EACvB,UAAU,uBAAuB;EACjC,IAAI;CACL,CAAC;AACF;;;;;;;AAOA,SAAS,gBAAgB,aAAa,WAAW,SAAS;CACzD,OAAO,QAAQ,KAAK,WAAW,CAAC,GAAG,eAAe,aAAa,SAAS,GAAG;EAC1E,UAAU,yBAAyB;EACnC,IAAI,UAAU;CACf,CAAC,CAAC;AACH;A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EAC/F,CAAC;CACF;AACD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as PostgresOpFactoryCall } from "./op-factory-call-
|
|
1
|
+
import { j as PostgresOpFactoryCall } from "./op-factory-call-CaEALaar-Nh0fSxQY.mjs";
|
|
2
2
|
import { SqlStorage, StorageTypeInstance } from "@prisma/orm-family-sql/contract/types";
|
|
3
3
|
import { DiffableNode, SchemaDiffIssue } from "@prisma/orm-framework/components/control";
|
|
4
4
|
import { CodecControlHooks, MigrationOperationPolicy, SqlPlannerConflict } from "@prisma/orm-family-sql/family/control";
|
|
@@ -102,4 +102,4 @@ interface IssuePlannerOptions {
|
|
|
102
102
|
declare function planIssues(options: IssuePlannerOptions): Result<IssuePlannerValue, readonly SqlPlannerConflict[]>;
|
|
103
103
|
//#endregion
|
|
104
104
|
export { planIssues as n, coalesceSubtreeIssues as t };
|
|
105
|
-
//# sourceMappingURL=issue-planner-
|
|
105
|
+
//# sourceMappingURL=issue-planner-BdnqkLvV.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue-planner-
|
|
1
|
+
{"version":3,"file":"issue-planner-BdnqkLvV.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/issue-planner.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;UAkBU;WACC,YAAY,SAAS;WACrB,cAAc,SAAS;WACvB;WACA,YAAY,oBAAoB;WAChC,cAAc,SAAS,eAAe;WACtC,QAAQ;WACR,QAAQ;WACR,qBAAqB,cAAc;;;;;;;;;KASzC,yBAAyB,iBAAiB,mBAAmB,SAAS;EACzE;EACA,iBAAiB;EACjB,gBAAgB;;;;;;;;EAQhB;;EAEA;;;;UAIQ;WACC,gBAAgB;;;;;;;;;;;iBAWV,sBAAsB,cAAc,eAAe,cAAc,iBAAiB,gBAAgB,oBAAoB,gBAAgB;UAC7I;WACC,iBAAiB;WACjB,YAAY,SAAS;WACrB,cAAc,SAAS;WACvB;WACA,YAAY,oBAAoB;WAChC,cAAc,SAAS,eAAe;;;;;;;;WAQtC,SAAS;;;;;;WAMT,SAAS;;;;;WAKT,sBAAsB,cAAc;WACpC,sBAAsB;;;;;;;;;iBAShB,WAAW,SAAS,sBAAsB,OAAO,4BAA4B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./data-transform-Ck5FbyNO-BNE7QlAo.mjs";
|
|
2
|
-
import { A as Op$1 } from "./op-factory-call-
|
|
3
|
-
import "./postgres-migration-
|
|
2
|
+
import { A as Op$1 } from "./op-factory-call-CaEALaar-Nh0fSxQY.mjs";
|
|
3
|
+
import "./postgres-migration-BCzAcFmN-Bz_I02Gc.mjs";
|
|
4
4
|
import { checkExpression, col as col$1, fn as fn$1, foreignKey, lit as lit$1, primaryKey, unique } from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
5
5
|
import { placeholder } from "@prisma/orm-framework/errors/migration";
|
|
6
6
|
import { MigrationCLI } from "@prisma/orm-toolchain/cli/migration-cli";
|
|
@@ -22,4 +22,4 @@ declare function createExtension(extensionName: string): Op$1;
|
|
|
22
22
|
declare function rawSql(op: Op$1): Op$1;
|
|
23
23
|
//#endregion
|
|
24
24
|
export { fn$1 as a, placeholder as c, unique as d, createExtension as i, primaryKey as l, checkExpression as n, foreignKey as o, col$1 as r, lit$1 as s, MigrationCLI as t, rawSql as u };
|
|
25
|
-
//# sourceMappingURL=migration-
|
|
25
|
+
//# sourceMappingURL=migration-D7F66l-1.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-
|
|
1
|
+
{"version":3,"file":"migration-D7F66l-1.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/migration.d.mts"],"mappings":";;;;;;;;iBAQiB,gBAAgB,wBAAwB;;;;;;;;;;;;;iBAaxC,OAAO,IAAI,OAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-PTHAY9Cv.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/migration.mjs"],"sourcesContent":["import { z as createExtension } from \"./op-factory-call-
|
|
1
|
+
{"version":3,"file":"migration-PTHAY9Cv.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/migration.mjs"],"sourcesContent":["import { z as createExtension } from \"./op-factory-call-lH-yj1Bq.mjs\";\nimport { t as PostgresMigration } from \"./postgres-migration-DDStmEAq.mjs\";\nimport { t as dataTransform } from \"./data-transform-Bo32KRbq.mjs\";\nimport { checkExpression, col, fn, foreignKey, lit, primaryKey, unique } from \"@internal/sql-relational-core/contract-free\";\nimport { placeholder } from \"@internal/errors/migration\";\nimport { MigrationCLI } from \"@internal/cli/migration-cli\";\n//#region src/core/migrations/operations/raw.ts\n/**\n* Identity factory for an already-materialized `SqlMigrationPlanOperation`.\n*\n* The planner uses this via `liftOpToCall` to carry ops produced by SQL\n* family methods, codec control hooks, and component database dependencies\n* alongside migration IR without reverse-engineering them. Users writing\n* raw migrations can pass a full op shape directly — typically built by\n* composing SQL family helpers — to author a migration that bypasses the\n* structured call classes.\n*/\nfunction rawSql(op) {\n\treturn op;\n}\n//#endregion\nexport { PostgresMigration as Migration, MigrationCLI, checkExpression, col, createExtension, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, unique };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAS,OAAO,IAAI;CACnB,OAAO;AACR"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DdlNode } from "@prisma/orm-family-sql/relational-core/ast";
|
|
2
|
-
//#region ../../../3-targets/3-targets/postgres/dist/nodes-
|
|
2
|
+
//#region ../../../3-targets/3-targets/postgres/dist/nodes-Bm2a7z6e.mjs
|
|
3
3
|
var AlterTableAction = class {};
|
|
4
4
|
var AddColumnAction = class extends AlterTableAction {
|
|
5
5
|
kind = "add-column";
|
|
@@ -182,10 +182,7 @@ var PostgresCreateIndex = class extends PostgresDdlNode {
|
|
|
182
182
|
elements;
|
|
183
183
|
type;
|
|
184
184
|
options;
|
|
185
|
-
/**
|
|
186
|
-
* Partial-index predicate (WHERE body, without the keyword). Inserted
|
|
187
|
-
* verbatim, never quoted or escaped.
|
|
188
|
-
*/
|
|
185
|
+
/** Partial-index predicate (WHERE body, without the keyword). Never quoted or escaped. */
|
|
189
186
|
where;
|
|
190
187
|
constructor(options) {
|
|
191
188
|
super();
|
|
@@ -252,4 +249,4 @@ var PostgresDisableRowLevelSecurity = class extends PostgresDdlNode {
|
|
|
252
249
|
//#endregion
|
|
253
250
|
export { PostgresAlterTable as a, PostgresCreateSchema as c, PostgresDdlNode as d, PostgresDisableRowLevelSecurity as f, PostgresDropType as h, PostgresAlterPolicyRename as i, PostgresCreateTable as l, PostgresDropPolicy as m, DropDefaultAction as n, PostgresCreateIndex as o, PostgresDropIndex as p, PostgresAlterIndexRename as r, PostgresCreatePolicy as s, AddColumnAction as t, PostgresCreateType as u };
|
|
254
251
|
|
|
255
|
-
//# sourceMappingURL=nodes-
|
|
252
|
+
//# sourceMappingURL=nodes-Bm2a7z6e-BXTXyzZv.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes-Bm2a7z6e-BXTXyzZv.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/nodes-Bm2a7z6e.mjs"],"sourcesContent":["import { DdlNode } from \"@internal/sql-relational-core/ast\";\n//#region src/core/ddl/nodes.ts\nvar AlterTableAction = class {};\nvar AddColumnAction = class extends AlterTableAction {\n\tkind = \"add-column\";\n\tcolumn;\n\tconstructor(column) {\n\t\tsuper();\n\t\tthis.column = column;\n\t\tObject.freeze(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.addColumn(this);\n\t}\n};\nvar DropDefaultAction = class extends AlterTableAction {\n\tkind = \"drop-default\";\n\tcolumnName;\n\tconstructor(columnName) {\n\t\tsuper();\n\t\tthis.columnName = columnName;\n\t\tObject.freeze(this);\n\t}\n\taccept(visitor) {\n\t\treturn visitor.dropDefault(this);\n\t}\n};\nvar PostgresDdlNode = class extends DdlNode {};\nfunction freezeDdlColumns(columns) {\n\treturn Object.freeze([...columns]);\n}\nfunction freezeConstraints(constraints) {\n\treturn constraints ? Object.freeze([...constraints]) : void 0;\n}\nvar PostgresCreateTable = class extends PostgresDdlNode {\n\tkind = \"create-table\";\n\ttable;\n\tschema;\n\tifNotExists;\n\tcolumns;\n\tconstraints;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.table = options.table;\n\t\tthis.schema = options.schema;\n\t\tthis.ifNotExists = options.ifNotExists;\n\t\tthis.columns = freezeDdlColumns(options.columns);\n\t\tthis.constraints = freezeConstraints(options.constraints);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createTable(this);\n\t}\n};\nvar PostgresCreateSchema = class extends PostgresDdlNode {\n\tkind = \"create-schema\";\n\tschema;\n\tifNotExists;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.ifNotExists = options.ifNotExists;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createSchema(this);\n\t}\n};\nvar PostgresCreateType = class extends PostgresDdlNode {\n\tkind = \"create-type\";\n\tschema;\n\tname;\n\tvalues;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.name = options.name;\n\t\tthis.values = Object.freeze([...options.values]);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createType(this);\n\t}\n};\nvar PostgresDropType = class extends PostgresDdlNode {\n\tkind = \"drop-type\";\n\tschema;\n\tname;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.name = options.name;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.dropType(this);\n\t}\n};\nvar PostgresAlterTable = class extends PostgresDdlNode {\n\tkind = \"alter-table\";\n\ttable;\n\tschema;\n\tactions;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.table = options.table;\n\t\tthis.schema = options.schema;\n\t\tthis.actions = Object.freeze([...options.actions]);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.alterTable(this);\n\t}\n};\nvar PostgresCreatePolicy = class extends PostgresDdlNode {\n\tkind = \"create-policy\";\n\tschema;\n\ttable;\n\tname;\n\tpermissive;\n\toperation;\n\troles;\n\tusing;\n\twithCheck;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.name = options.name;\n\t\tthis.permissive = options.permissive;\n\t\tthis.operation = options.operation;\n\t\tthis.roles = Object.freeze([...options.roles]);\n\t\tthis.using = options.using;\n\t\tthis.withCheck = options.withCheck;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createPolicy(this);\n\t}\n};\nvar PostgresDropPolicy = class extends PostgresDdlNode {\n\tkind = \"drop-policy\";\n\tschema;\n\ttable;\n\tname;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.name = options.name;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.dropPolicy(this);\n\t}\n};\nvar PostgresAlterPolicyRename = class extends PostgresDdlNode {\n\tkind = \"alter-policy-rename\";\n\tschema;\n\ttable;\n\tname;\n\tnewName;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.name = options.name;\n\t\tthis.newName = options.newName;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.alterPolicyRename(this);\n\t}\n};\nvar PostgresCreateIndex = class extends PostgresDdlNode {\n\tkind = \"create-index\";\n\t/** Absent ⇔ unqualified (the unbound namespace — `search_path` decides). */\n\tschema;\n\ttable;\n\tname;\n\tunique;\n\telements;\n\ttype;\n\toptions;\n\t/** Partial-index predicate (WHERE body, without the keyword). Never quoted or escaped. */\n\twhere;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.name = options.name;\n\t\tthis.unique = options.unique;\n\t\tthis.elements = \"columns\" in options.elements ? { columns: Object.freeze([...options.elements.columns]) } : { expression: options.elements.expression };\n\t\tthis.type = options.type;\n\t\tthis.options = options.options;\n\t\tthis.where = options.where;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createIndex(this);\n\t}\n};\nvar PostgresDropIndex = class extends PostgresDdlNode {\n\tkind = \"drop-index\";\n\t/** Absent ⇔ unqualified (the unbound namespace). */\n\tschema;\n\tname;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.name = options.name;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.dropIndex(this);\n\t}\n};\nvar PostgresAlterIndexRename = class extends PostgresDdlNode {\n\tkind = \"alter-index-rename\";\n\t/** Absent ⇔ unqualified (the unbound namespace). */\n\tschema;\n\tfrom;\n\tto;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.from = options.from;\n\t\tthis.to = options.to;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.alterIndexRename(this);\n\t}\n};\nvar PostgresDisableRowLevelSecurity = class extends PostgresDdlNode {\n\tkind = \"disable-row-level-security\";\n\tschema;\n\ttable;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.schema = options.schema;\n\t\tthis.table = options.table;\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.disableRowLevelSecurity(this);\n\t}\n};\n//#endregion\nexport { PostgresAlterTable as a, PostgresCreateSchema as c, PostgresDdlNode as d, PostgresDisableRowLevelSecurity as f, PostgresDropType as h, PostgresAlterPolicyRename as i, PostgresCreateTable as l, PostgresDropPolicy as m, DropDefaultAction as n, PostgresCreateIndex as o, PostgresDropIndex as p, PostgresAlterIndexRename as r, PostgresCreatePolicy as s, AddColumnAction as t, PostgresCreateType as u };\n\n//# sourceMappingURL=nodes-Bm2a7z6e.mjs.map"],"mappings":";;AAEA,IAAI,mBAAmB,MAAM,CAAC;AAC9B,IAAI,kBAAkB,cAAc,iBAAiB;CACpD,OAAO;CACP;CACA,YAAY,QAAQ;EACnB,MAAM;EACN,KAAK,SAAS;EACd,OAAO,OAAO,IAAI;CACnB;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,UAAU,IAAI;CAC9B;AACD;AACA,IAAI,oBAAoB,cAAc,iBAAiB;CACtD,OAAO;CACP;CACA,YAAY,YAAY;EACvB,MAAM;EACN,KAAK,aAAa;EAClB,OAAO,OAAO,IAAI;CACnB;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,YAAY,IAAI;CAChC;AACD;AACA,IAAI,kBAAkB,cAAc,QAAQ,CAAC;AAC7C,SAAS,iBAAiB,SAAS;CAClC,OAAO,OAAO,OAAO,CAAC,GAAG,OAAO,CAAC;AAClC;AACA,SAAS,kBAAkB,aAAa;CACvC,OAAO,cAAc,OAAO,OAAO,CAAC,GAAG,WAAW,CAAC,IAAI,KAAK;AAC7D;AACA,IAAI,sBAAsB,cAAc,gBAAgB;CACvD,OAAO;CACP;CACA;CACA;CACA;CACA;CACA,YAAY,SAAS;EACpB,MAAM;EACN,KAAK,QAAQ,QAAQ;EACrB,KAAK,SAAS,QAAQ;EACtB,KAAK,cAAc,QAAQ;EAC3B,KAAK,UAAU,iBAAiB,QAAQ,OAAO;EAC/C,KAAK,cAAc,kBAAkB,QAAQ,WAAW;EACxD,KAAK,OAAO;CACb;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,YAAY,IAAI;CAChC;AACD;AACA,IAAI,uBAAuB,cAAc,gBAAgB;CACxD,OAAO;CACP;CACA;CACA,YAAY,SAAS;EACpB,MAAM;EACN,KAAK,SAAS,QAAQ;EACtB,KAAK,cAAc,QAAQ;EAC3B,KAAK,OAAO;CACb;CACA,OAAO,SAAS;E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A,OAAO,SAAS;EACf,OAAO,QAAQ,UAAU,IAAI;CAC9B;AACD;AACA,IAAI,2BAA2B,cAAc,gBAAgB;CAC5D,OAAO;;CAEP;CACA;CACA;CACA,YAAY,SAAS;EACpB,MAAM;EACN,KAAK,SAAS,QAAQ;EACtB,KAAK,OAAO,QAAQ;EACpB,KAAK,KAAK,QAAQ;EAClB,KAAK,OAAO;CACb;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,iBAAiB,IAAI;CACrC;AACD;AACA,IAAI,kCAAkC,cAAc,gBAAgB;CACnE,OAAO;CACP;CACA;CACA,YAAY,SAAS;EACpB,MAAM;EACN,KAAK,SAAS,QAAQ;EACtB,KAAK,QAAQ,QAAQ;EACrB,KAAK,OAAO;CACb;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,wBAAwB,IAAI;CAC5C;AACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as RlsPolicyOperation } from "./canonicalize-CQlxSR4D-MnrT5gtW.mjs";
|
|
2
|
-
import { DdlColumn, DdlNode, DdlTableConstraint } from "@prisma/orm-family-sql/relational-core/ast";
|
|
3
|
-
//#region ../../../3-targets/3-targets/postgres/dist/nodes-
|
|
2
|
+
import { DdlColumn, DdlNode, DdlTableConstraint, OpaqueSql } from "@prisma/orm-family-sql/relational-core/ast";
|
|
3
|
+
//#region ../../../3-targets/3-targets/postgres/dist/nodes-C1fPapnK.d.mts
|
|
4
4
|
//#region src/core/ddl/nodes.d.ts
|
|
5
5
|
interface AlterTableActionVisitor<R> {
|
|
6
6
|
addColumn(action: AddColumnAction): R;
|
|
@@ -117,8 +117,8 @@ declare class PostgresCreatePolicy extends PostgresDdlNode {
|
|
|
117
117
|
readonly permissive: boolean;
|
|
118
118
|
readonly operation: RlsPolicyOperation;
|
|
119
119
|
readonly roles: ReadonlyArray<string>;
|
|
120
|
-
readonly using:
|
|
121
|
-
readonly withCheck:
|
|
120
|
+
readonly using: OpaqueSql | undefined;
|
|
121
|
+
readonly withCheck: OpaqueSql | undefined;
|
|
122
122
|
constructor(options: {
|
|
123
123
|
readonly schema: string;
|
|
124
124
|
readonly table: string;
|
|
@@ -126,8 +126,8 @@ declare class PostgresCreatePolicy extends PostgresDdlNode {
|
|
|
126
126
|
readonly permissive: boolean;
|
|
127
127
|
readonly operation: RlsPolicyOperation;
|
|
128
128
|
readonly roles: readonly string[];
|
|
129
|
-
readonly using?:
|
|
130
|
-
readonly withCheck?:
|
|
129
|
+
readonly using?: OpaqueSql;
|
|
130
|
+
readonly withCheck?: OpaqueSql;
|
|
131
131
|
});
|
|
132
132
|
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
133
133
|
}
|
|
@@ -158,16 +158,21 @@ declare class PostgresAlterPolicyRename extends PostgresDdlNode {
|
|
|
158
158
|
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
|
-
* The element list between the parens of CREATE INDEX: either a column
|
|
162
|
-
* tuple (each identifier quoted by the renderer) or one opaque expression
|
|
163
|
-
* string covering the entire list, inserted verbatim — the same opaque-SQL
|
|
164
|
-
* stance as RLS policy predicates (ADR 234).
|
|
161
|
+
* The element list between the parens of CREATE INDEX, as a migration file writes it: either a column tuple or one SQL expression string covering the entire list.
|
|
165
162
|
*/
|
|
166
|
-
type
|
|
163
|
+
type CreateIndexElements = {
|
|
167
164
|
readonly columns: readonly string[];
|
|
168
165
|
} | {
|
|
169
166
|
readonly expression: string;
|
|
170
167
|
};
|
|
168
|
+
/**
|
|
169
|
+
* The element list between the parens of CREATE INDEX: either a column tuple (each identifier quoted by the renderer) or one `OpaqueSql` value covering the entire list.
|
|
170
|
+
*/
|
|
171
|
+
type DdlIndexElements = {
|
|
172
|
+
readonly columns: readonly string[];
|
|
173
|
+
} | {
|
|
174
|
+
readonly expression: OpaqueSql;
|
|
175
|
+
};
|
|
171
176
|
declare class PostgresCreateIndex extends PostgresDdlNode {
|
|
172
177
|
readonly kind: "create-index";
|
|
173
178
|
/** Absent ⇔ unqualified (the unbound namespace — `search_path` decides). */
|
|
@@ -178,11 +183,8 @@ declare class PostgresCreateIndex extends PostgresDdlNode {
|
|
|
178
183
|
readonly elements: DdlIndexElements;
|
|
179
184
|
readonly type: string | undefined;
|
|
180
185
|
readonly options: Record<string, unknown> | undefined;
|
|
181
|
-
/**
|
|
182
|
-
|
|
183
|
-
* verbatim, never quoted or escaped.
|
|
184
|
-
*/
|
|
185
|
-
readonly where: string | undefined;
|
|
186
|
+
/** Partial-index predicate (WHERE body, without the keyword). Never quoted or escaped. */
|
|
187
|
+
readonly where: OpaqueSql | undefined;
|
|
186
188
|
constructor(options: {
|
|
187
189
|
readonly schema: string | undefined;
|
|
188
190
|
readonly table: string;
|
|
@@ -191,7 +193,7 @@ declare class PostgresCreateIndex extends PostgresDdlNode {
|
|
|
191
193
|
readonly elements: DdlIndexElements;
|
|
192
194
|
readonly type: string | undefined;
|
|
193
195
|
readonly options: Record<string, unknown> | undefined;
|
|
194
|
-
readonly where:
|
|
196
|
+
readonly where: OpaqueSql | undefined;
|
|
195
197
|
});
|
|
196
198
|
accept<R>(visitor: PostgresDdlVisitor<R>): R;
|
|
197
199
|
}
|
|
@@ -231,5 +233,5 @@ declare class PostgresDisableRowLevelSecurity extends PostgresDdlNode {
|
|
|
231
233
|
}
|
|
232
234
|
type AnyPostgresDdlNode = PostgresCreateTable | PostgresCreateSchema | PostgresCreateType | PostgresDropType | PostgresAlterTable | PostgresCreatePolicy | PostgresDropPolicy | PostgresAlterPolicyRename | PostgresCreateIndex | PostgresDropIndex | PostgresAlterIndexRename | PostgresDisableRowLevelSecurity;
|
|
233
235
|
//#endregion
|
|
234
|
-
export {
|
|
235
|
-
//# sourceMappingURL=nodes-
|
|
236
|
+
export { PostgresDdlVisitor as _, CreateIndexElements as a, PostgresDropPolicy as b, PostgresAlterIndexRename as c, PostgresCreateIndex as d, PostgresCreatePolicy as f, PostgresDdlNode as g, PostgresCreateType as h, AnyPostgresDdlNode as i, PostgresAlterPolicyRename as l, PostgresCreateTable as m, AlterTableActionVisitor as n, DdlIndexElements as o, PostgresCreateSchema as p, AnyAlterTableAction as r, DropDefaultAction as s, AddColumnAction as t, PostgresAlterTable as u, PostgresDisableRowLevelSecurity as v, PostgresDropType as x, PostgresDropIndex as y };
|
|
237
|
+
//# sourceMappingURL=nodes-C1fPapnK-j0AK7Gcj.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes-
|
|
1
|
+
{"version":3,"file":"nodes-C1fPapnK-j0AK7Gcj.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/nodes-C1fPapnK.d.mts"],"mappings":";;;;UAGU,wBAAwB;EAChC,UAAU,QAAQ,kBAAkB;EACpC,YAAY,QAAQ,oBAAoB;;uBAEnB;oBACH;WACT,OAAO,GAAG,SAAS,wBAAwB,KAAK;;cAE7C,wBAAwB;WAC3B;WACA,QAAQ;EACjB,YAAY,QAAQ;EACpB,OAAO,GAAG,SAAS,wBAAwB,KAAK;;cAEpC,0BAA0B;WAC7B;WACA;EACT,YAAY;EACZ,OAAO,GAAG,SAAS,wBAAwB,KAAK;;;;;;;;;;;KAW7C,sBAAsB,kBAAkB;UACnC,mBAAmB;EAC3B,YAAY,MAAM,sBAAsB;EACxC,aAAa,MAAM,uBAAuB;EAC1C,WAAW,MAAM,qBAAqB;EACtC,SAAS,MAAM,mBAAmB;EAClC,WAAW,MAAM,qBAAqB;EACtC,aAAa,MAAM,uBAAuB;EAC1C,WAAW,MAAM,qBAAqB;EACtC,kBAAkB,MAAM,4BAA4B;EACpD,YAAY,MAAM,sBAAsB;EACxC,UAAU,MAAM,oBAAoB;EACpC,iBAAiB,MAAM,2BAA2B;EAClD,wBAAwB,MAAM,kCAAkC;;uBAE3C,wBAAwB;WACpC,OAAO,GAAG,SAAS,mBAAmB,KAAK;;cAExC,4BAA4B;WAC/B;WACA;WACA;WACA;WACA,SAAS,cAAc;WACvB,aAAa,cAAc;EACpC,YA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O,GAAG,SAAS,mBAAmB,KAAK;;cAE/B,iCAAiC;WACpC;;WAEA;WACA;WACA;EACT,YAAY;aACD;aACA;aACA;;EAEX,OAAO,GAAG,SAAS,mBAAmB,KAAK;;cAE/B,wCAAwC;WAC3C;WACA;WACA;EACT,YAAY;aACD;aACA;;EAEX,OAAO,GAAG,SAAS,mBAAmB,KAAK;;KAExC,qBAAqB,sBAAsB,uBAAuB,qBAAqB,mBAAmB,qBAAqB,uBAAuB,qBAAqB,4BAA4B,sBAAsB,oBAAoB,2BAA2B"}
|
package/dist/{op-factory-call-CmhDgfov-BjHdIpND.d.mts → op-factory-call-CaEALaar-Nh0fSxQY.d.mts}
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { t as PostgresRlsPolicy } from "./postgres-rls-policy-CnDxf3z9-C3LIHAIG.mjs";
|
|
2
2
|
import "./types-ue6jkJyF-BQJzjx1P.mjs";
|
|
3
|
+
import { a as CreateIndexElements } from "./nodes-C1fPapnK-j0AK7Gcj.mjs";
|
|
3
4
|
import { t as PostgresPlanTargetDetails } from "./planner-target-details-HkP4RrRO-_xPQVPF0.mjs";
|
|
4
5
|
import { DdlColumn, DdlTableConstraint } from "@prisma/orm-family-sql/relational-core/ast";
|
|
5
6
|
import { ReferentialAction, StorageColumn, StorageTypeInstance } from "@prisma/orm-family-sql/contract/types";
|
|
@@ -7,7 +8,7 @@ import { MigrationOperationClass, OpFactoryCall } from "@prisma/orm-framework/co
|
|
|
7
8
|
import { CodecControlHooks, SqlMigrationPlanOperation } from "@prisma/orm-family-sql/family/control";
|
|
8
9
|
import { ImportRequirement, TsExpression } from "@prisma/orm-framework/ts-render";
|
|
9
10
|
import { ExecuteRequestLowerer, Lowerer } from "@prisma/orm-family-sql/family/control-adapter";
|
|
10
|
-
//#region ../../../3-targets/3-targets/postgres/dist/op-factory-call-
|
|
11
|
+
//#region ../../../3-targets/3-targets/postgres/dist/op-factory-call-CaEALaar.d.mts
|
|
11
12
|
//#region src/core/migrations/operations/shared.d.ts
|
|
12
13
|
type Op$1 = SqlMigrationPlanOperation<PostgresPlanTargetDetails>;
|
|
13
14
|
/**
|
|
@@ -42,16 +43,6 @@ interface CreateIndexExtras {
|
|
|
42
43
|
readonly where?: string;
|
|
43
44
|
readonly unique?: boolean;
|
|
44
45
|
}
|
|
45
|
-
/**
|
|
46
|
-
* The element list between the parens of CREATE INDEX: either a column
|
|
47
|
-
* tuple (each identifier quoted) or one opaque expression string covering
|
|
48
|
-
* the entire list, inserted verbatim.
|
|
49
|
-
*/
|
|
50
|
-
type CreateIndexElements = {
|
|
51
|
-
readonly columns: readonly string[];
|
|
52
|
-
} | {
|
|
53
|
-
readonly expression: string;
|
|
54
|
-
};
|
|
55
46
|
//#endregion
|
|
56
47
|
//#region src/core/migrations/op-factory-call.d.ts
|
|
57
48
|
type Op = SqlMigrationPlanOperation<PostgresPlanTargetDetails>;
|
|
@@ -548,4 +539,4 @@ declare class RenamePostgresRlsPolicyCall extends PostgresOpFactoryCallNode {
|
|
|
548
539
|
type PostgresOpFactoryCall = CreateTableCall | DropTableCall | RenameTableCall | AddColumnCall | DropColumnCall | AlterColumnTypeCall | SetNotNullCall | DropNotNullCall | SetDefaultCall | DropDefaultCall | AddNotNullColumnDirectCall | AddNotNullColumnWithTempDefaultCall | AddPrimaryKeyCall | AddForeignKeyCall | AddUniqueCall | AddCheckConstraintCall | RenameConstraintCall | DropCheckConstraintCall | CreateIndexCall | RenameIndexCall | DropIndexCall | DropConstraintCall | RawSqlCall | CreateExtensionCall | CreateSchemaCall | CreateNativeEnumTypeCall | DropNativeEnumTypeCall | AddNativeEnumValueCall | CreatePostgresRlsPolicyCall | DropPostgresRlsPolicyCall | EnableRowLevelSecurityCall | DisableRowLevelSecurityCall | RenamePostgresRlsPolicyCall | DataTransformCall;
|
|
549
540
|
//#endregion
|
|
550
541
|
export { Op$1 as A, DropIndexCall as C, DropTableCall as D, DropPostgresRlsPolicyCall as E, RenameIndexCall as F, RenamePostgresRlsPolicyCall as I, RenameTableCall as L, RawSqlCall as M, RenamableConstraintKind as N, EnableRowLevelSecurityCall as O, RenameConstraintCall as P, SetDefaultCall as R, DropDefaultCall as S, DropNotNullCall as T, DataTransformCall as _, AddNotNullColumnWithTempDefaultCall as a, DropColumnCall as b, AlterColumnTypeCall as c, CreateIndexCall as d, CreateIndexExtras as f, CreateTableCall as g, CreateSchemaCall as h, AddNativeEnumValueCall as i, PostgresOpFactoryCall as j, ForeignKeySpec as k, AlterColumnTypeOptions as l, CreatePostgresRlsPolicyCall as m, AddColumnCall as n, AddPrimaryKeyCall as o, CreateNativeEnumTypeCall as p, AddForeignKeyCall as r, AddUniqueCall as s, AddCheckConstraintCall as t, CreateExtensionCall as u, DisableRowLevelSecurityCall as v, DropNativeEnumTypeCall as w, DropConstraintCall as x, DropCheckConstraintCall as y, SetNotNullCall as z };
|
|
551
|
-
//# sourceMappingURL=op-factory-call-
|
|
542
|
+
//# sourceMappingURL=op-factory-call-CaEALaar-Nh0fSxQY.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"op-factory-call-CaEALaar-Nh0fSxQY.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/op-factory-call-CaEALaar.d.mts"],"mappings":";;;;;;;;;;;;KAWK,OAAO,0BAA0B;;;;;;UAM5B;WACC;WACA;WACA;aACE;aACA;aACA;;WAEF,WAAW;WACX,WAAW;;;;KAIjB;;;UAGK;WACC;WACA,UAAU;;;;;;WAMV;WACA;;;;KAIN,KAAK,0BAA0B;uBACb,kCAAkC,wBAAwB;oBAC7D;oBACA,gBAAgB;oBAChB;WACT,KAAK,UAAU,UAAU,KAAK,QAAQ;EAC/C,+BAA+B;YACrB;;cAEE,wBAAwB;WAC3B;WACA;WACA;WACA;WACA,kBAAkB;WAClB,sBAAsB;WACtB;EACT,YAAY,oBAAoB,mBAAmB,kBAAkB,aAAa,uBAAuB;EACzG,KAAK,UAAU,wBAAwB,QAAQ;EAC/C;EACA,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0fSxQY.mjs";
|
package/dist/{op-factory-call-DYkz28kP-4BmpSB4B.mjs → op-factory-call-lH-yj1Bq-B1g2DpyX.mjs}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
|
|
2
2
|
import { t as DEFAULT_NAMESPACE_ID } from "./namespace-ids-xtp_ZY86-Cpp8PTxD.mjs";
|
|
3
3
|
import { a as validateEnumValueLength, i as quoteQualifiedName, r as quoteIdentifier, t as escapeLiteral } from "./sql-utils-Bh-mnsSY-D6hnFPrP.mjs";
|
|
4
|
-
import { C as nativeEnumValueExistsAst, D as tableExistsAst, E as rlsPolicyExistsAst, O as tableIsEmptyAst, S as nativeEnumTypeExistsAst, T as rlsEnabledAst, _ as dropIndex$1, a as columnDefaultAst, b as extensionExistsAst, c as columnTypeAst, d as createPolicy, f as createSchema, g as dropDefaultAction, h as disableRowLevelSecurity$1, i as alterTable, l as constraintExistsAst, m as createType, n as alterIndexRename, o as columnExistsAst, p as createTable, r as alterPolicyRename, s as columnNullabilityAst, t as addColumnAction, u as createIndex$1, v as dropPolicy, w as noNullValuesAst, x as indexExistsAst, y as dropType } from "./ddl-
|
|
4
|
+
import { C as nativeEnumValueExistsAst, D as tableExistsAst, E as rlsPolicyExistsAst, O as tableIsEmptyAst, S as nativeEnumTypeExistsAst, T as rlsEnabledAst, _ as dropIndex$1, a as columnDefaultAst, b as extensionExistsAst, c as columnTypeAst, d as createPolicy, f as createSchema, g as dropDefaultAction, h as disableRowLevelSecurity$1, i as alterTable, l as constraintExistsAst, m as createType, n as alterIndexRename, o as columnExistsAst, p as createTable, r as alterPolicyRename, s as columnNullabilityAst, t as addColumnAction, u as createIndex$1, v as dropPolicy, w as noNullValuesAst, x as indexExistsAst, y as dropType } from "./ddl-BQFDVert-CcDdETee.mjs";
|
|
5
5
|
import { n as qualifyTableName } from "./planner-sql-checks-Bxz8yvg8-Bj6jGClB.mjs";
|
|
6
6
|
import { t as buildColumnTypeSql } from "./planner-ddl-builders-DSpQVbIm-Y4SbsU-O.mjs";
|
|
7
|
-
import { DdlColumn, FunctionColumnDefault, LiteralColumnDefault } from "@prisma/orm-family-sql/relational-core/ast";
|
|
7
|
+
import { DdlColumn, FunctionColumnDefault, LiteralColumnDefault, opaqueSql, renderOpaqueSql } from "@prisma/orm-family-sql/relational-core/ast";
|
|
8
8
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
9
9
|
import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
|
|
10
10
|
import { namingOf } from "@prisma/orm-family-sql/schema-ir/naming";
|
|
@@ -12,9 +12,9 @@ import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
|
12
12
|
import { col } from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
13
13
|
import { InternalError, assertNever } from "@prisma/orm-framework/utils/internal-error";
|
|
14
14
|
import { errorUnfilledPlaceholder } from "@prisma/orm-framework/errors/migration";
|
|
15
|
-
import { TsExpression, jsonToTsSource } from "@prisma/orm-framework/ts-render";
|
|
15
|
+
import { TsExpression, jsonToTsSource, tsObjectSource, tsQuotedTextSource } from "@prisma/orm-framework/ts-render";
|
|
16
16
|
import { REFERENTIAL_ACTION_SQL } from "@prisma/orm-family-sql/contract/referential-action-sql";
|
|
17
|
-
//#region ../../../3-targets/3-targets/postgres/dist/op-factory-call-
|
|
17
|
+
//#region ../../../3-targets/3-targets/postgres/dist/op-factory-call-lH-yj1Bq.mjs
|
|
18
18
|
/**
|
|
19
19
|
* Maps a planner schema name to the contract-free DDL builder's optional
|
|
20
20
|
* `schema` field: the unbound sentinel becomes `undefined` (the builder omits
|
|
@@ -75,7 +75,7 @@ async function dropColumn(schemaName, tableName, columnName, lowerer) {
|
|
|
75
75
|
*/
|
|
76
76
|
async function alterColumnType(schemaName, tableName, columnName, options, lowerer) {
|
|
77
77
|
const qualified = qualifyTableName(schemaName, tableName);
|
|
78
|
-
const usingClause = options.using ? ` USING ${options.using}` : ` USING ${quoteIdentifier(columnName)}::${options.qualifiedTargetType}`;
|
|
78
|
+
const usingClause = options.using ? ` USING ${renderOpaqueSql(opaqueSql(options.using))}` : ` USING ${quoteIdentifier(columnName)}::${options.qualifiedTargetType}`;
|
|
79
79
|
const { present } = await columnExistsSteps(lowerer, {
|
|
80
80
|
schema: schemaName,
|
|
81
81
|
table: tableName,
|
|
@@ -195,7 +195,7 @@ function refuseUnwritableSetDefault(tableName, column) {
|
|
|
195
195
|
...meta,
|
|
196
196
|
reason: "set-default-without-default"
|
|
197
197
|
} });
|
|
198
|
-
if (column.default.kind === "function" && column.default.expression === "autoincrement()") throw postgresError("CONTRACT.DEFAULT_INVALID", `setDefault cannot give the existing column "${column.name}" of table "${tableName}" an autoincrement() default, because autoincrement() is written as the column's SERIAL type when the column is created. Set a sequence default instead, as in fn("nextval('<sequence>'::regclass)").`, { meta: {
|
|
198
|
+
if (column.default.kind === "function" && column.default.expression.text === "autoincrement()") throw postgresError("CONTRACT.DEFAULT_INVALID", `setDefault cannot give the existing column "${column.name}" of table "${tableName}" an autoincrement() default, because autoincrement() is written as the column's SERIAL type when the column is created. Set a sequence default instead, as in fn("nextval('<sequence>'::regclass)").`, { meta: {
|
|
199
199
|
...meta,
|
|
200
200
|
reason: "set-default-autoincrement"
|
|
201
201
|
} });
|
|
@@ -356,7 +356,7 @@ async function addCheckConstraint(schemaName, tableName, constraintName, express
|
|
|
356
356
|
operationClass: "additive",
|
|
357
357
|
target: targetDetails("checkConstraint", constraintName, schemaName, tableName),
|
|
358
358
|
precheck: [step(`ensure constraint "${constraintName}" does not exist`, absent.sql, absent.params)],
|
|
359
|
-
execute: [step(`add check constraint "${constraintName}"`, `ALTER TABLE ${qualified} ADD CONSTRAINT ${quoteIdentifier(constraintName)} CHECK (${expression})`)],
|
|
359
|
+
execute: [step(`add check constraint "${constraintName}"`, `ALTER TABLE ${qualified} ADD CONSTRAINT ${quoteIdentifier(constraintName)} CHECK (${renderOpaqueSql(opaqueSql(expression))})`)],
|
|
360
360
|
postcheck: [step(`verify constraint "${constraintName}" exists`, present.sql, present.params)]
|
|
361
361
|
};
|
|
362
362
|
}
|
|
@@ -786,7 +786,7 @@ async function buildAddNotNullColumnWithTemporaryDefaultOperation(options) {
|
|
|
786
786
|
const { schema, tableName, columnName, column, codecHooks, storageTypes, temporaryDefault, lowerer } = options;
|
|
787
787
|
const ddlColumn = col(columnName, buildColumnTypeSql(column, codecHooks, storageTypes), {
|
|
788
788
|
notNull: true,
|
|
789
|
-
default: new FunctionColumnDefault(temporaryDefault)
|
|
789
|
+
default: new FunctionColumnDefault(opaqueSql(temporaryDefault))
|
|
790
790
|
});
|
|
791
791
|
const addColumn = await lowerer.lowerToExecuteRequest(alterTable({
|
|
792
792
|
...ifDefined("schema", boundSchema(schema)),
|
|
@@ -876,8 +876,8 @@ function postgresDefaultToDdlColumnDefault(columnDefault) {
|
|
|
876
876
|
case "literal": return new LiteralColumnDefault(columnDefault.value);
|
|
877
877
|
case "function":
|
|
878
878
|
if (columnDefault.expression === "autoincrement()") return void 0;
|
|
879
|
-
return new FunctionColumnDefault(columnDefault.expression);
|
|
880
|
-
case "sequence": return new FunctionColumnDefault(`nextval('${escapeLiteral(quoteIdentifier(columnDefault.name))}'::regclass)`);
|
|
879
|
+
return new FunctionColumnDefault(opaqueSql(columnDefault.expression));
|
|
880
|
+
case "sequence": return new FunctionColumnDefault(opaqueSql(`nextval('${escapeLiteral(quoteIdentifier(columnDefault.name))}'::regclass)`));
|
|
881
881
|
default: {
|
|
882
882
|
const exhaustive = columnDefault;
|
|
883
883
|
return assertNever(exhaustive, `postgresDefaultToDdlColumnDefault: unhandled kind "${blindCast(exhaustive).kind}"`);
|
|
@@ -887,7 +887,7 @@ function postgresDefaultToDdlColumnDefault(columnDefault) {
|
|
|
887
887
|
function renderDdlColumnDefault(def) {
|
|
888
888
|
if (!def) return "";
|
|
889
889
|
if (def.kind === "literal") return `lit(${jsonToTsSource(def.value)})`;
|
|
890
|
-
return `fn(${
|
|
890
|
+
return `fn(${tsQuotedTextSource(def.expression.text)})`;
|
|
891
891
|
}
|
|
892
892
|
function renderDdlColumnAsTsCall(col) {
|
|
893
893
|
const opts = [];
|
|
@@ -916,7 +916,7 @@ function renderDdlConstraintAsTsCall(constraint) {
|
|
|
916
916
|
const nameOpt = constraint.name ? `, { name: ${jsonToTsSource(constraint.name)} }` : "";
|
|
917
917
|
return `unique(${jsonToTsSource(constraint.columns)}${nameOpt})`;
|
|
918
918
|
}
|
|
919
|
-
case "check-expression": return `checkExpression(${jsonToTsSource(constraint.name)}, ${
|
|
919
|
+
case "check-expression": return `checkExpression(${jsonToTsSource(constraint.name)}, ${tsQuotedTextSource(constraint.expression.text)})`;
|
|
920
920
|
}
|
|
921
921
|
}
|
|
922
922
|
function needsColOrConstraintImport(columns) {
|
|
@@ -1597,7 +1597,7 @@ var AddCheckConstraintCall = class extends PostgresOpFactoryCallNode {
|
|
|
1597
1597
|
return addCheckConstraint(this.schemaName, this.tableName, this.constraintName, this.expression, lowerer);
|
|
1598
1598
|
}
|
|
1599
1599
|
renderTypeScript() {
|
|
1600
|
-
return `this.addCheckConstraint({ ${constraintCallOptions(this.schemaName, this.tableName, this.constraintName)}, expression: ${
|
|
1600
|
+
return `this.addCheckConstraint({ ${constraintCallOptions(this.schemaName, this.tableName, this.constraintName)}, expression: ${tsQuotedTextSource(this.expression)} })`;
|
|
1601
1601
|
}
|
|
1602
1602
|
importRequirements() {
|
|
1603
1603
|
return [];
|
|
@@ -1673,12 +1673,12 @@ var CreateIndexCall = class extends PostgresOpFactoryCallNode {
|
|
|
1673
1673
|
opts.push(`table: ${jsonToTsSource(this.tableName)}`);
|
|
1674
1674
|
opts.push(`index: ${jsonToTsSource(this.indexName)}`);
|
|
1675
1675
|
if (this.columns !== void 0) opts.push(`columns: ${jsonToTsSource(this.columns)}`);
|
|
1676
|
-
else opts.push(`expression: ${
|
|
1676
|
+
else opts.push(`expression: ${tsQuotedTextSource(this.expression ?? "")}`);
|
|
1677
1677
|
if (this.indexType !== void 0 || this.options !== void 0 || this.where !== void 0 || this.unique) {
|
|
1678
1678
|
const extrasParts = [];
|
|
1679
1679
|
if (this.indexType !== void 0) extrasParts.push(`type: ${jsonToTsSource(this.indexType)}`);
|
|
1680
1680
|
if (this.options !== void 0) extrasParts.push(`options: ${jsonToTsSource(this.options)}`);
|
|
1681
|
-
if (this.where !== void 0) extrasParts.push(`where: ${
|
|
1681
|
+
if (this.where !== void 0) extrasParts.push(`where: ${tsQuotedTextSource(this.where)}`);
|
|
1682
1682
|
if (this.unique) extrasParts.push("unique: true");
|
|
1683
1683
|
opts.push(`extras: { ${extrasParts.join(", ")} }`);
|
|
1684
1684
|
}
|
|
@@ -2034,7 +2034,18 @@ var CreatePostgresRlsPolicyCall = class extends PostgresOpFactoryCallNode {
|
|
|
2034
2034
|
...ifDefined("withCheck", p.withCheck),
|
|
2035
2035
|
permissive: p.permissive
|
|
2036
2036
|
};
|
|
2037
|
-
|
|
2037
|
+
const sources = {
|
|
2038
|
+
naming: jsonToTsSource(input.naming),
|
|
2039
|
+
tableName: jsonToTsSource(input.tableName),
|
|
2040
|
+
namespaceId: jsonToTsSource(input.namespaceId),
|
|
2041
|
+
operation: jsonToTsSource(input.operation),
|
|
2042
|
+
roles: jsonToTsSource(input.roles),
|
|
2043
|
+
using: input.using === void 0 ? void 0 : tsQuotedTextSource(input.using),
|
|
2044
|
+
withCheck: input.withCheck === void 0 ? void 0 : tsQuotedTextSource(input.withCheck),
|
|
2045
|
+
permissive: jsonToTsSource(input.permissive)
|
|
2046
|
+
};
|
|
2047
|
+
const policy = tsObjectSource(Object.entries(sources).flatMap(([key, source]) => source === void 0 ? [] : [[key, source]]));
|
|
2048
|
+
return `this.createRlsPolicy({ schema: ${jsonToTsSource(this.schemaName)}, table: ${jsonToTsSource(this.tableName)}, policy: ${policy} })`;
|
|
2038
2049
|
}
|
|
2039
2050
|
importRequirements() {
|
|
2040
2051
|
return [];
|
|
@@ -2150,4 +2161,4 @@ function columnNameOfCall(call) {
|
|
|
2150
2161
|
//#endregion
|
|
2151
2162
|
export { RenameIndexCall as A, renameTableStatement as B, DropNativeEnumTypeCall as C, EnableRowLevelSecurityCall as D, DropTableCall as E, buildTargetDetails as F, columnNameOfCall as I, createExtension as L, RenameTableCall as M, SetDefaultCall as N, RawSqlCall as O, SetNotNullCall as P, installExtension as R, DropIndexCall as S, DropPostgresRlsPolicyCall as T, DisableRowLevelSecurityCall as _, AddNotNullColumnDirectCall as a, DropConstraintCall as b, AddUniqueCall as c, CreateIndexCall as d, CreateNativeEnumTypeCall as f, DataTransformCall as g, CreateTableCall as h, AddNativeEnumValueCall as i, RenamePostgresRlsPolicyCall as j, RenameConstraintCall as k, AlterColumnTypeCall as l, CreateSchemaCall as m, AddColumnCall as n, AddNotNullColumnWithTempDefaultCall as o, CreatePostgresRlsPolicyCall as p, AddForeignKeyCall as r, AddPrimaryKeyCall as s, AddCheckConstraintCall as t, CreateExtensionCall as u, DropCheckConstraintCall as v, DropNotNullCall as w, DropDefaultCall as x, DropColumnCall as y, postgresDefaultToDdlColumnDefault as z };
|
|
2152
2163
|
|
|
2153
|
-
//# sourceMappingURL=op-factory-call-
|
|
2164
|
+
//# sourceMappingURL=op-factory-call-lH-yj1Bq-B1g2DpyX.mjs.map
|