@prisma-next/target-postgres 0.14.0-dev.84 → 0.14.0-dev.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/{authoring-ChmUI_tC.mjs → authoring-BtsOWgI3.mjs} +3 -3
  2. package/dist/{authoring-ChmUI_tC.mjs.map → authoring-BtsOWgI3.mjs.map} +1 -1
  3. package/dist/{codec-ids-C_-Hj6bL.mjs → codec-ids-B10ZZHzw.mjs} +3 -2
  4. package/dist/{codec-ids-C_-Hj6bL.mjs.map → codec-ids-B10ZZHzw.mjs.map} +1 -1
  5. package/dist/{codec-ids-BzrFF-I4.d.mts → codec-ids-CI144z7g.d.mts} +3 -2
  6. package/dist/{codec-ids-BzrFF-I4.d.mts.map → codec-ids-CI144z7g.d.mts.map} +1 -1
  7. package/dist/codec-ids.d.mts +2 -2
  8. package/dist/codec-ids.mjs +2 -2
  9. package/dist/{codec-types-BiIWziRO.d.mts → codec-types-CTfT4U4O.d.mts} +3 -2
  10. package/dist/codec-types-CTfT4U4O.d.mts.map +1 -0
  11. package/dist/codec-types.d.mts +1 -1
  12. package/dist/{codecs-Cm-nS4mQ.d.mts → codecs-D7W9O0Xx.d.mts} +26 -3
  13. package/dist/{codecs-Cm-nS4mQ.d.mts.map → codecs-D7W9O0Xx.d.mts.map} +1 -1
  14. package/dist/{codecs-BemGS69L.mjs → codecs-DRbb26Or.mjs} +31 -3
  15. package/dist/codecs-DRbb26Or.mjs.map +1 -0
  16. package/dist/codecs.d.mts +2 -2
  17. package/dist/codecs.mjs +2 -2
  18. package/dist/contract-free.mjs +3 -3
  19. package/dist/{control-policy-BfQLCrha.mjs → control-policy-DtbkLLGv.mjs} +4 -4
  20. package/dist/{control-policy-BfQLCrha.mjs.map → control-policy-DtbkLLGv.mjs.map} +1 -1
  21. package/dist/control.mjs +21 -7
  22. package/dist/control.mjs.map +1 -1
  23. package/dist/{ddl-eBZav_MS.mjs → ddl-GTTOvjx_.mjs} +3 -3
  24. package/dist/{ddl-eBZav_MS.mjs.map → ddl-GTTOvjx_.mjs.map} +1 -1
  25. package/dist/{descriptor-meta-DAwRBZpA.mjs → descriptor-meta-CFQKLXl_.mjs} +4 -4
  26. package/dist/{descriptor-meta-DAwRBZpA.mjs.map → descriptor-meta-CFQKLXl_.mjs.map} +1 -1
  27. package/dist/{diff-database-schema-jsEOfSYT.mjs → diff-database-schema-GncqMuSI.mjs} +4 -4
  28. package/dist/{diff-database-schema-jsEOfSYT.mjs.map → diff-database-schema-GncqMuSI.mjs.map} +1 -1
  29. package/dist/diff-database-schema.mjs +1 -1
  30. package/dist/issue-planner.mjs +1 -1
  31. package/dist/migration.mjs +2 -2
  32. package/dist/{op-factory-call-Dwsb1xzl.mjs → op-factory-call-C38NzvQD.mjs} +3 -3
  33. package/dist/{op-factory-call-Dwsb1xzl.mjs.map → op-factory-call-C38NzvQD.mjs.map} +1 -1
  34. package/dist/op-factory-call.mjs +1 -1
  35. package/dist/pack.d.mts +2 -2
  36. package/dist/pack.mjs +1 -1
  37. package/dist/{planner-ChCtpEGe.mjs → planner-kql24i_F.mjs} +7 -7
  38. package/dist/{planner-ChCtpEGe.mjs.map → planner-kql24i_F.mjs.map} +1 -1
  39. package/dist/{planner-produced-postgres-migration-Bb16yHNX.mjs → planner-produced-postgres-migration-D7y-PEHK.mjs} +2 -2
  40. package/dist/{planner-produced-postgres-migration-Bb16yHNX.mjs.map → planner-produced-postgres-migration-D7y-PEHK.mjs.map} +1 -1
  41. package/dist/planner-produced-postgres-migration.mjs +1 -1
  42. package/dist/{planner-sql-checks-Cx0ATsPc.mjs → planner-sql-checks-zqNfs2XZ.mjs} +2 -2
  43. package/dist/{planner-sql-checks-Cx0ATsPc.mjs.map → planner-sql-checks-zqNfs2XZ.mjs.map} +1 -1
  44. package/dist/planner-sql-checks.mjs +1 -1
  45. package/dist/planner.mjs +2 -2
  46. package/dist/{postgres-contract-view-BiDhl5Ez.mjs → postgres-contract-view-DM8sN1Ot.mjs} +4 -4
  47. package/dist/{postgres-contract-view-BiDhl5Ez.mjs.map → postgres-contract-view-DM8sN1Ot.mjs.map} +1 -1
  48. package/dist/{postgres-migration-Cj5Tpj1a.mjs → postgres-migration-arMSWU9b.mjs} +3 -3
  49. package/dist/{postgres-migration-Cj5Tpj1a.mjs.map → postgres-migration-arMSWU9b.mjs.map} +1 -1
  50. package/dist/{postgres-schema-ChBj22nX.mjs → postgres-schema-Cm4DtiGA.mjs} +2 -2
  51. package/dist/{postgres-schema-ChBj22nX.mjs.map → postgres-schema-Cm4DtiGA.mjs.map} +1 -1
  52. package/dist/{resolve-ddl-schema-BCSMHFwl.mjs → resolve-ddl-schema-XyBaaenM.mjs} +2 -2
  53. package/dist/{resolve-ddl-schema-BCSMHFwl.mjs.map → resolve-ddl-schema-XyBaaenM.mjs.map} +1 -1
  54. package/dist/runtime.mjs +1 -1
  55. package/dist/schema-ir-annotations.mjs +1 -1
  56. package/dist/types.mjs +1 -1
  57. package/package.json +20 -20
  58. package/src/core/codec-ids.ts +1 -0
  59. package/src/core/codec-type-map.ts +2 -0
  60. package/src/core/codecs.ts +43 -0
  61. package/src/core/psl-infer/infer-psl-contract.ts +19 -2
  62. package/src/core/psl-infer/postgres-type-map.ts +1 -0
  63. package/src/exports/codecs.ts +2 -0
  64. package/dist/codec-types-BiIWziRO.d.mts.map +0 -1
  65. package/dist/codecs-BemGS69L.mjs.map +0 -1
