@prisma-next/target-postgres 0.14.0-dev.8 → 0.14.0-dev.81
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/authoring-ChmUI_tC.mjs +674 -0
- package/dist/authoring-ChmUI_tC.mjs.map +1 -0
- package/dist/canonicalize-D1F4vUnP.d.mts +48 -0
- package/dist/canonicalize-D1F4vUnP.d.mts.map +1 -0
- package/dist/{codec-ids-CnXu9Qy3.d.mts → codec-ids-BzrFF-I4.d.mts} +3 -2
- package/dist/codec-ids-BzrFF-I4.d.mts.map +1 -0
- package/dist/{codec-ids-BvytN2P8.mjs → codec-ids-C_-Hj6bL.mjs} +3 -2
- package/dist/codec-ids-C_-Hj6bL.mjs.map +1 -0
- package/dist/codec-ids.d.mts +2 -2
- package/dist/codec-ids.mjs +2 -2
- package/dist/{codec-types-DHCkwPKE.d.mts → codec-types-BiIWziRO.d.mts} +3 -2
- package/dist/codec-types-BiIWziRO.d.mts.map +1 -0
- package/dist/codec-types.d.mts +1 -1
- package/dist/codecs-BemGS69L.mjs +927 -0
- package/dist/codecs-BemGS69L.mjs.map +1 -0
- package/dist/{codecs--0A5_4Bq.d.mts → codecs-Cm-nS4mQ.d.mts} +111 -4
- package/dist/codecs-Cm-nS4mQ.d.mts.map +1 -0
- package/dist/codecs.d.mts +2 -2
- package/dist/codecs.mjs +3 -757
- package/dist/codecs.mjs.map +1 -1
- package/dist/contract-free.d.mts +33 -3
- package/dist/contract-free.d.mts.map +1 -1
- package/dist/contract-free.mjs +23 -7
- package/dist/contract-free.mjs.map +1 -1
- package/dist/control-policy-BfQLCrha.mjs +1285 -0
- package/dist/control-policy-BfQLCrha.mjs.map +1 -0
- package/dist/control.d.mts +2 -2
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +866 -36
- package/dist/control.mjs.map +1 -1
- package/dist/data-transform-BOWpliq8.mjs.map +1 -1
- package/dist/{data-transform-DDgWdB5o.d.mts → data-transform-DPzwBMhW.d.mts} +3 -3
- package/dist/{data-transform-DDgWdB5o.d.mts.map → data-transform-DPzwBMhW.d.mts.map} +1 -1
- package/dist/data-transform.d.mts +1 -1
- package/dist/{ddl-QDyOSeLc.mjs → ddl-eBZav_MS.mjs} +128 -6
- package/dist/ddl-eBZav_MS.mjs.map +1 -0
- package/dist/ddl.d.mts +3 -2
- package/dist/ddl.mjs +2 -2
- package/dist/default-normalizer.d.mts +1 -1
- package/dist/default-normalizer.d.mts.map +1 -1
- package/dist/default-normalizer.mjs +247 -1
- package/dist/default-normalizer.mjs.map +1 -0
- package/dist/descriptor-meta-DAwRBZpA.mjs +23 -0
- package/dist/descriptor-meta-DAwRBZpA.mjs.map +1 -0
- package/dist/descriptor-meta-runtime-UwYdV8fD.mjs +12 -0
- package/dist/descriptor-meta-runtime-UwYdV8fD.mjs.map +1 -0
- package/dist/diff-database-schema-jsEOfSYT.mjs +305 -0
- package/dist/diff-database-schema-jsEOfSYT.mjs.map +1 -0
- package/dist/diff-database-schema.d.mts +46 -0
- package/dist/diff-database-schema.d.mts.map +1 -0
- package/dist/diff-database-schema.mjs +2 -0
- package/dist/errors-DO-w0EUS.mjs +35 -0
- package/dist/errors-DO-w0EUS.mjs.map +1 -0
- package/dist/errors.d.mts +11 -9
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/issue-planner.d.mts +35 -11
- package/dist/issue-planner.d.mts.map +1 -1
- package/dist/issue-planner.mjs +2 -2
- package/dist/migration.d.mts +5 -5
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +4 -4
- package/dist/namespace-ids-xtp_ZY86.mjs +7 -0
- package/dist/namespace-ids-xtp_ZY86.mjs.map +1 -0
- package/dist/native-type-normalizer.mjs +37 -1
- package/dist/native-type-normalizer.mjs.map +1 -0
- package/dist/nodes-DJC5B8Id.mjs +192 -0
- package/dist/nodes-DJC5B8Id.mjs.map +1 -0
- package/dist/nodes-Dv5eCSq9.d.mts +170 -0
- package/dist/nodes-Dv5eCSq9.d.mts.map +1 -0
- package/dist/{op-factory-call-DmQEc3XV.d.mts → op-factory-call-Bn9zDx4_.d.mts} +114 -15
- package/dist/op-factory-call-Bn9zDx4_.d.mts.map +1 -0
- package/dist/{op-factory-call-D_p5vxwt.mjs → op-factory-call-Dwsb1xzl.mjs} +469 -32
- package/dist/op-factory-call-Dwsb1xzl.mjs.map +1 -0
- package/dist/op-factory-call.d.mts +2 -2
- package/dist/op-factory-call.mjs +2 -2
- package/dist/pack.d.mts +321 -3
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/planner-ChCtpEGe.mjs +390 -0
- package/dist/planner-ChCtpEGe.mjs.map +1 -0
- package/dist/{planner-ddl-builders-B2wOwLqI.mjs → planner-ddl-builders-BKlmGDJl.mjs} +17 -28
- package/dist/planner-ddl-builders-BKlmGDJl.mjs.map +1 -0
- package/dist/planner-ddl-builders.d.mts +4 -6
- package/dist/planner-ddl-builders.d.mts.map +1 -1
- package/dist/planner-ddl-builders.mjs +2 -2
- package/dist/planner-identity-values-CJPha2Sz.mjs.map +1 -1
- package/dist/planner-identity-values.d.mts +8 -2
- package/dist/planner-identity-values.d.mts.map +1 -1
- package/dist/planner-identity-values.mjs +2 -2
- package/dist/{planner-produced-postgres-migration-QqHa2C2l.d.mts → planner-produced-postgres-migration-BEY1T0Xm.d.mts} +4 -4
- package/dist/{planner-produced-postgres-migration-QqHa2C2l.d.mts.map → planner-produced-postgres-migration-BEY1T0Xm.d.mts.map} +1 -1
- package/dist/{planner-produced-postgres-migration-Cji5vxUf.mjs → planner-produced-postgres-migration-Bb16yHNX.mjs} +3 -3
- package/dist/{planner-produced-postgres-migration-Cji5vxUf.mjs.map → planner-produced-postgres-migration-Bb16yHNX.mjs.map} +1 -1
- package/dist/planner-produced-postgres-migration.d.mts +1 -1
- package/dist/planner-produced-postgres-migration.mjs +1 -1
- package/dist/{planner-sql-checks-jqUUGyQR.mjs → planner-sql-checks-Cx0ATsPc.mjs} +5 -5
- package/dist/{planner-sql-checks-jqUUGyQR.mjs.map → planner-sql-checks-Cx0ATsPc.mjs.map} +1 -1
- package/dist/planner-sql-checks.d.mts +2 -2
- package/dist/planner-sql-checks.d.mts.map +1 -1
- package/dist/planner-sql-checks.mjs +1 -1
- package/dist/{planner-target-details-CIY6tLeo.d.mts → planner-target-details-HkP4RrRO.d.mts} +2 -2
- package/dist/planner-target-details-HkP4RrRO.d.mts.map +1 -0
- package/dist/planner-target-details.d.mts +1 -1
- package/dist/planner.d.mts +72 -17
- package/dist/planner.d.mts.map +1 -1
- package/dist/planner.mjs +3 -2
- package/dist/{postgres-contract-serializer-k3TAcPMY.mjs → postgres-contract-view-BiDhl5Ez.mjs} +45 -41
- package/dist/postgres-contract-view-BiDhl5Ez.mjs.map +1 -0
- package/dist/postgres-contract-view-C9j5cqP0.d.mts +34 -0
- package/dist/postgres-contract-view-C9j5cqP0.d.mts.map +1 -0
- package/dist/postgres-database-schema-node-CJv5bfbs.d.mts +262 -0
- package/dist/postgres-database-schema-node-CJv5bfbs.d.mts.map +1 -0
- package/dist/{postgres-migration-B5jKrXv3.mjs → postgres-migration-Cj5Tpj1a.mjs} +78 -45
- package/dist/postgres-migration-Cj5Tpj1a.mjs.map +1 -0
- package/dist/{postgres-migration-Y4YBJqkS.d.mts → postgres-migration-DbckK1su.d.mts} +58 -9
- package/dist/postgres-migration-DbckK1su.d.mts.map +1 -0
- package/dist/postgres-native-enum-BwVNf0Ku.mjs +45 -0
- package/dist/postgres-native-enum-BwVNf0Ku.mjs.map +1 -0
- package/dist/postgres-rls-policy--CSddvMR.d.mts +52 -0
- package/dist/postgres-rls-policy--CSddvMR.d.mts.map +1 -0
- package/dist/postgres-role-schema-node-Cm-j0ZGM.mjs +190 -0
- package/dist/postgres-role-schema-node-Cm-j0ZGM.mjs.map +1 -0
- package/dist/{postgres-schema-COGZ1ark.mjs → postgres-schema-ChBj22nX.mjs} +200 -11
- package/dist/postgres-schema-ChBj22nX.mjs.map +1 -0
- package/dist/postgres-schema-DKq6s1P3.d.mts +269 -0
- package/dist/postgres-schema-DKq6s1P3.d.mts.map +1 -0
- package/dist/postgres-table-schema-node-D6LvInCe.mjs +216 -0
- package/dist/postgres-table-schema-node-D6LvInCe.mjs.map +1 -0
- package/dist/render-ops.d.mts +1 -1
- package/dist/{render-typescript-KMgosran.mjs → render-typescript-7yqILcwr.mjs} +45 -16
- package/dist/render-typescript-7yqILcwr.mjs.map +1 -0
- package/dist/render-typescript.mjs +1 -1
- package/dist/resolve-ddl-schema-BCSMHFwl.mjs +22 -0
- package/dist/resolve-ddl-schema-BCSMHFwl.mjs.map +1 -0
- package/dist/rls-canonicalize.d.mts +27 -0
- package/dist/rls-canonicalize.d.mts.map +1 -0
- package/dist/rls-canonicalize.mjs +2 -0
- package/dist/runtime.d.mts +6 -8
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +3 -3
- package/dist/runtime.mjs.map +1 -1
- package/dist/schema-ir-annotations.d.mts +15 -0
- package/dist/schema-ir-annotations.d.mts.map +1 -0
- package/dist/schema-ir-annotations.mjs +2 -0
- package/dist/{sql-utils-DcfMz4MQ.mjs → sql-utils-SU4FDvIV.mjs} +12 -3
- package/dist/{sql-utils-DcfMz4MQ.mjs.map → sql-utils-SU4FDvIV.mjs.map} +1 -1
- package/dist/sql-utils.d.mts +8 -1
- package/dist/sql-utils.d.mts.map +1 -1
- package/dist/sql-utils.mjs +2 -2
- package/dist/types.d.mts +4 -140
- package/dist/types.mjs +5 -2
- package/dist/wire-name-DbQ9-2RC.mjs +104 -0
- package/dist/wire-name-DbQ9-2RC.mjs.map +1 -0
- package/package.json +26 -20
- package/src/contract-free/checks.ts +153 -0
- package/src/contract-free/control-bootstrap.ts +20 -3
- package/src/contract-free/ddl.ts +98 -1
- package/src/core/authoring.ts +726 -2
- package/src/core/codec-helpers.ts +33 -7
- package/src/core/codec-ids.ts +1 -0
- package/src/core/codec-type-map.ts +2 -0
- package/src/core/codecs.ts +193 -12
- package/src/core/ddl/nodes.ts +185 -2
- package/src/core/default-normalizer.ts +122 -2
- package/src/core/descriptor-meta.ts +12 -1
- package/src/core/entity-kinds.ts +41 -0
- package/src/core/errors.ts +14 -12
- package/src/core/migrations/bound-schema.ts +10 -0
- package/src/core/migrations/column-ddl-rendering.ts +117 -0
- package/src/core/migrations/contract-to-postgres-database-schema-node.ts +189 -0
- package/src/core/migrations/control-policy.ts +217 -65
- package/src/core/migrations/diff-database-schema.ts +252 -0
- package/src/core/migrations/issue-planner.ts +817 -656
- package/src/core/migrations/op-factory-call.ts +383 -23
- package/src/core/migrations/operations/columns.ts +24 -12
- package/src/core/migrations/operations/constraints.ts +1 -1
- package/src/core/migrations/operations/data-transform.ts +6 -0
- package/src/core/migrations/operations/dependencies.ts +2 -1
- package/src/core/migrations/operations/native-enum-types.ts +62 -0
- package/src/core/migrations/operations/rls.ts +187 -0
- package/src/core/migrations/operations/shared.ts +0 -30
- package/src/core/migrations/planner-ddl-builders.ts +31 -59
- package/src/core/migrations/planner-identity-values.ts +1 -1
- package/src/core/migrations/planner-recipes.ts +31 -13
- package/src/core/migrations/planner-sql-checks.ts +1 -1
- package/src/core/migrations/planner-strategies.ts +248 -216
- package/src/core/migrations/planner-target-details.ts +3 -1
- package/src/core/migrations/planner.ts +357 -67
- package/src/core/migrations/postgres-migration.ts +118 -86
- package/src/core/migrations/render-typescript.ts +42 -15
- package/src/core/migrations/resolve-ddl-schema.ts +26 -0
- package/src/core/migrations/runner.ts +11 -16
- package/src/core/migrations/verify-postgres-namespaces.ts +46 -31
- package/src/core/namespace-ids.ts +3 -0
- package/src/core/postgres-contract-serializer.ts +46 -71
- package/src/core/postgres-contract-view.ts +48 -0
- package/src/core/postgres-native-enum.ts +61 -0
- package/src/core/postgres-rls-enablement.ts +34 -0
- package/src/core/postgres-rls-policy.ts +64 -0
- package/src/core/postgres-role.ts +59 -0
- package/src/core/postgres-schema-verifier.ts +10 -7
- package/src/core/postgres-schema.ts +85 -15
- package/src/core/postgres-validators.ts +34 -0
- package/src/core/psl-infer/infer-psl-contract.ts +1273 -0
- package/src/core/psl-infer/postgres-default-mapping.ts +16 -0
- package/src/core/psl-infer/postgres-type-map.ts +128 -0
- package/src/core/rls/canonicalize.ts +65 -0
- package/src/core/rls/wire-name.ts +33 -0
- package/src/core/schema-ir/node-storage-coordinate.ts +26 -0
- package/src/core/schema-ir/postgres-database-schema-node.ts +61 -0
- package/src/core/schema-ir/postgres-namespace-schema-node.ts +70 -0
- package/src/core/schema-ir/postgres-native-enum-schema-node.ts +83 -0
- package/src/core/schema-ir/postgres-policy-schema-node.ts +90 -0
- package/src/core/schema-ir/postgres-role-schema-node.ts +65 -0
- package/src/core/schema-ir/postgres-table-schema-node.ts +140 -0
- package/src/core/schema-ir/schema-node-kinds.ts +122 -0
- package/src/core/sql-utils.ts +15 -2
- package/src/exports/codecs.ts +3 -0
- package/src/exports/contract-free.ts +11 -1
- package/src/exports/control.ts +27 -33
- package/src/exports/ddl.ts +8 -0
- package/src/exports/diff-database-schema.ts +7 -0
- package/src/exports/issue-planner.ts +1 -1
- package/src/exports/migration.ts +1 -0
- package/src/exports/op-factory-call.ts +4 -0
- package/src/exports/planner-ddl-builders.ts +0 -2
- package/src/exports/planner-identity-values.ts +4 -1
- package/src/exports/planner.ts +1 -0
- package/src/exports/rls-canonicalize.ts +12 -0
- package/src/exports/runtime.ts +1 -0
- package/src/exports/schema-ir-annotations.ts +1 -0
- package/src/exports/sql-utils.ts +1 -0
- package/src/exports/types.ts +37 -0
- package/dist/codec-ids-BvytN2P8.mjs.map +0 -1
- package/dist/codec-ids-CnXu9Qy3.d.mts.map +0 -1
- package/dist/codec-types-DHCkwPKE.d.mts.map +0 -1
- package/dist/codecs--0A5_4Bq.d.mts.map +0 -1
- package/dist/ddl-QDyOSeLc.mjs.map +0 -1
- package/dist/default-normalizer-DyyCHQWs.mjs +0 -131
- package/dist/default-normalizer-DyyCHQWs.mjs.map +0 -1
- package/dist/descriptor-meta-CpGygXpI.mjs +0 -140
- package/dist/descriptor-meta-CpGygXpI.mjs.map +0 -1
- package/dist/errors-CUk87ByX.mjs +0 -33
- package/dist/errors-CUk87ByX.mjs.map +0 -1
- package/dist/issue-planner-DL6g3CmE.mjs +0 -824
- package/dist/issue-planner-DL6g3CmE.mjs.map +0 -1
- package/dist/native-type-normalizer-Bc9XJzWC.mjs +0 -38
- package/dist/native-type-normalizer-Bc9XJzWC.mjs.map +0 -1
- package/dist/nodes-Bbhs2rwj.mjs +0 -76
- package/dist/nodes-Bbhs2rwj.mjs.map +0 -1
- package/dist/nodes-pLeLgdis.d.mts +0 -67
- package/dist/nodes-pLeLgdis.d.mts.map +0 -1
- package/dist/op-factory-call-D_p5vxwt.mjs.map +0 -1
- package/dist/op-factory-call-DmQEc3XV.d.mts.map +0 -1
- package/dist/planner-Bs_baQax.mjs +0 -324
- package/dist/planner-Bs_baQax.mjs.map +0 -1
- package/dist/planner-ddl-builders-B2wOwLqI.mjs.map +0 -1
- package/dist/planner-target-details-CIY6tLeo.d.mts.map +0 -1
- package/dist/postgres-contract-serializer-k3TAcPMY.mjs.map +0 -1
- package/dist/postgres-migration-B5jKrXv3.mjs.map +0 -1
- package/dist/postgres-migration-Y4YBJqkS.d.mts.map +0 -1
- package/dist/postgres-schema-COGZ1ark.mjs.map +0 -1
- package/dist/render-typescript-KMgosran.mjs.map +0 -1
- package/dist/types.d.mts.map +0 -1
- package/src/core/postgres-enum-type-schema.ts +0 -17
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-name-DbQ9-2RC.mjs","names":[],"sources":["../src/core/rls/canonicalize.ts","../src/core/rls/wire-name.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\n\nexport type RlsPolicyOperation = 'select' | 'insert' | 'update' | 'delete' | 'all';\n\n/**\n * Which predicate each RLS operation admits, mirroring Postgres: SELECT and\n * DELETE decide row visibility/eligibility with `USING` only; INSERT\n * validates the new row with `WITH CHECK` only; UPDATE and ALL take either\n * or both. Single-homed here so the PSL lowering and the TS handle\n * constructors enforce the same matrix.\n */\nexport const POLICY_OPERATION_PREDICATES: Readonly<\n Record<RlsPolicyOperation, { readonly using: boolean; readonly withCheck: boolean }>\n> = {\n select: { using: true, withCheck: false },\n insert: { using: false, withCheck: true },\n update: { using: true, withCheck: true },\n delete: { using: true, withCheck: false },\n all: { using: true, withCheck: true },\n};\n\nexport interface ContentHashParts {\n readonly using?: string;\n readonly withCheck?: string;\n readonly roles: readonly string[];\n readonly operation: RlsPolicyOperation;\n readonly permissive: boolean;\n}\n\n/**\n * Stabilizes an authored predicate for hashing: trim, and collapse runs of\n * internal whitespace to a single space.\n *\n * This is deliberately minimal. The content hash is the equivalence relation\n * for a policy, and the wire name (prefix + hash) is the only thing ever\n * compared — we never recompute the hash from an introspected policy body, so\n * there is no need to match Postgres's reprinted form. Minimal normalization\n * also protects the no-collision property: aggressive rewriting (lowercasing,\n * paren-stripping, cast-alias folding) risks collapsing two distinct predicates\n * onto one hash. Out-of-band alteration of a hashed policy is unsupported.\n *\n * The normalizer is a stability commitment: any change re-suffixes all wire names.\n */\nexport function normalizePredicate(sql: string): string {\n return sql.replace(/\\s+/g, ' ').trim();\n}\n\n/**\n * Returns the first 8 lowercase hex characters of the SHA-256 digest over the\n * canonical content tuple for an RLS policy:\n *\n * [normalize(using), normalize(withCheck), sortedRoles, operation, permissive]\n *\n * Schema and table are excluded (they are orthogonal to policy equivalence).\n * Uses `JSON.stringify` for a deterministic encoding.\n */\nexport function computeContentHash(parts: ContentHashParts): string {\n const using = normalizePredicate(parts.using ?? '');\n const withCheck = normalizePredicate(parts.withCheck ?? '');\n const roles = [...new Set(parts.roles)].sort();\n const permissive = parts.permissive ? 'permissive' : 'restrictive';\n\n const tuple = JSON.stringify([using, withCheck, roles, parts.operation, permissive]);\n return createHash('sha256').update(tuple).digest('hex').slice(0, 8);\n}\n","export interface RlsPolicyWireName {\n /** The user-supplied part before the `_<8hex>` suffix. */\n readonly prefix: string;\n /** The 8-lowercase-hex content-hash suffix. */\n readonly hash: string;\n}\n\nconst WIRE_NAME_PATTERN = /^(.+)_([0-9a-f]{8})$/;\n\n/**\n * Assembles an RLS policy wire name from its user-supplied prefix and its\n * 8-hex content-hash suffix. This module owns the `<prefix>_<hash>` format\n * on both sides — construction here and parsing in\n * {@link parseRlsPolicyWireName} — so the two never drift.\n */\nexport function formatRlsPolicyWireName(prefix: string, hash: string): string {\n return `${prefix}_${hash}`;\n}\n\n/**\n * Splits an RLS policy wire name (`<prefix>_<8hex>`) into its prefix and\n * content-hash suffix. Returns `undefined` when the name does not follow the\n * wire-name shape (e.g. a policy created outside the toolchain) — callers\n * treat such names as all-prefix. Consumed by introspection (prefix\n * extraction) and by rename pairing (same hash, different prefix).\n */\nexport function parseRlsPolicyWireName(name: string): RlsPolicyWireName | undefined {\n const match = WIRE_NAME_PATTERN.exec(name);\n const prefix = match?.[1];\n const hash = match?.[2];\n if (prefix === undefined || hash === undefined) return undefined;\n return { prefix, hash };\n}\n"],"mappings":";;;;;;;;;AAWA,MAAa,8BAET;CACF,QAAQ;EAAE,OAAO;EAAM,WAAW;CAAM;CACxC,QAAQ;EAAE,OAAO;EAAO,WAAW;CAAK;CACxC,QAAQ;EAAE,OAAO;EAAM,WAAW;CAAK;CACvC,QAAQ;EAAE,OAAO;EAAM,WAAW;CAAM;CACxC,KAAK;EAAE,OAAO;EAAM,WAAW;CAAK;AACtC;;;;;;;;;;;;;;;AAwBA,SAAgB,mBAAmB,KAAqB;CACtD,OAAO,IAAI,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAK;AACvC;;;;;;;;;;AAWA,SAAgB,mBAAmB,OAAiC;CAClE,MAAM,QAAQ,mBAAmB,MAAM,SAAS,EAAE;CAClD,MAAM,YAAY,mBAAmB,MAAM,aAAa,EAAE;CAC1D,MAAM,QAAQ,CAAC,GAAG,IAAI,IAAI,MAAM,KAAK,CAAC,CAAC,CAAC,KAAK;CAC7C,MAAM,aAAa,MAAM,aAAa,eAAe;CAErD,MAAM,QAAQ,KAAK,UAAU;EAAC;EAAO;EAAW;EAAO,MAAM;EAAW;CAAU,CAAC;CACnF,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;AACpE;;;ACzDA,MAAM,oBAAoB;;;;;;;AAQ1B,SAAgB,wBAAwB,QAAgB,MAAsB;CAC5E,OAAO,GAAG,OAAO,GAAG;AACtB;;;;;;;;AASA,SAAgB,uBAAuB,MAA6C;CAClF,MAAM,QAAQ,kBAAkB,KAAK,IAAI;CACzC,MAAM,SAAS,QAAQ;CACvB,MAAM,OAAO,QAAQ;CACrB,IAAI,WAAW,KAAA,KAAa,SAAS,KAAA,GAAW,OAAO,KAAA;CACvD,OAAO;EAAE;EAAQ;CAAK;AACxB"}
|
package/package.json
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/target-postgres",
|
|
3
|
-
"version": "0.14.0-dev.
|
|
3
|
+
"version": "0.14.0-dev.81",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"description": "Postgres target pack for Prisma Next",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@prisma-next/cli": "0.14.0-dev.
|
|
10
|
-
"@prisma-next/contract": "0.14.0-dev.
|
|
11
|
-
"@prisma-next/errors": "0.14.0-dev.
|
|
12
|
-
"@prisma-next/family-sql": "0.14.0-dev.
|
|
13
|
-
"@prisma-next/framework-components": "0.14.0-dev.
|
|
14
|
-
"@prisma-next/migration-tools": "0.14.0-dev.
|
|
15
|
-
"@prisma-next/
|
|
16
|
-
"@prisma-next/sql-contract": "0.14.0-dev.
|
|
17
|
-
"@prisma-next/sql-errors": "0.14.0-dev.
|
|
18
|
-
"@prisma-next/sql-operations": "0.14.0-dev.
|
|
19
|
-
"@prisma-next/sql-relational-core": "0.14.0-dev.
|
|
20
|
-
"@prisma-next/sql-schema-ir": "0.14.0-dev.
|
|
21
|
-
"@prisma-next/
|
|
9
|
+
"@prisma-next/cli": "0.14.0-dev.81",
|
|
10
|
+
"@prisma-next/contract": "0.14.0-dev.81",
|
|
11
|
+
"@prisma-next/errors": "0.14.0-dev.81",
|
|
12
|
+
"@prisma-next/family-sql": "0.14.0-dev.81",
|
|
13
|
+
"@prisma-next/framework-components": "0.14.0-dev.81",
|
|
14
|
+
"@prisma-next/migration-tools": "0.14.0-dev.81",
|
|
15
|
+
"@prisma-next/psl-parser": "0.14.0-dev.81",
|
|
16
|
+
"@prisma-next/sql-contract": "0.14.0-dev.81",
|
|
17
|
+
"@prisma-next/sql-errors": "0.14.0-dev.81",
|
|
18
|
+
"@prisma-next/sql-operations": "0.14.0-dev.81",
|
|
19
|
+
"@prisma-next/sql-relational-core": "0.14.0-dev.81",
|
|
20
|
+
"@prisma-next/sql-schema-ir": "0.14.0-dev.81",
|
|
21
|
+
"@prisma-next/ts-render": "0.14.0-dev.81",
|
|
22
|
+
"@prisma-next/utils": "0.14.0-dev.81",
|
|
22
23
|
"@standard-schema/spec": "^1.1.0",
|
|
23
|
-
"arktype": "^2.2.
|
|
24
|
+
"arktype": "^2.2.2",
|
|
24
25
|
"pathe": "^2.0.3"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"@prisma-next/
|
|
28
|
-
"@prisma-next/
|
|
29
|
-
"@prisma-next/
|
|
30
|
-
"
|
|
28
|
+
"@prisma-next/psl-printer": "0.14.0-dev.81",
|
|
29
|
+
"@prisma-next/sql-contract-psl": "0.14.0-dev.81",
|
|
30
|
+
"@prisma-next/test-utils": "0.14.0-dev.81",
|
|
31
|
+
"@prisma-next/tsconfig": "0.14.0-dev.81",
|
|
32
|
+
"@prisma-next/tsdown": "0.14.0-dev.81",
|
|
33
|
+
"tsdown": "0.22.3",
|
|
31
34
|
"typescript": "5.9.3",
|
|
32
|
-
"vitest": "4.1.
|
|
35
|
+
"vitest": "4.1.10"
|
|
33
36
|
},
|
|
34
37
|
"peerDependencies": {
|
|
35
38
|
"typescript": ">=5.9"
|
|
@@ -53,6 +56,7 @@
|
|
|
53
56
|
"./data-transform": "./dist/data-transform.mjs",
|
|
54
57
|
"./ddl": "./dist/ddl.mjs",
|
|
55
58
|
"./default-normalizer": "./dist/default-normalizer.mjs",
|
|
59
|
+
"./diff-database-schema": "./dist/diff-database-schema.mjs",
|
|
56
60
|
"./errors": "./dist/errors.mjs",
|
|
57
61
|
"./issue-planner": "./dist/issue-planner.mjs",
|
|
58
62
|
"./migration": "./dist/migration.mjs",
|
|
@@ -68,7 +72,9 @@
|
|
|
68
72
|
"./planner-target-details": "./dist/planner-target-details.mjs",
|
|
69
73
|
"./render-ops": "./dist/render-ops.mjs",
|
|
70
74
|
"./render-typescript": "./dist/render-typescript.mjs",
|
|
75
|
+
"./rls-canonicalize": "./dist/rls-canonicalize.mjs",
|
|
71
76
|
"./runtime": "./dist/runtime.mjs",
|
|
77
|
+
"./schema-ir-annotations": "./dist/schema-ir-annotations.mjs",
|
|
72
78
|
"./sql-utils": "./dist/sql-utils.mjs",
|
|
73
79
|
"./types": "./dist/types.mjs",
|
|
74
80
|
"./package.json": "./package.json"
|
|
@@ -345,6 +345,79 @@ export function extensionExistsAst(extensionName: string): ExtensionExistsCheckB
|
|
|
345
345
|
};
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
export interface RlsPolicyExistsCheckBuilder {
|
|
349
|
+
policyPresent(): SelectAst;
|
|
350
|
+
policyAbsent(): SelectAst;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Typed RLS-policy existence check over `pg_policies`, with schema, table,
|
|
355
|
+
* and policy names bound as text parameters (never inlined). The `schema`
|
|
356
|
+
* coordinate is the resolved live-database schema name (e.g. `'public'`),
|
|
357
|
+
* compared against `pg_policies.schemaname` as a bound parameter.
|
|
358
|
+
*/
|
|
359
|
+
export function rlsPolicyExistsAst(options: {
|
|
360
|
+
readonly schema: string;
|
|
361
|
+
readonly table: string;
|
|
362
|
+
readonly policyName: string;
|
|
363
|
+
}): RlsPolicyExistsCheckBuilder {
|
|
364
|
+
const inner = () =>
|
|
365
|
+
exprSelect()
|
|
366
|
+
.from(cfTable('pg_policies'))
|
|
367
|
+
.project('one', cfExpr.lit(1))
|
|
368
|
+
.where(
|
|
369
|
+
cfExpr.allOf([
|
|
370
|
+
cfExpr.identifierRef('schemaname').eqParam(options.schema, PG_TEXT_CODEC_ID),
|
|
371
|
+
cfExpr.identifierRef('tablename').eqParam(options.table, PG_TEXT_CODEC_ID),
|
|
372
|
+
cfExpr.identifierRef('policyname').eqParam(options.policyName, PG_TEXT_CODEC_ID),
|
|
373
|
+
]),
|
|
374
|
+
);
|
|
375
|
+
return {
|
|
376
|
+
policyPresent: () => exprSelect().project('result', cfExpr.exists(inner())).build(),
|
|
377
|
+
policyAbsent: () => exprSelect().project('result', cfExpr.notExists(inner())).build(),
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export interface RlsEnabledCheckBuilder {
|
|
382
|
+
rlsEnabled(): SelectAst;
|
|
383
|
+
rlsDisabled(): SelectAst;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Typed row-level-security enabled check over `pg_class` joined to
|
|
388
|
+
* `pg_namespace`, comparing `pg_class.relrowsecurity` against the expected
|
|
389
|
+
* boolean. Schema and table names are bound as text parameters.
|
|
390
|
+
*/
|
|
391
|
+
export function rlsEnabledAst(schema: string, table: string): RlsEnabledCheckBuilder {
|
|
392
|
+
const inner = (enabled: boolean) =>
|
|
393
|
+
exprSelect()
|
|
394
|
+
.from(cfTable('pg_class', 'c'))
|
|
395
|
+
.join(
|
|
396
|
+
cfTable('pg_namespace', 'n'),
|
|
397
|
+
cfExpr.columnRef('n', 'oid').eqExpr(cfExpr.columnRef('c', 'relnamespace')),
|
|
398
|
+
)
|
|
399
|
+
.project('one', cfExpr.lit(1))
|
|
400
|
+
.where(
|
|
401
|
+
cfExpr.allOf([
|
|
402
|
+
cfExpr.columnRef('n', 'nspname').eqParam(schema, PG_TEXT_CODEC_ID),
|
|
403
|
+
cfExpr.columnRef('c', 'relname').eqParam(table, PG_TEXT_CODEC_ID),
|
|
404
|
+
enabled
|
|
405
|
+
? cfExpr.columnRef('c', 'relrowsecurity')
|
|
406
|
+
: cfExpr.columnRef('c', 'relrowsecurity').not(),
|
|
407
|
+
]),
|
|
408
|
+
);
|
|
409
|
+
return {
|
|
410
|
+
rlsEnabled: () =>
|
|
411
|
+
exprSelect()
|
|
412
|
+
.project('result', cfExpr.exists(inner(true)))
|
|
413
|
+
.build(),
|
|
414
|
+
rlsDisabled: () =>
|
|
415
|
+
exprSelect()
|
|
416
|
+
.project('result', cfExpr.exists(inner(false)))
|
|
417
|
+
.build(),
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
|
|
348
421
|
export interface IndexExistsCheckBuilder {
|
|
349
422
|
indexPresent(): SelectAst;
|
|
350
423
|
indexAbsent(): SelectAst;
|
|
@@ -361,3 +434,83 @@ export function indexExistsAst(schema: string, indexName: string): IndexExistsCh
|
|
|
361
434
|
indexAbsent: () => exprSelect().project('result', regclass.isNull()).build(),
|
|
362
435
|
};
|
|
363
436
|
}
|
|
437
|
+
|
|
438
|
+
export interface NativeEnumTypeExistsCheckBuilder {
|
|
439
|
+
typePresent(): SelectAst;
|
|
440
|
+
typeAbsent(): SelectAst;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Typed native-enum type existence check over `pg_type` joined to
|
|
445
|
+
* `pg_namespace`, restricted to enum types (`typtype = 'e'`). Schema and
|
|
446
|
+
* type name are bound as text parameters; `schema` is a namespace
|
|
447
|
+
* coordinate (the `__unbound__` sentinel compares against
|
|
448
|
+
* `current_schema()`), matching {@link tableExistsAst} et al.
|
|
449
|
+
*/
|
|
450
|
+
export function nativeEnumTypeExistsAst(
|
|
451
|
+
schema: string,
|
|
452
|
+
typeName: string,
|
|
453
|
+
): NativeEnumTypeExistsCheckBuilder {
|
|
454
|
+
const inner = () =>
|
|
455
|
+
exprSelect()
|
|
456
|
+
.from(cfTable('pg_type', 't'))
|
|
457
|
+
.join(
|
|
458
|
+
cfTable('pg_namespace', 'n'),
|
|
459
|
+
cfExpr.columnRef('n', 'oid').eqExpr(cfExpr.columnRef('t', 'typnamespace')),
|
|
460
|
+
)
|
|
461
|
+
.project('one', cfExpr.lit(1))
|
|
462
|
+
.where(
|
|
463
|
+
cfExpr.allOf([
|
|
464
|
+
cfExpr.columnRef('n', 'nspname').eqExpr(checkNamespace(schema).schemaFilterExpression()),
|
|
465
|
+
cfExpr.columnRef('t', 'typname').eqParam(typeName, PG_TEXT_CODEC_ID),
|
|
466
|
+
cfExpr.columnRef('t', 'typtype').eqParam('e', PG_TEXT_CODEC_ID),
|
|
467
|
+
]),
|
|
468
|
+
);
|
|
469
|
+
return {
|
|
470
|
+
typePresent: () => exprSelect().project('result', cfExpr.exists(inner())).build(),
|
|
471
|
+
typeAbsent: () => exprSelect().project('result', cfExpr.notExists(inner())).build(),
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export interface NativeEnumValueExistsCheckBuilder {
|
|
476
|
+
valuePresent(): SelectAst;
|
|
477
|
+
valueAbsent(): SelectAst;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Typed native-enum member-value existence check over `pg_enum` joined to
|
|
482
|
+
* `pg_type` and `pg_namespace`. Schema, type name, and the candidate member
|
|
483
|
+
* value are bound as text parameters — used by `addNativeEnumValue`'s
|
|
484
|
+
* precheck (value absent) and postcheck (value present).
|
|
485
|
+
*/
|
|
486
|
+
export function nativeEnumValueExistsAst(options: {
|
|
487
|
+
readonly schema: string;
|
|
488
|
+
readonly typeName: string;
|
|
489
|
+
readonly value: string;
|
|
490
|
+
}): NativeEnumValueExistsCheckBuilder {
|
|
491
|
+
const inner = () =>
|
|
492
|
+
exprSelect()
|
|
493
|
+
.from(cfTable('pg_enum', 'e'))
|
|
494
|
+
.join(
|
|
495
|
+
cfTable('pg_type', 't'),
|
|
496
|
+
cfExpr.columnRef('t', 'oid').eqExpr(cfExpr.columnRef('e', 'enumtypid')),
|
|
497
|
+
)
|
|
498
|
+
.join(
|
|
499
|
+
cfTable('pg_namespace', 'n'),
|
|
500
|
+
cfExpr.columnRef('n', 'oid').eqExpr(cfExpr.columnRef('t', 'typnamespace')),
|
|
501
|
+
)
|
|
502
|
+
.project('one', cfExpr.lit(1))
|
|
503
|
+
.where(
|
|
504
|
+
cfExpr.allOf([
|
|
505
|
+
cfExpr
|
|
506
|
+
.columnRef('n', 'nspname')
|
|
507
|
+
.eqExpr(checkNamespace(options.schema).schemaFilterExpression()),
|
|
508
|
+
cfExpr.columnRef('t', 'typname').eqParam(options.typeName, PG_TEXT_CODEC_ID),
|
|
509
|
+
cfExpr.columnRef('e', 'enumlabel').eqParam(options.value, PG_TEXT_CODEC_ID),
|
|
510
|
+
]),
|
|
511
|
+
);
|
|
512
|
+
return {
|
|
513
|
+
valuePresent: () => exprSelect().project('result', cfExpr.exists(inner())).build(),
|
|
514
|
+
valueAbsent: () => exprSelect().project('result', cfExpr.notExists(inner())).build(),
|
|
515
|
+
};
|
|
516
|
+
}
|
|
@@ -25,11 +25,21 @@ const ledgerColumns = [
|
|
|
25
25
|
col('origin_profile_hash', 'text'),
|
|
26
26
|
col('destination_core_hash', 'text', { notNull: true }),
|
|
27
27
|
col('destination_profile_hash', 'text'),
|
|
28
|
-
col('contract_json_before', 'jsonb'),
|
|
29
|
-
col('contract_json_after', 'jsonb'),
|
|
30
28
|
col('operations', 'jsonb', { notNull: true }),
|
|
31
29
|
] as const;
|
|
32
30
|
|
|
31
|
+
// Content-addressed contract store: one row per distinct contract,
|
|
32
|
+
// keyed by its storage hash. The ledger's `origin_core_hash` /
|
|
33
|
+
// `destination_core_hash` are contract identifiers that resolve here by
|
|
34
|
+
// hash equality (no FK — a baseline origin has no stored contract by
|
|
35
|
+
// definition), so both endpoints of every edge are direct lookups and a
|
|
36
|
+
// contract revisited by a rollback cycle is stored exactly once.
|
|
37
|
+
const contractColumns = [
|
|
38
|
+
col('core_hash', 'text', { notNull: true, primaryKey: true }),
|
|
39
|
+
col('created_at', 'timestamptz', { notNull: true, default: fn('now()') }),
|
|
40
|
+
col('contract_json', 'jsonb', { notNull: true }),
|
|
41
|
+
] as const;
|
|
42
|
+
|
|
33
43
|
const markerTable = createTable({
|
|
34
44
|
schema: 'prisma_contract',
|
|
35
45
|
table: 'marker',
|
|
@@ -44,6 +54,13 @@ const ledgerTable = createTable({
|
|
|
44
54
|
columns: ledgerColumns,
|
|
45
55
|
});
|
|
46
56
|
|
|
57
|
+
const contractTable = createTable({
|
|
58
|
+
schema: 'prisma_contract',
|
|
59
|
+
table: 'contract',
|
|
60
|
+
ifNotExists: true,
|
|
61
|
+
columns: contractColumns,
|
|
62
|
+
});
|
|
63
|
+
|
|
47
64
|
const controlSchema = createSchema({ schema: 'prisma_contract', ifNotExists: true });
|
|
48
65
|
|
|
49
66
|
export function buildSignMarkerBootstrapQueries(): readonly DdlNode[] {
|
|
@@ -51,5 +68,5 @@ export function buildSignMarkerBootstrapQueries(): readonly DdlNode[] {
|
|
|
51
68
|
}
|
|
52
69
|
|
|
53
70
|
export function buildControlTableBootstrapQueries(): readonly DdlNode[] {
|
|
54
|
-
return [controlSchema, markerTable, ledgerTable];
|
|
71
|
+
return [controlSchema, markerTable, ledgerTable, contractTable];
|
|
55
72
|
}
|
package/src/contract-free/ddl.ts
CHANGED
|
@@ -2,9 +2,17 @@ import type { DdlColumn, DdlTableConstraint } from '@prisma-next/sql-relational-
|
|
|
2
2
|
import {
|
|
3
3
|
AddColumnAction,
|
|
4
4
|
type AnyAlterTableAction,
|
|
5
|
+
DropDefaultAction,
|
|
6
|
+
PostgresAlterPolicyRename,
|
|
5
7
|
PostgresAlterTable,
|
|
8
|
+
PostgresCreatePolicy,
|
|
6
9
|
PostgresCreateSchema,
|
|
7
10
|
PostgresCreateTable,
|
|
11
|
+
PostgresCreateType,
|
|
12
|
+
PostgresDisableRowLevelSecurity,
|
|
13
|
+
PostgresDropPolicy,
|
|
14
|
+
PostgresDropType,
|
|
15
|
+
type RlsPolicyOperation,
|
|
8
16
|
} from '../core/ddl/nodes';
|
|
9
17
|
|
|
10
18
|
/**
|
|
@@ -42,6 +50,31 @@ export function createSchema(options: {
|
|
|
42
50
|
return new PostgresCreateSchema(options);
|
|
43
51
|
}
|
|
44
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Build a Postgres `CREATE TYPE … AS ENUM (…)` DDL node. The type name (and
|
|
55
|
+
* optional schema) are quoted by the renderer; the enum member `values` are
|
|
56
|
+
* emitted as single-quote-escaped string literals. An absent `schema` renders
|
|
57
|
+
* the type name unqualified so the connection's `search_path` resolves it.
|
|
58
|
+
*/
|
|
59
|
+
export function createType(options: {
|
|
60
|
+
readonly schema?: string;
|
|
61
|
+
readonly name: string;
|
|
62
|
+
readonly values: readonly string[];
|
|
63
|
+
}): PostgresCreateType {
|
|
64
|
+
return new PostgresCreateType(options);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Build a Postgres `DROP TYPE` DDL node. See {@link createType} for the
|
|
69
|
+
* identifier-quoting and unqualified-when-schemaless behaviour.
|
|
70
|
+
*/
|
|
71
|
+
export function dropType(options: {
|
|
72
|
+
readonly schema?: string;
|
|
73
|
+
readonly name: string;
|
|
74
|
+
}): PostgresDropType {
|
|
75
|
+
return new PostgresDropType(options);
|
|
76
|
+
}
|
|
77
|
+
|
|
45
78
|
/**
|
|
46
79
|
* Build an `ADD COLUMN` action for use inside {@link alterTable}.
|
|
47
80
|
* The column is a structured `DdlColumn` so codec-encoded defaults flow
|
|
@@ -51,9 +84,17 @@ export function addColumnAction(column: DdlColumn): AddColumnAction {
|
|
|
51
84
|
return new AddColumnAction(column);
|
|
52
85
|
}
|
|
53
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Build a `DROP DEFAULT` action (`ALTER COLUMN "<name>" DROP DEFAULT`) for
|
|
89
|
+
* use inside {@link alterTable}. The renderer quotes the column name.
|
|
90
|
+
*/
|
|
91
|
+
export function dropDefaultAction(columnName: string): DropDefaultAction {
|
|
92
|
+
return new DropDefaultAction(columnName);
|
|
93
|
+
}
|
|
94
|
+
|
|
54
95
|
/**
|
|
55
96
|
* Build a Postgres `ALTER TABLE` query node carrying one or more actions.
|
|
56
|
-
* See {@link addColumnAction} for building actions.
|
|
97
|
+
* See {@link addColumnAction} / {@link dropDefaultAction} for building actions.
|
|
57
98
|
*/
|
|
58
99
|
export function alterTable(options: {
|
|
59
100
|
readonly table: string;
|
|
@@ -62,3 +103,59 @@ export function alterTable(options: {
|
|
|
62
103
|
}): PostgresAlterTable {
|
|
63
104
|
return new PostgresAlterTable(options);
|
|
64
105
|
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Build a Postgres `CREATE POLICY` DDL node.
|
|
109
|
+
*
|
|
110
|
+
* Identifiers (`schema`, `table`, `name`) are quoted by the renderer.
|
|
111
|
+
* `using` and `withCheck` are emitted verbatim as predicate SQL — callers
|
|
112
|
+
* must supply safe, pre-validated SQL expressions.
|
|
113
|
+
*/
|
|
114
|
+
export function createPolicy(options: {
|
|
115
|
+
readonly schema: string;
|
|
116
|
+
readonly table: string;
|
|
117
|
+
readonly name: string;
|
|
118
|
+
readonly permissive: boolean;
|
|
119
|
+
readonly operation: RlsPolicyOperation;
|
|
120
|
+
readonly roles: readonly string[];
|
|
121
|
+
readonly using?: string;
|
|
122
|
+
readonly withCheck?: string;
|
|
123
|
+
}): PostgresCreatePolicy {
|
|
124
|
+
return new PostgresCreatePolicy(options);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Build a Postgres `DROP POLICY` DDL node.
|
|
129
|
+
* Identifiers (`schema`, `table`, `name`) are quoted by the renderer.
|
|
130
|
+
*/
|
|
131
|
+
export function dropPolicy(options: {
|
|
132
|
+
readonly schema: string;
|
|
133
|
+
readonly table: string;
|
|
134
|
+
readonly name: string;
|
|
135
|
+
}): PostgresDropPolicy {
|
|
136
|
+
return new PostgresDropPolicy(options);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Build a Postgres `ALTER POLICY … RENAME TO` DDL node.
|
|
141
|
+
* Identifiers (`schema`, `table`, `name`, `newName`) are quoted by the renderer.
|
|
142
|
+
*/
|
|
143
|
+
export function alterPolicyRename(options: {
|
|
144
|
+
readonly schema: string;
|
|
145
|
+
readonly table: string;
|
|
146
|
+
readonly name: string;
|
|
147
|
+
readonly newName: string;
|
|
148
|
+
}): PostgresAlterPolicyRename {
|
|
149
|
+
return new PostgresAlterPolicyRename(options);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Build a Postgres `ALTER TABLE … DISABLE ROW LEVEL SECURITY` DDL node.
|
|
154
|
+
* Identifiers (`schema`, `table`) are quoted by the renderer.
|
|
155
|
+
*/
|
|
156
|
+
export function disableRowLevelSecurity(options: {
|
|
157
|
+
readonly schema: string;
|
|
158
|
+
readonly table: string;
|
|
159
|
+
}): PostgresDisableRowLevelSecurity {
|
|
160
|
+
return new PostgresDisableRowLevelSecurity(options);
|
|
161
|
+
}
|