@prisma-next/adapter-postgres 0.15.0-dev.13 → 0.15.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-Bh8GA6sC.mjs → adapter-CssyjkaR.mjs} +2 -2
- package/dist/{adapter-Bh8GA6sC.mjs.map → adapter-CssyjkaR.mjs.map} +1 -1
- package/dist/adapter.mjs +1 -1
- package/dist/{control-adapter-aFfSI2bK.mjs → control-adapter-w2BFxQ--.mjs} +60 -118
- package/dist/control-adapter-w2BFxQ--.mjs.map +1 -0
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +1 -1
- package/dist/runtime.mjs +1 -1
- package/package.json +23 -23
- package/src/core/control-adapter.ts +60 -130
- package/dist/control-adapter-aFfSI2bK.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as renderLoweredSql, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from "./control-adapter-
|
|
1
|
+
import { n as renderLoweredSql, r as createPostgresBuiltinCodecLookup, t as PostgresControlAdapter } from "./control-adapter-w2BFxQ--.mjs";
|
|
2
2
|
import { APP_SPACE_ID } from "@prisma-next/framework-components/control";
|
|
3
3
|
import { isDdlNode } from "@prisma-next/sql-relational-core/ast";
|
|
4
4
|
//#region src/core/adapter.ts
|
|
@@ -63,4 +63,4 @@ function createPostgresAdapter(options) {
|
|
|
63
63
|
//#endregion
|
|
64
64
|
export { postgresRawCodecInferer as n, createPostgresAdapter as t };
|
|
65
65
|
|
|
66
|
-
//# sourceMappingURL=adapter-
|
|
66
|
+
//# sourceMappingURL=adapter-CssyjkaR.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-
|
|
1
|
+
{"version":3,"file":"adapter-CssyjkaR.mjs","names":[],"sources":["../src/core/adapter.ts"],"sourcesContent":["import type { CodecRegistry } from '@prisma-next/framework-components/codec';\nimport { APP_SPACE_ID } from '@prisma-next/framework-components/control';\nimport type {\n Adapter,\n AdapterProfile,\n AnyQueryAst,\n LowererContext,\n RawSqlLiteral,\n SqlQueryable,\n} from '@prisma-next/sql-relational-core/ast';\nimport { isDdlNode } from '@prisma-next/sql-relational-core/ast';\nimport type { RawCodecInferer } from '@prisma-next/sql-relational-core/expression';\nimport type { PostgresDdlNode } from '@prisma-next/target-postgres/ddl';\nimport { createPostgresBuiltinCodecLookup } from './codec-lookup';\nimport { PostgresControlAdapter } from './control-adapter';\nimport { renderLoweredSql } from './sql-renderer';\nimport type { PostgresAdapterOptions, PostgresContract, PostgresLoweredStatement } from './types';\n\nconst defaultCapabilities = Object.freeze({\n postgres: {\n orderBy: true,\n limit: true,\n lateral: true,\n jsonAgg: true,\n returning: true,\n distinctOn: true,\n },\n sql: {\n enums: true,\n returning: true,\n defaultInInsert: true,\n lateral: true,\n scalarList: true,\n },\n});\n\nclass PostgresAdapterImpl\n implements Adapter<AnyQueryAst, PostgresContract, PostgresLoweredStatement>\n{\n // These fields make the adapter instance structurally compatible with RuntimeAdapterInstance<'sql', 'postgres'> without introducing a runtime-plane dependency.\n readonly familyId = 'sql' as const;\n readonly targetId = 'postgres' as const;\n\n readonly profile: AdapterProfile<'postgres'>;\n private readonly codecLookup: CodecRegistry;\n\n constructor(options?: PostgresAdapterOptions) {\n this.codecLookup = options?.codecLookup ?? createPostgresBuiltinCodecLookup();\n const controlAdapter = new PostgresControlAdapter(this.codecLookup);\n this.profile = Object.freeze({\n id: options?.profileId ?? 'postgres/default@1',\n target: 'postgres',\n capabilities: defaultCapabilities,\n readMarker: (queryable: SqlQueryable) =>\n controlAdapter.readMarkerDiscriminated(\n {\n familyId: 'sql',\n targetId: 'postgres',\n query: async <Row = Record<string, unknown>>(\n sql: string,\n params?: readonly unknown[],\n ) => {\n const result = await queryable.query<Row>(sql, params);\n return { rows: [...result.rows] };\n },\n close: async () => {},\n },\n APP_SPACE_ID,\n ),\n });\n }\n\n lower(\n ast: AnyQueryAst | PostgresDdlNode,\n context: LowererContext<PostgresContract>,\n ): PostgresLoweredStatement {\n if (isDdlNode(ast)) {\n throw new Error(\n 'lower() does not lower DDL on the runtime adapter — DDL lowering is a control-plane concern handled by the control adapter.',\n );\n }\n return renderLoweredSql(ast, context.contract, this.codecLookup);\n }\n}\n\n/** Codec-id lookup for bare-literal interpolations used by `fns.raw` on a postgres client. Contributed as the descriptor's static `rawCodecInferer` slot. */\nexport const postgresRawCodecInferer: RawCodecInferer = {\n inferCodec(value: RawSqlLiteral): string {\n switch (typeof value) {\n case 'number':\n return Number.isSafeInteger(value) && value % 1 === 0 ? 'pg/int4' : 'pg/float8';\n case 'bigint':\n return 'pg/int8';\n case 'string':\n return 'pg/text';\n case 'boolean':\n return 'pg/bool';\n case 'object':\n if (value instanceof Uint8Array) return 'pg/bytea';\n }\n throw new Error(\n 'unsupported JS value type for raw-SQL interpolation: wrap this value in `param(...)` with an explicit codec',\n );\n },\n};\n\nexport function createPostgresAdapter(options?: PostgresAdapterOptions) {\n return Object.freeze(new PostgresAdapterImpl(options));\n}\n"],"mappings":";;;;AAkBA,MAAM,sBAAsB,OAAO,OAAO;CACxC,UAAU;EACR,SAAS;EACT,OAAO;EACP,SAAS;EACT,SAAS;EACT,WAAW;EACX,YAAY;CACd;CACA,KAAK;EACH,OAAO;EACP,WAAW;EACX,iBAAiB;EACjB,SAAS;EACT,YAAY;CACd;AACF,CAAC;AAED,IAAM,sBAAN,MAEA;CAEE,WAAoB;CACpB,WAAoB;CAEpB;CACA;CAEA,YAAY,SAAkC;EAC5C,KAAK,cAAc,SAAS,eAAe,iCAAiC;EAC5E,MAAM,iBAAiB,IAAI,uBAAuB,KAAK,WAAW;EAClE,KAAK,UAAU,OAAO,OAAO;GAC3B,IAAI,SAAS,aAAa;GAC1B,QAAQ;GACR,cAAc;GACd,aAAa,cACX,eAAe,wBACb;IACE,UAAU;IACV,UAAU;IACV,OAAO,OACL,KACA,WACG;KAEH,OAAO,EAAE,MAAM,CAAC,IAAG,MADE,UAAU,MAAW,KAAK,MAAM,EAAA,CAC3B,IAAI,EAAE;IAClC;IACA,OAAO,YAAY,CAAC;GACtB,GACA,YACF;EACJ,CAAC;CACH;CAEA,MACE,KACA,SAC0B;EAC1B,IAAI,UAAU,GAAG,GACf,MAAM,IAAI,MACR,6HACF;EAEF,OAAO,iBAAiB,KAAK,QAAQ,UAAU,KAAK,WAAW;CACjE;AACF;;AAGA,MAAa,0BAA2C,EACtD,WAAW,OAA8B;CACvC,QAAQ,OAAO,OAAf;EACE,KAAK,UACH,OAAO,OAAO,cAAc,KAAK,KAAK,QAAQ,MAAM,IAAI,YAAY;EACtE,KAAK,UACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,UACH,IAAI,iBAAiB,YAAY,OAAO;CAC5C;CACA,MAAM,IAAI,MACR,6GACF;AACF,EACF;AAEA,SAAgB,sBAAsB,SAAkC;CACtE,OAAO,OAAO,OAAO,IAAI,oBAAoB,OAAO,CAAC;AACvD"}
|
package/dist/adapter.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-
|
|
1
|
+
import { n as postgresRawCodecInferer, t as createPostgresAdapter } from "./adapter-CssyjkaR.mjs";
|
|
2
2
|
export { createPostgresAdapter, postgresRawCodecInferer };
|
|
@@ -5,13 +5,12 @@ import { parseMarkerRowSafely, rethrowMarkerReadError, withMarkerReadErrorHandli
|
|
|
5
5
|
import { parseContractMarkerRow } from "@prisma-next/family-sql/verify";
|
|
6
6
|
import { UNBOUND_NAMESPACE_ID } from "@prisma-next/framework-components/ir";
|
|
7
7
|
import { REFERENTIAL_ACTION_SQL } from "@prisma-next/sql-contract/referential-action-sql";
|
|
8
|
-
import { RelationalSchemaNodeKind } from "@prisma-next/sql-schema-ir/types";
|
|
9
8
|
import { buildControlTableBootstrapQueries, buildSignMarkerBootstrapQueries, int4, int8, jsonb, pgTable, text, textArray, timestamptz } from "@prisma-next/target-postgres/contract-free";
|
|
10
9
|
import { parsePostgresDefault } from "@prisma-next/target-postgres/default-normalizer";
|
|
11
10
|
import { normalizeSchemaNativeType } from "@prisma-next/target-postgres/native-type-normalizer";
|
|
12
11
|
import { parseRlsPolicyWireName } from "@prisma-next/target-postgres/rls-canonicalize";
|
|
13
12
|
import { escapeLiteral, quoteIdentifier } from "@prisma-next/target-postgres/sql-utils";
|
|
14
|
-
import { PostgresDatabaseSchemaNode, PostgresNamespaceSchemaNode, PostgresNativeEnumSchemaNode, PostgresPolicySchemaNode, PostgresRoleSchemaNode,
|
|
13
|
+
import { PostgresDatabaseSchemaNode, PostgresNamespaceSchemaNode, PostgresNativeEnumSchemaNode, PostgresPolicySchemaNode, PostgresRoleSchemaNode, PostgresTableSchemaNode } from "@prisma-next/target-postgres/types";
|
|
15
14
|
import { blindCast } from "@prisma-next/utils/casts";
|
|
16
15
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
17
16
|
import { createAstCodecRegistry, deriveParamMetadata, encodeParamsWithMetadata } from "@prisma-next/sql-runtime";
|
|
@@ -1014,74 +1013,64 @@ var PostgresControlAdapter = class {
|
|
|
1014
1013
|
WHERE c.table_schema = $1
|
|
1015
1014
|
ORDER BY c.table_name, c.ordinal_position`, [schema]);
|
|
1016
1015
|
const pkResult = await driver.query(`SELECT
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
FROM
|
|
1022
|
-
JOIN
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
AND
|
|
1028
|
-
|
|
1029
|
-
AND con.contype = 'p'
|
|
1030
|
-
ORDER BY cl.relname, k.ord`, [schema]);
|
|
1016
|
+
tc.table_name,
|
|
1017
|
+
tc.constraint_name,
|
|
1018
|
+
kcu.column_name,
|
|
1019
|
+
kcu.ordinal_position
|
|
1020
|
+
FROM information_schema.table_constraints tc
|
|
1021
|
+
JOIN information_schema.key_column_usage kcu
|
|
1022
|
+
ON tc.constraint_name = kcu.constraint_name
|
|
1023
|
+
AND tc.table_schema = kcu.table_schema
|
|
1024
|
+
AND tc.table_name = kcu.table_name
|
|
1025
|
+
WHERE tc.table_schema = $1
|
|
1026
|
+
AND tc.constraint_type = 'PRIMARY KEY'
|
|
1027
|
+
ORDER BY tc.table_name, kcu.ordinal_position`, [schema]);
|
|
1031
1028
|
const fkResult = await driver.query(`SELECT
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1029
|
+
tc.table_name,
|
|
1030
|
+
tc.constraint_name,
|
|
1031
|
+
kcu.column_name,
|
|
1032
|
+
kcu.ordinal_position,
|
|
1036
1033
|
ref_ns.nspname AS referenced_table_schema,
|
|
1037
1034
|
ref_cl.relname AS referenced_table_name,
|
|
1038
1035
|
ref_att.attname AS referenced_column_name,
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
WHEN 'd' THEN 'SET DEFAULT'
|
|
1052
|
-
END AS update_rule
|
|
1053
|
-
FROM pg_catalog.pg_constraint con
|
|
1054
|
-
JOIN pg_catalog.pg_class cl ON cl.oid = con.conrelid
|
|
1055
|
-
JOIN pg_catalog.pg_namespace ns ON ns.oid = cl.relnamespace
|
|
1056
|
-
JOIN LATERAL unnest(con.conkey) WITH ORDINALITY AS k(attnum, ord) ON true
|
|
1057
|
-
JOIN pg_catalog.pg_attribute a
|
|
1058
|
-
ON a.attrelid = con.conrelid
|
|
1059
|
-
AND a.attnum = k.attnum
|
|
1036
|
+
rc.delete_rule,
|
|
1037
|
+
rc.update_rule
|
|
1038
|
+
FROM information_schema.table_constraints tc
|
|
1039
|
+
JOIN information_schema.key_column_usage kcu
|
|
1040
|
+
ON tc.constraint_name = kcu.constraint_name
|
|
1041
|
+
AND tc.table_schema = kcu.table_schema
|
|
1042
|
+
AND tc.table_name = kcu.table_name
|
|
1043
|
+
JOIN pg_catalog.pg_constraint pgc
|
|
1044
|
+
ON pgc.conname = tc.constraint_name
|
|
1045
|
+
AND pgc.connamespace = (
|
|
1046
|
+
SELECT oid FROM pg_catalog.pg_namespace WHERE nspname = tc.table_schema
|
|
1047
|
+
)
|
|
1060
1048
|
JOIN pg_catalog.pg_class ref_cl
|
|
1061
|
-
ON ref_cl.oid =
|
|
1049
|
+
ON ref_cl.oid = pgc.confrelid
|
|
1062
1050
|
JOIN pg_catalog.pg_namespace ref_ns
|
|
1063
1051
|
ON ref_ns.oid = ref_cl.relnamespace
|
|
1064
1052
|
JOIN pg_catalog.pg_attribute ref_att
|
|
1065
|
-
ON ref_att.attrelid =
|
|
1066
|
-
AND ref_att.attnum =
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1053
|
+
ON ref_att.attrelid = pgc.confrelid
|
|
1054
|
+
AND ref_att.attnum = pgc.confkey[kcu.ordinal_position]
|
|
1055
|
+
JOIN information_schema.referential_constraints rc
|
|
1056
|
+
ON rc.constraint_name = tc.constraint_name
|
|
1057
|
+
AND rc.constraint_schema = tc.table_schema
|
|
1058
|
+
WHERE tc.table_schema = $1
|
|
1059
|
+
AND tc.constraint_type = 'FOREIGN KEY'
|
|
1060
|
+
ORDER BY tc.table_name, tc.constraint_name, kcu.ordinal_position`, [schema]);
|
|
1070
1061
|
const uniqueResult = await driver.query(`SELECT
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
FROM
|
|
1076
|
-
JOIN
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
AND
|
|
1082
|
-
|
|
1083
|
-
AND con.contype = 'u'
|
|
1084
|
-
ORDER BY cl.relname, con.conname, k.ord`, [schema]);
|
|
1062
|
+
tc.table_name,
|
|
1063
|
+
tc.constraint_name,
|
|
1064
|
+
kcu.column_name,
|
|
1065
|
+
kcu.ordinal_position
|
|
1066
|
+
FROM information_schema.table_constraints tc
|
|
1067
|
+
JOIN information_schema.key_column_usage kcu
|
|
1068
|
+
ON tc.constraint_name = kcu.constraint_name
|
|
1069
|
+
AND tc.table_schema = kcu.table_schema
|
|
1070
|
+
AND tc.table_name = kcu.table_name
|
|
1071
|
+
WHERE tc.table_schema = $1
|
|
1072
|
+
AND tc.constraint_type = 'UNIQUE'
|
|
1073
|
+
ORDER BY tc.table_name, tc.constraint_name, kcu.ordinal_position`, [schema]);
|
|
1085
1074
|
const indexResult = await driver.query(`SELECT
|
|
1086
1075
|
i.tablename,
|
|
1087
1076
|
i.indexname,
|
|
@@ -1102,9 +1091,10 @@ var PostgresControlAdapter = class {
|
|
|
1102
1091
|
WHERE i.schemaname = $1
|
|
1103
1092
|
AND NOT EXISTS (
|
|
1104
1093
|
SELECT 1
|
|
1105
|
-
FROM
|
|
1106
|
-
WHERE
|
|
1107
|
-
AND
|
|
1094
|
+
FROM information_schema.table_constraints tc
|
|
1095
|
+
WHERE tc.table_schema = $1
|
|
1096
|
+
AND tc.table_name = i.tablename
|
|
1097
|
+
AND tc.constraint_name = i.indexname
|
|
1108
1098
|
)
|
|
1109
1099
|
ORDER BY i.tablename, i.indexname, k.ord`, [schema]);
|
|
1110
1100
|
const checkResult = await driver.query(`SELECT
|
|
@@ -1164,8 +1154,7 @@ var PostgresControlAdapter = class {
|
|
|
1164
1154
|
const primaryKeyColumns = pkRows.sort((a, b) => a.ordinal_position - b.ordinal_position).map((row) => row.column_name);
|
|
1165
1155
|
const primaryKey = primaryKeyColumns.length > 0 ? {
|
|
1166
1156
|
columns: primaryKeyColumns,
|
|
1167
|
-
...pkRows[0]?.constraint_name ? { name: pkRows[0].constraint_name } : {}
|
|
1168
|
-
dependsOn: postgresColumnDependsOn(schema, tableName, primaryKeyColumns)
|
|
1157
|
+
...pkRows[0]?.constraint_name ? { name: pkRows[0].constraint_name } : {}
|
|
1169
1158
|
} : void 0;
|
|
1170
1159
|
const foreignKeysMap = /* @__PURE__ */ new Map();
|
|
1171
1160
|
for (const fkRow of fksByTable.get(tableName) ?? []) {
|
|
@@ -1190,8 +1179,7 @@ var PostgresControlAdapter = class {
|
|
|
1190
1179
|
referencedColumns: Object.freeze([...fk.referencedColumns]),
|
|
1191
1180
|
name: fk.name,
|
|
1192
1181
|
...ifDefined("onDelete", mapReferentialAction(fk.deleteRule)),
|
|
1193
|
-
...ifDefined("onUpdate", mapReferentialAction(fk.updateRule))
|
|
1194
|
-
dependsOn: [postgresTableDependsOn(fk.referencedSchema, fk.referencedTable), ...postgresColumnDependsOn(schema, tableName, fk.columns)]
|
|
1182
|
+
...ifDefined("onUpdate", mapReferentialAction(fk.updateRule))
|
|
1195
1183
|
}));
|
|
1196
1184
|
const pkConstraints = pkConstraintsByTable.get(tableName) ?? /* @__PURE__ */ new Set();
|
|
1197
1185
|
const uniquesMap = /* @__PURE__ */ new Map();
|
|
@@ -1206,8 +1194,7 @@ var PostgresControlAdapter = class {
|
|
|
1206
1194
|
}
|
|
1207
1195
|
const uniques = Array.from(uniquesMap.values()).map((uq) => ({
|
|
1208
1196
|
columns: Object.freeze([...uq.columns]),
|
|
1209
|
-
name: uq.name
|
|
1210
|
-
dependsOn: postgresColumnDependsOn(schema, tableName, uq.columns)
|
|
1197
|
+
name: uq.name
|
|
1211
1198
|
}));
|
|
1212
1199
|
const indexesMap = /* @__PURE__ */ new Map();
|
|
1213
1200
|
const indexNamesWithExpressionKey = /* @__PURE__ */ new Set();
|
|
@@ -1242,8 +1229,7 @@ var PostgresControlAdapter = class {
|
|
|
1242
1229
|
name: idx.name,
|
|
1243
1230
|
unique: idx.unique,
|
|
1244
1231
|
...idx.type !== void 0 && { type: idx.type },
|
|
1245
|
-
...idx.options !== void 0 && { options: idx.options }
|
|
1246
|
-
dependsOn: postgresColumnDependsOn(schema, tableName, idx.columns)
|
|
1232
|
+
...idx.options !== void 0 && { options: idx.options }
|
|
1247
1233
|
}));
|
|
1248
1234
|
const checksForTable = [];
|
|
1249
1235
|
for (const checkRow of checksByTable.get(tableName) ?? []) {
|
|
@@ -1295,8 +1281,7 @@ var PostgresControlAdapter = class {
|
|
|
1295
1281
|
roles: policyRoles,
|
|
1296
1282
|
...row.qual !== null ? { using: row.qual } : {},
|
|
1297
1283
|
...row.with_check !== null ? { withCheck: row.with_check } : {},
|
|
1298
|
-
permissive
|
|
1299
|
-
dependsOn: [postgresTableDependsOn(row.schemaname, row.tablename), ...policyRoles.map(postgresRoleDependsOn)]
|
|
1284
|
+
permissive
|
|
1300
1285
|
});
|
|
1301
1286
|
const list = policiesByTable.get(row.tablename) ?? [];
|
|
1302
1287
|
list.push(policy);
|
|
@@ -1462,49 +1447,6 @@ function mapReferentialAction(rule) {
|
|
|
1462
1447
|
return mapped;
|
|
1463
1448
|
}
|
|
1464
1449
|
/**
|
|
1465
|
-
* A FK/policy dependency chain, mirroring the shape the expected-side
|
|
1466
|
-
* derivation stamps (`contractToPostgresDatabaseSchemaNode`): the database
|
|
1467
|
-
* root's fixed sentinel id, then the namespace, then the table.
|
|
1468
|
-
*/
|
|
1469
|
-
function postgresTableDependsOn(namespaceId, tableName) {
|
|
1470
|
-
return [
|
|
1471
|
-
{
|
|
1472
|
-
nodeKind: PostgresSchemaNodeKind.database,
|
|
1473
|
-
id: "database"
|
|
1474
|
-
},
|
|
1475
|
-
{
|
|
1476
|
-
nodeKind: PostgresSchemaNodeKind.namespace,
|
|
1477
|
-
id: namespaceId
|
|
1478
|
-
},
|
|
1479
|
-
{
|
|
1480
|
-
nodeKind: PostgresSchemaNodeKind.table,
|
|
1481
|
-
id: tableName
|
|
1482
|
-
}
|
|
1483
|
-
];
|
|
1484
|
-
}
|
|
1485
|
-
/** A policy's dependency chain onto one of the roles it grants to. */
|
|
1486
|
-
function postgresRoleDependsOn(role) {
|
|
1487
|
-
return [{
|
|
1488
|
-
nodeKind: PostgresSchemaNodeKind.database,
|
|
1489
|
-
id: "database"
|
|
1490
|
-
}, {
|
|
1491
|
-
nodeKind: PostgresSchemaNodeKind.role,
|
|
1492
|
-
id: role
|
|
1493
|
-
}];
|
|
1494
|
-
}
|
|
1495
|
-
/**
|
|
1496
|
-
* The chains from a table-child object (foreign key, index, unique, primary
|
|
1497
|
-
* key) to each of the own columns it is built on — the introspection-side
|
|
1498
|
-
* mirror of `contractToPostgresDatabaseSchemaNode`'s `columnDependsOn`. An
|
|
1499
|
-
* object is dropped before the columns it covers.
|
|
1500
|
-
*/
|
|
1501
|
-
function postgresColumnDependsOn(namespaceId, tableName, columns) {
|
|
1502
|
-
return columns.map((column) => [...postgresTableDependsOn(namespaceId, tableName), {
|
|
1503
|
-
nodeKind: RelationalSchemaNodeKind.column,
|
|
1504
|
-
id: `column:${column}`
|
|
1505
|
-
}]);
|
|
1506
|
-
}
|
|
1507
|
-
/**
|
|
1508
1450
|
* Groups an array of objects by a specified key.
|
|
1509
1451
|
* Returns a Map for O(1) lookup by group key.
|
|
1510
1452
|
*/
|
|
@@ -1785,4 +1727,4 @@ async function pgRenderDdlExecuteRequest(ast, codecLookup) {
|
|
|
1785
1727
|
//#endregion
|
|
1786
1728
|
export { renderLoweredSql as n, createPostgresBuiltinCodecLookup as r, PostgresControlAdapter as t };
|
|
1787
1729
|
|
|
1788
|
-
//# sourceMappingURL=control-adapter-
|
|
1730
|
+
//# sourceMappingURL=control-adapter-w2BFxQ--.mjs.map
|