package/dist/control.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-DAwRBZpA.mjs";
1
+ import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-CFQKLXl_.mjs";
2
2
  import { a as postgresDiffSubjectGranularity, i as postgresDiffSubjectEntityKind } from "./postgres-table-schema-node-D6LvInCe.mjs";
3
3
  import { i as PostgresDatabaseSchemaNode } from "./postgres-role-schema-node-Cm-j0ZGM.mjs";
4
- import { n as diffPostgresSchema, r as contractToPostgresDatabaseSchemaNode } from "./diff-database-schema-jsEOfSYT.mjs";
4
+ import { n as diffPostgresSchema, r as contractToPostgresDatabaseSchemaNode } from "./diff-database-schema-GncqMuSI.mjs";
5
5
  import { r as renderDefaultLiteral } from "./planner-ddl-builders-BKlmGDJl.mjs";
6
- import { n as PostgresContractSerializer } from "./postgres-contract-view-BiDhl5Ez.mjs";
7
- import { t as createPostgresMigrationPlanner } from "./planner-ChCtpEGe.mjs";
6
+ import { n as PostgresContractSerializer } from "./postgres-contract-view-DM8sN1Ot.mjs";
7
+ import { t as createPostgresMigrationPlanner } from "./planner-kql24i_F.mjs";
8
8
  import { UNBOUND_NAMESPACE_ID, coordinateKey, elementCoordinates } from "@prisma-next/framework-components/ir";
9
9
  import { blindCast } from "@prisma-next/utils/casts";
10
10
  import { buildNativeTypeExpander, runnerFailure, runnerSuccess } from "@prisma-next/family-sql/control";
@@ -459,6 +459,10 @@ const PRESERVED_NATIVE_TYPES = {
459
459
  pslType: "String",
460
460
  attributeName: "db.Uuid"
461
461
  },
462
+ inet: {
463
+ pslType: "String",
464
+ attributeName: "db.Inet"
465
+ },
462
466
  int2: {
463
467
  pslType: "Int",
464
468
  attributeName: "db.SmallInt"
@@ -703,7 +707,7 @@ function resolveForeignKeys(tables, owners) {
703
707
  const fieldName = deriveRelationFieldName(fk.columns, fk.referencedTable);
704
708
  const optional = fk.columns.some((columnName) => table.columns[columnName]?.nullable ?? false);
705
709
  const relationField = {
706
- ...buildChildRelationField(fieldName, target.modelName, fk, optional),
710
+ ...buildChildRelationField(fieldName, target.modelName, fk, optional, void 0, table),
707
711
  typeNamespaceId: target.namespaceId,
708
712
  typeContractSpaceId: target.spaceId
709
713
  };
@@ -932,7 +936,7 @@ function buildModel(table, typeMap, enumNameMap, fieldNamesByTable, namedTypes,
932
936
  }
933
937
  for (const index of table.indexes) if (!index.unique) {
934
938
  const indexFieldNames = index.columns.map((columnName) => resolveColumnFieldName(fieldNamesByTable, table.name, columnName));
935
- modelAttributes.push(buildModelConstraintAttribute("index", indexFieldNames, index.name));
939
+ modelAttributes.push(buildModelConstraintAttribute("index", indexFieldNames, index.name, index.type));
936
940
  }
937
941
  if (mapName) modelAttributes.push(buildMapAttribute("model", mapName));
938
942
  const comment = table.primaryKey ? void 0 : "// WARNING: This table has no primary key in the database";
@@ -1013,6 +1017,7 @@ function buildRelationField(rel, hostTableName, fieldNamesByTable, usedFieldName
1013
1017
  if (rel.onDelete) args.push(namedArg("onDelete", rel.onDelete));
1014
1018
  if (rel.onUpdate) args.push(namedArg("onUpdate", rel.onUpdate));
1015
1019
  if (rel.fkName) args.push(namedArg("map", `"${escapePslString(rel.fkName)}"`));
1020
+ if (rel.index === false) args.push(namedArg("index", "false"));
1016
1021
  } else if (rel.relationName) args.push(namedArg("name", `"${escapePslString(rel.relationName)}"`));
1017
1022
  const attrs = args.length > 0 ? [buildAttribute("field", "relation", args)] : [];
1018
1023
  return {
@@ -1027,9 +1032,18 @@ function buildRelationField(rel, hostTableName, fieldNamesByTable, usedFieldName
1027
1032
  span: SYNTHETIC_SPAN
1028
1033
  };
1029
1034
  }
1030
- function buildModelConstraintAttribute(name, fields, constraintName) {
1035
+ /**
1036
+ * `indexType` carries a non-default index access method (e.g. `hash`) —
1037
+ * introspection already drops `btree` (the Postgres default) to `undefined`
1038
+ * (see the postgres control adapter), so this only ever fires for a real
1039
+ * non-default index, matching the same `@@index(type: "...")` argument
1040
+ * `contract-to-schema-ir.ts` reads back into the FK-backing-index
1041
+ * expectation `db verify` checks against the live database.
1042
+ */
1043
+ function buildModelConstraintAttribute(name, fields, constraintName, indexType) {
1031
1044
  const args = [positionalArg(`[${fields.join(", ")}]`)];
1032
1045
  if (constraintName !== void 0) args.push(namedArg("map", `"${escapePslString(constraintName)}"`));
1046
+ if (indexType !== void 0) args.push(namedArg("type", `"${escapePslString(indexType)}"`));
1033
1047
  return buildAttribute("model", name, args);
1034
1048
  }
1035
1049
  function buildSimpleConstraintFieldAttribute(name, constraintName) {